-
Notifications
You must be signed in to change notification settings - Fork 509
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AO3-6212 AO3-6573 Add indices to tag_set_associations, and add the de…
…parture gem to make future migrations easier. (#4528) * AO3-6212 Add indices to tag_set_associations. Also introduces the departure gem, to make future migrations easier. * AO3-6212 Use the right environment check. * AO3-6212 Indentation. * AO3-6212 - Add no-check-unique-key-change to default options.
- Loading branch information
1 parent
f34ff6c
commit 6504b0b
Showing
5 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Departure.configure do |config| | ||
# Disable departure by default. To use pt-online-schema-change for a | ||
# migration, call | ||
# uses_departure! if Rails.env.staging? || Rails.env.production? | ||
# in the migration file. | ||
config.enabled_by_default = false | ||
|
||
# Set the arguments based on the config file: | ||
config.global_percona_args = ArchiveConfig.PERCONA_ARGS.squish | ||
end |
14 changes: 14 additions & 0 deletions
14
db/migrate/20230610162442_add_indices_to_tag_set_associations.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
class AddIndicesToTagSetAssociations < ActiveRecord::Migration[6.1] | ||
uses_departure! if Rails.env.staging? || Rails.env.production? | ||
|
||
def change | ||
change_table :tag_set_associations do |t| | ||
t.index :tag_id | ||
t.index :parent_tag_id | ||
|
||
t.index [:owned_tag_set_id, :parent_tag_id, :tag_id], | ||
name: :index_tag_set_associations_on_tag_set_and_parent_and_tag, | ||
unique: true | ||
end | ||
end | ||
end |