diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-06-21 10:32:45 +0200 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-06-21 13:18:38 +0200 |
commit | 6b9608e13e20fe579b861b911880603a372f2f27 (patch) | |
tree | b78f460139e23a43c41e91a443eb70b6834704da /db/post_migrate | |
parent | 4b0b2f1525be5feac0ae0953eb573ff24cc7b9c5 (diff) | |
download | gitlab-ce-6b9608e13e20fe579b861b911880603a372f2f27.tar.gz |
Fix build stages reference migration
Diffstat (limited to 'db/post_migrate')
3 files changed, 38 insertions, 0 deletions
diff --git a/db/post_migrate/20170526185901_remove_stage_id_index_from_builds.rb b/db/post_migrate/20170526185901_remove_stage_id_index_from_builds.rb new file mode 100644 index 00000000000..a2c0b0c651b --- /dev/null +++ b/db/post_migrate/20170526185901_remove_stage_id_index_from_builds.rb @@ -0,0 +1,17 @@ +class RemoveStageIdIndexFromBuilds < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + if index_exists?(:ci_builds, :stage_id) + remove_concurrent_index(:ci_builds, :stage_id) + end + end + + def down + # noop + end +end diff --git a/db/post_migrate/20170526185921_migrate_build_stage_reference.rb b/db/post_migrate/20170526185921_migrate_build_stage_reference.rb index 797e106cae4..d2e7fc207f0 100644 --- a/db/post_migrate/20170526185921_migrate_build_stage_reference.rb +++ b/db/post_migrate/20170526185921_migrate_build_stage_reference.rb @@ -3,6 +3,8 @@ class MigrateBuildStageReference < ActiveRecord::Migration DOWNTIME = false + disable_ddl_transaction! + def up disable_statement_timeout diff --git a/db/post_migrate/20170621102400_add_stage_id_index_to_builds.rb b/db/post_migrate/20170621102400_add_stage_id_index_to_builds.rb new file mode 100644 index 00000000000..acbe16812d2 --- /dev/null +++ b/db/post_migrate/20170621102400_add_stage_id_index_to_builds.rb @@ -0,0 +1,19 @@ +class AddStageIdIndexToBuilds < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + unless index_exists?(:ci_builds, :stage_id) + add_concurrent_index(:ci_builds, :stage_id) + end + end + + def down + if index_exists?(:ci_builds, :stage_id) + remove_concurrent_index(:ci_builds, :stage_id) + end + end +end |