summaryrefslogtreecommitdiff
path: root/db/post_migrate
diff options
context:
space:
mode:
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