diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-05 18:08:19 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-05 18:08:19 +0000 |
commit | a8de96bff51846e160b76506dc0ca0fe6f767f64 (patch) | |
tree | 1036f1ca75aba492eaaa3439c84a3109b4684896 /db | |
parent | afe2b984524ae4b0c8a0636db7ec5b2c452f0734 (diff) | |
download | gitlab-ce-a8de96bff51846e160b76506dc0ca0fe6f767f64.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20200226100614_create_requirements.rb | 28 | ||||
-rw-r--r-- | db/migrate/20200226100624_requirements_add_project_fk.rb | 19 | ||||
-rw-r--r-- | db/migrate/20200226100634_requirements_add_author_fk.rb | 19 | ||||
-rw-r--r-- | db/post_migrate/20200217091401_reschedule_link_lfs_objects.rb | 29 | ||||
-rw-r--r-- | db/schema.rb | 21 |
5 files changed, 87 insertions, 29 deletions
diff --git a/db/migrate/20200226100614_create_requirements.rb b/db/migrate/20200226100614_create_requirements.rb new file mode 100644 index 00000000000..4ebbf38b8d1 --- /dev/null +++ b/db/migrate/20200226100614_create_requirements.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +class CreateRequirements < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def change + create_table :requirements do |t| + t.timestamps_with_timezone null: false + t.integer :project_id, null: false + t.integer :author_id + t.integer :iid, null: false + t.integer :cached_markdown_version + t.integer :state, limit: 2, default: 1, null: false + t.string :title, limit: 255, null: false + t.text :title_html + + t.index :project_id + t.index :author_id + t.index :title, name: "index_requirements_on_title_trigram", using: :gin, opclass: :gin_trgm_ops + t.index :state + t.index :created_at + t.index :updated_at + t.index %w(project_id iid), name: 'index_requirements_on_project_id_and_iid', where: 'project_id IS NOT NULL', unique: true, using: :btree + end + end +end diff --git a/db/migrate/20200226100624_requirements_add_project_fk.rb b/db/migrate/20200226100624_requirements_add_project_fk.rb new file mode 100644 index 00000000000..7c133e820f3 --- /dev/null +++ b/db/migrate/20200226100624_requirements_add_project_fk.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class RequirementsAddProjectFk < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + with_lock_retries do + add_foreign_key(:requirements, :projects, column: :project_id, on_delete: :cascade) # rubocop: disable Migration/AddConcurrentForeignKey + end + end + + def down + with_lock_retries do + remove_foreign_key(:requirements, column: :project_id) + end + end +end diff --git a/db/migrate/20200226100634_requirements_add_author_fk.rb b/db/migrate/20200226100634_requirements_add_author_fk.rb new file mode 100644 index 00000000000..8e1a726bb76 --- /dev/null +++ b/db/migrate/20200226100634_requirements_add_author_fk.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class RequirementsAddAuthorFk < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + with_lock_retries do + add_foreign_key(:requirements, :users, column: :author_id, on_delete: :nullify) # rubocop: disable Migration/AddConcurrentForeignKey + end + end + + def down + with_lock_retries do + remove_foreign_key(:requirements, column: :author_id) + end + end +end diff --git a/db/post_migrate/20200217091401_reschedule_link_lfs_objects.rb b/db/post_migrate/20200217091401_reschedule_link_lfs_objects.rb deleted file mode 100644 index a7d1b42ef70..00000000000 --- a/db/post_migrate/20200217091401_reschedule_link_lfs_objects.rb +++ /dev/null @@ -1,29 +0,0 @@ -# frozen_string_literal: true - -class RescheduleLinkLfsObjects < ActiveRecord::Migration[6.0] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - MIGRATION = 'LinkLfsObjects' - BATCH_SIZE = 1_000 - - disable_ddl_transaction! - - def up - forks = Gitlab::BackgroundMigration::LinkLfsObjects::Project.with_non_existing_lfs_objects - - queue_background_migration_jobs_by_range_at_intervals( - forks, - MIGRATION, - BackgroundMigrationWorker.minimum_interval, - batch_size: BATCH_SIZE - ) - end - - def down - # No-op. No need to make this reversible. In case the jobs enqueued runs and - # fails at some point, some records will be created. When rescheduled, those - # records won't be re-created. It's also hard to track which records to clean - # up if ever. - end -end diff --git a/db/schema.rb b/db/schema.rb index 2360c0f4025..2e7e0d8ce7c 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -3723,6 +3723,25 @@ ActiveRecord::Schema.define(version: 2020_03_04_160823) do t.index ["project_id", "programming_language_id"], name: "index_repository_languages_on_project_and_languages_id", unique: true end + create_table "requirements", force: :cascade do |t| + t.datetime_with_timezone "created_at", null: false + t.datetime_with_timezone "updated_at", null: false + t.integer "project_id", null: false + t.integer "author_id" + t.integer "iid", null: false + t.integer "cached_markdown_version" + t.integer "state", limit: 2, default: 1, null: false + t.string "title", limit: 255, null: false + t.text "title_html" + t.index ["author_id"], name: "index_requirements_on_author_id" + t.index ["created_at"], name: "index_requirements_on_created_at" + t.index ["project_id", "iid"], name: "index_requirements_on_project_id_and_iid", unique: true, where: "(project_id IS NOT NULL)" + t.index ["project_id"], name: "index_requirements_on_project_id" + t.index ["state"], name: "index_requirements_on_state" + t.index ["title"], name: "index_requirements_on_title_trigram", opclass: :gin_trgm_ops, using: :gin + t.index ["updated_at"], name: "index_requirements_on_updated_at" + end + create_table "resource_label_events", force: :cascade do |t| t.integer "action", null: false t.integer "issue_id" @@ -5001,6 +5020,8 @@ ActiveRecord::Schema.define(version: 2020_03_04_160823) do add_foreign_key "releases", "users", column: "author_id", name: "fk_8e4456f90f", on_delete: :nullify add_foreign_key "remote_mirrors", "projects", name: "fk_43a9aa4ca8", on_delete: :cascade add_foreign_key "repository_languages", "projects", on_delete: :cascade + add_foreign_key "requirements", "projects", on_delete: :cascade + add_foreign_key "requirements", "users", column: "author_id", on_delete: :nullify add_foreign_key "resource_label_events", "epics", on_delete: :cascade add_foreign_key "resource_label_events", "issues", on_delete: :cascade add_foreign_key "resource_label_events", "labels", on_delete: :nullify |