summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2019-05-17 13:05:31 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2019-05-17 13:05:31 +0300
commit5786de36afb012aa689ee850023dcc98ab4823e1 (patch)
tree3ee1d7b6b5da28dcfae393bad3cc7a3827728bd7 /db
parentf2cb5220112f1f7fe4c29c4b07998f77a67291a2 (diff)
downloadgitlab-ce-5786de36afb012aa689ee850023dcc98ab4823e1.tar.gz
Add extra checks for ci_id migration
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'db')
-rw-r--r--db/post_migrate/20190424134256_drop_projects_ci_id.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/db/post_migrate/20190424134256_drop_projects_ci_id.rb b/db/post_migrate/20190424134256_drop_projects_ci_id.rb
index 79fa9704f1f..44e8f316393 100644
--- a/db/post_migrate/20190424134256_drop_projects_ci_id.rb
+++ b/db/post_migrate/20190424134256_drop_projects_ci_id.rb
@@ -22,7 +22,12 @@ class DropProjectsCiId < ActiveRecord::Migration[5.1]
end
def down
- add_column :projects, :ci_id, :integer
- add_concurrent_index :projects, :ci_id
+ unless column_exists?(:projects, :ci_id)
+ add_column :projects, :ci_id, :integer
+ end
+
+ unless index_exists?(:projects, :ci_id)
+ add_concurrent_index :projects, :ci_id
+ end
end
end