diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-18 21:06:14 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-18 21:06:14 +0300 |
commit | b08279013423a66f06f5edde4e067f328fe135bd (patch) | |
tree | 47aca1a9b0655cd7861bddf31ec17d4b302fc4ea /db | |
parent | 4584eb0e07d372d6014de16ab359965475184c99 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20190903150358_create_analytics_repository_files_table.rb | 21 | ||||
-rw-r--r-- | db/migrate/20190903150435_create_analytics_repository_file_edits_table.rb | 29 | ||||
-rw-r--r-- | db/schema.rb | 18 |
3 files changed, 68 insertions, 0 deletions
diff --git a/db/migrate/20190903150358_create_analytics_repository_files_table.rb b/db/migrate/20190903150358_create_analytics_repository_files_table.rb new file mode 100644 index 00000000000..e7c30a149f9 --- /dev/null +++ b/db/migrate/20190903150358_create_analytics_repository_files_table.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +class CreateAnalyticsRepositoryFilesTable < ActiveRecord::Migration[5.2] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def change + create_table :analytics_repository_files do |t| + t.references :project, + index: false, + foreign_key: { on_delete: :cascade }, + null: false + t.string :file_path, + limit: 4096, + null: false + end + + add_index :analytics_repository_files, [:project_id, :file_path], unique: true + end +end diff --git a/db/migrate/20190903150435_create_analytics_repository_file_edits_table.rb b/db/migrate/20190903150435_create_analytics_repository_file_edits_table.rb new file mode 100644 index 00000000000..dca3fa1b37d --- /dev/null +++ b/db/migrate/20190903150435_create_analytics_repository_file_edits_table.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +class CreateAnalyticsRepositoryFileEditsTable < ActiveRecord::Migration[5.2] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def change + create_table :analytics_repository_file_edits do |t| + t.references :project, + index: true, + foreign_key: { on_delete: :cascade }, null: false + t.references :analytics_repository_file, + index: false, + foreign_key: { on_delete: :cascade }, + null: false + t.date :committed_date, + null: false + t.integer :num_edits, + null: false, + default: 0 + end + + add_index :analytics_repository_file_edits, + [:analytics_repository_file_id, :committed_date, :project_id], + name: 'index_file_edits_on_committed_date_file_id_and_project_id', + unique: true + end +end diff --git a/db/schema.rb b/db/schema.rb index 09f27d2f9cb..b60593132f5 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -93,6 +93,21 @@ ActiveRecord::Schema.define(version: 2019_09_18_104222) do t.index ["project_id"], name: "analytics_repository_languages_on_project_id" end + create_table "analytics_repository_file_edits", force: :cascade do |t| + t.bigint "project_id", null: false + t.bigint "analytics_repository_file_id", null: false + t.date "committed_date", null: false + t.integer "num_edits", default: 0, null: false + t.index ["analytics_repository_file_id", "committed_date", "project_id"], name: "index_file_edits_on_committed_date_file_id_and_project_id", unique: true + t.index ["project_id"], name: "index_analytics_repository_file_edits_on_project_id" + end + + create_table "analytics_repository_files", force: :cascade do |t| + t.bigint "project_id", null: false + t.string "file_path", limit: 4096, null: false + t.index ["project_id", "file_path"], name: "index_analytics_repository_files_on_project_id_and_file_path", unique: true + end + create_table "appearances", id: :serial, force: :cascade do |t| t.string "title", null: false t.text "description", null: false @@ -3789,6 +3804,9 @@ ActiveRecord::Schema.define(version: 2019_09_18_104222) do add_foreign_key "analytics_cycle_analytics_project_stages", "projects", on_delete: :cascade add_foreign_key "analytics_language_trend_repository_languages", "programming_languages", on_delete: :cascade add_foreign_key "analytics_language_trend_repository_languages", "projects", on_delete: :cascade + add_foreign_key "analytics_repository_file_edits", "analytics_repository_files", on_delete: :cascade + add_foreign_key "analytics_repository_file_edits", "projects", on_delete: :cascade + add_foreign_key "analytics_repository_files", "projects", on_delete: :cascade add_foreign_key "application_settings", "namespaces", column: "custom_project_templates_group_id", on_delete: :nullify add_foreign_key "application_settings", "projects", column: "file_template_project_id", name: "fk_ec757bd087", on_delete: :nullify add_foreign_key "application_settings", "projects", column: "instance_administration_project_id", on_delete: :nullify |