2017-12-11 11:34:51 -05:00
|
|
|
# rubocop:disable Migration/RemoveColumn
|
2017-04-05 18:53:57 -04:00
|
|
|
# rubocop:disable RemoveIndex
|
2018-11-13 02:27:31 -05:00
|
|
|
class RemoveOldProjectIdColumns < ActiveRecord::Migration[4.2]
|
2017-03-17 19:06:11 -04:00
|
|
|
include Gitlab::Database::MigrationHelpers
|
|
|
|
disable_ddl_transaction!
|
|
|
|
|
|
|
|
DOWNTIME = true
|
|
|
|
DOWNTIME_REASON = 'Unused columns are being removed.'
|
|
|
|
|
|
|
|
def up
|
|
|
|
remove_index :ci_builds, :project_id if
|
|
|
|
index_exists?(:ci_builds, :project_id)
|
|
|
|
|
|
|
|
remove_column :ci_builds, :project_id
|
|
|
|
remove_column :ci_commits, :project_id
|
|
|
|
remove_column :ci_runner_projects, :project_id
|
|
|
|
remove_column :ci_triggers, :project_id
|
|
|
|
remove_column :ci_variables, :project_id
|
|
|
|
end
|
|
|
|
|
|
|
|
def down
|
|
|
|
add_column :ci_builds, :project_id, :integer
|
|
|
|
add_column :ci_commits, :project_id, :integer
|
|
|
|
add_column :ci_runner_projects, :project_id, :integer
|
|
|
|
add_column :ci_triggers, :project_id, :integer
|
|
|
|
add_column :ci_variables, :project_id, :integer
|
|
|
|
|
|
|
|
add_concurrent_index :ci_builds, :project_id
|
|
|
|
end
|
|
|
|
end
|