diff options
author | Kamil TrzciĆski <ayufan@ayufan.eu> | 2017-03-18 02:06:11 +0300 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2017-03-18 02:06:11 +0300 |
commit | 12dd5ac22110bc3327297232d96f2afebaefc5eb (patch) | |
tree | c1ec703f9c7072df5097ba70c3e4e7c132a44a83 /db/migrate/20170222143500_remove_old_project_id_columns.rb | |
parent | 94246c7aa01bd825953e6676f79aa9db51209822 (diff) |
All CI offline migrations
Diffstat (limited to 'db/migrate/20170222143500_remove_old_project_id_columns.rb')
-rw-r--r-- | db/migrate/20170222143500_remove_old_project_id_columns.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/db/migrate/20170222143500_remove_old_project_id_columns.rb b/db/migrate/20170222143500_remove_old_project_id_columns.rb new file mode 100644 index 00000000000..eac93e8e407 --- /dev/null +++ b/db/migrate/20170222143500_remove_old_project_id_columns.rb @@ -0,0 +1,28 @@ +class RemoveOldProjectIdColumns < ActiveRecord::Migration + 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 |