diff options
Diffstat (limited to 'db/post_migrate')
3 files changed, 44 insertions, 0 deletions
diff --git a/db/post_migrate/20171121160421_remove_merge_request_diff_st_commits_and_st_diffs.rb b/db/post_migrate/20171121160421_remove_merge_request_diff_st_commits_and_st_diffs.rb new file mode 100644 index 00000000000..3a7b2a7fac0 --- /dev/null +++ b/db/post_migrate/20171121160421_remove_merge_request_diff_st_commits_and_st_diffs.rb @@ -0,0 +1,10 @@ +class RemoveMergeRequestDiffStCommitsAndStDiffs < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def change + remove_column :merge_request_diffs, :st_commits, :text + remove_column :merge_request_diffs, :st_diffs, :text + end +end diff --git a/db/post_migrate/20171124095655_add_index_on_merge_request_diffs_merge_request_id_and_id.rb b/db/post_migrate/20171124095655_add_index_on_merge_request_diffs_merge_request_id_and_id.rb new file mode 100644 index 00000000000..698df712c11 --- /dev/null +++ b/db/post_migrate/20171124095655_add_index_on_merge_request_diffs_merge_request_id_and_id.rb @@ -0,0 +1,17 @@ +class AddIndexOnMergeRequestDiffsMergeRequestIdAndId < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_concurrent_index(:merge_request_diffs, [:merge_request_id, :id]) + end + + def down + if index_exists?(:merge_request_diffs, [:merge_request_id, :id]) + remove_concurrent_index(:merge_request_diffs, [:merge_request_id, :id]) + end + end +end diff --git a/db/post_migrate/20171124100152_remove_index_on_merge_request_diffs_merge_request_diff_id.rb b/db/post_migrate/20171124100152_remove_index_on_merge_request_diffs_merge_request_diff_id.rb new file mode 100644 index 00000000000..038e4807000 --- /dev/null +++ b/db/post_migrate/20171124100152_remove_index_on_merge_request_diffs_merge_request_diff_id.rb @@ -0,0 +1,17 @@ +class RemoveIndexOnMergeRequestDiffsMergeRequestDiffId < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + if index_exists?(:merge_request_diffs, :merge_request_id) + remove_concurrent_index(:merge_request_diffs, :merge_request_id) + end + end + + def down + add_concurrent_index(:merge_request_diffs, :merge_request_id) + end +end |