debian-mirror-gitlab/db/migrate/20170222143500_remove_old_project_id_columns.rb

31 lines
944 B
Ruby
Raw Normal View History

2018-03-17 18:26:18 +05:30
# rubocop:disable Migration/RemoveColumn
2017-08-17 22:00:37 +05:30
# rubocop:disable RemoveIndex
2018-12-23 12:14:25 +05:30
class RemoveOldProjectIdColumns < ActiveRecord::Migration[4.2]
2017-08-17 22:00:37 +05:30
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