BigW Consortium Gitlab

Commit af8cc2e0 by Lin Jen-Shin

Use `remove_foreign_key :timelogs, name: '...'`

parent f67d8eb1
......@@ -49,15 +49,8 @@ class AddForeignKeysToTimelogs < ActiveRecord::Migration
Timelog.where('issue_id IS NOT NULL').update_all("trackable_id = issue_id, trackable_type = 'Issue'")
Timelog.where('merge_request_id IS NOT NULL').update_all("trackable_id = merge_request_id, trackable_type = 'MergeRequest'")
constraint =
if Gitlab::Database.postgresql?
'CONSTRAINT'
else
'FOREIGN KEY'
end
execute "ALTER TABLE timelogs DROP #{constraint} fk_timelogs_issues_issue_id"
execute "ALTER TABLE timelogs DROP #{constraint} fk_timelogs_merge_requests_merge_request_id"
remove_foreign_key :timelogs, name: 'fk_timelogs_issues_issue_id'
remove_foreign_key :timelogs, name: 'fk_timelogs_merge_requests_merge_request_id'
remove_columns :timelogs, :issue_id, :merge_request_id
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment