diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2018-03-08 15:54:57 +0300 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2018-03-08 15:54:57 +0300 |
commit | a284400099af145fe63c6a00609ea59f768d383c (patch) | |
tree | 98b139340ca711acc61aeb5de3ab4c8fee62ce18 /db | |
parent | 4eaa7dcc7886a83f1e51ef351271c73a12957d82 (diff) | |
parent | 609a434c6dc2c6d4aafb359348c129fc01d264e3 (diff) |
Merge branch 'sh-add-missing-acts-as-taggable-indices' into 'master'
Adding missing indexes migrations from taggings table
Closes #43927
See merge request gitlab-org/gitlab-ce!17563
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20180306134842_add_missing_indexes_acts_as_taggable_on_engine.rb | 21 | ||||
-rw-r--r-- | db/schema.rb | 2 |
2 files changed, 23 insertions, 0 deletions
diff --git a/db/migrate/20180306134842_add_missing_indexes_acts_as_taggable_on_engine.rb b/db/migrate/20180306134842_add_missing_indexes_acts_as_taggable_on_engine.rb new file mode 100644 index 00000000000..06e402adcd7 --- /dev/null +++ b/db/migrate/20180306134842_add_missing_indexes_acts_as_taggable_on_engine.rb @@ -0,0 +1,21 @@ +# This migration comes from acts_as_taggable_on_engine (originally 6) +# +# It has been modified to handle no-downtime GitLab migrations. Several +# indexes have been removed since they are not needed for GitLab. +class AddMissingIndexesActsAsTaggableOnEngine < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_concurrent_index :taggings, :tag_id unless index_exists? :taggings, :tag_id + add_concurrent_index :taggings, [:taggable_id, :taggable_type] unless index_exists? :taggings, [:taggable_id, :taggable_type] + end + + def down + remove_concurrent_index :taggings, :tag_id + remove_concurrent_index :taggings, [:taggable_id, :taggable_type] + end +end diff --git a/db/schema.rb b/db/schema.rb index d47aaf16f11..bfd4d2ef38f 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1734,7 +1734,9 @@ ActiveRecord::Schema.define(version: 20180308052825) do end add_index "taggings", ["tag_id", "taggable_id", "taggable_type", "context", "tagger_id", "tagger_type"], name: "taggings_idx", unique: true, using: :btree + add_index "taggings", ["tag_id"], name: "index_taggings_on_tag_id", using: :btree add_index "taggings", ["taggable_id", "taggable_type", "context"], name: "index_taggings_on_taggable_id_and_taggable_type_and_context", using: :btree + add_index "taggings", ["taggable_id", "taggable_type"], name: "index_taggings_on_taggable_id_and_taggable_type", using: :btree create_table "tags", force: :cascade do |t| t.string "name" |