diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-06-06 14:10:50 +0200 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-06-06 14:10:50 +0200 |
commit | 8e071f28097b2c55b9e8d1b3a7ced4cdd04ef44d (patch) | |
tree | dea02b489c41af11a444717a416af79b83a8a77d /db/post_migrate | |
parent | cc1e2a2bef324fe5869393e04be2feed22576667 (diff) | |
download | gitlab-ce-8e071f28097b2c55b9e8d1b3a7ced4cdd04ef44d.tar.gz |
Improve indexes and refs in pipeline stages migrations
Diffstat (limited to 'db/post_migrate')
-rw-r--r-- | db/post_migrate/20170526185842_migrate_pipeline_stages.rb | 4 | ||||
-rw-r--r-- | db/post_migrate/20170526190708_create_foreign_keys_for_pipeline_stages.rb | 35 |
2 files changed, 0 insertions, 39 deletions
diff --git a/db/post_migrate/20170526185842_migrate_pipeline_stages.rb b/db/post_migrate/20170526185842_migrate_pipeline_stages.rb index 382791c4664..37ccf9fc105 100644 --- a/db/post_migrate/20170526185842_migrate_pipeline_stages.rb +++ b/db/post_migrate/20170526185842_migrate_pipeline_stages.rb @@ -16,8 +16,4 @@ class MigratePipelineStages < ActiveRecord::Migration ORDER BY MAX(stage_idx) SQL end - - def down - execute('TRUNCATE TABLE ci_stages') - end end diff --git a/db/post_migrate/20170526190708_create_foreign_keys_for_pipeline_stages.rb b/db/post_migrate/20170526190708_create_foreign_keys_for_pipeline_stages.rb deleted file mode 100644 index 5ae3c1ae098..00000000000 --- a/db/post_migrate/20170526190708_create_foreign_keys_for_pipeline_stages.rb +++ /dev/null @@ -1,35 +0,0 @@ -class CreateForeignKeysForPipelineStages < ActiveRecord::Migration - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - disable_statement_timeout - - execute <<~SQL - DELETE FROM ci_stages - WHERE NOT EXISTS ( - SELECT true FROM projects - WHERE projects.id = ci_stages.project_id - ) - SQL - - execute <<~SQL - DELETE FROM ci_builds - WHERE NOT EXISTS ( - SELECT true FROM ci_stages - WHERE ci_stages.id = ci_builds.stage_id - ) - SQL - - add_concurrent_foreign_key :ci_stages, :projects, column: :project_id, on_delete: :cascade - add_concurrent_foreign_key :ci_builds, :ci_stages, column: :stage_id, on_delete: :cascade - end - - def down - remove_foreign_key :ci_stages, column: :project_id - remove_foreign_key :ci_builds, column: :stage_id - end -end |