diff options
author | Andreas Brandl <abrandl@gitlab.com> | 2018-05-15 23:20:45 +0300 |
---|---|---|
committer | Andreas Brandl <abrandl@gitlab.com> | 2018-05-21 18:56:57 +0300 |
commit | 82576518226843bcc104739eb01975036ce8a60f (patch) | |
tree | 6a3087169d48034eb6fb770e16cd8216ec4c2606 /lib/tasks | |
parent | a0c79f9d7025872fc2aa91805058739b26093989 (diff) |
Migration to add/drop primary key constraints for composite keys.
Closes #43706.
Diffstat (limited to 'lib/tasks')
-rw-r--r-- | lib/tasks/migrate/composite_primary_keys.rake | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/tasks/migrate/composite_primary_keys.rake b/lib/tasks/migrate/composite_primary_keys.rake new file mode 100644 index 00000000000..eb112434dd9 --- /dev/null +++ b/lib/tasks/migrate/composite_primary_keys.rake @@ -0,0 +1,15 @@ +namespace :gitlab do + namespace :db do + desc 'GitLab | Adds primary keys to tables that only have composite unique keys' + task composite_primary_keys_add: :environment do + require Rails.root.join('db/optional_migrations/composite_primary_keys') + CompositePrimaryKeysMigration.new.up + end + + desc 'GitLab | Removes previously added composite primary keys' + task composite_primary_keys_drop: :environment do + require Rails.root.join('db/optional_migrations/composite_primary_keys') + CompositePrimaryKeysMigration.new.down + end + end +end |