summaryrefslogtreecommitdiff
path: root/db/post_migrate
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-06-06 14:10:50 +0200
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-06-06 14:10:50 +0200
commit8e071f28097b2c55b9e8d1b3a7ced4cdd04ef44d (patch)
treedea02b489c41af11a444717a416af79b83a8a77d /db/post_migrate
parentcc1e2a2bef324fe5869393e04be2feed22576667 (diff)
downloadgitlab-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.rb4
-rw-r--r--db/post_migrate/20170526190708_create_foreign_keys_for_pipeline_stages.rb35
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