diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2017-05-12 16:27:30 +0200 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2017-05-12 16:27:30 +0200 |
commit | 3fc20c01170ebb6648ff9dbe76b0d52d0c13d68d (patch) | |
tree | cf035dc7da9239d4c9e66b33dfd9fad723e1a402 /spec | |
parent | 99f36c2ca69de17235eeab53f510753b6c1ae7c4 (diff) | |
download | gitlab-ce-3fc20c01170ebb6648ff9dbe76b0d52d0c13d68d.tar.gz |
Fix adding defaults for concurrent column renamesrename-column-concurrently-defaults
By adding the default value _after_ adding the column we avoid updating
all rows in a table, saving a lot of time and unnecessary work in the
process.
Diffstat (limited to 'spec')
-rw-r--r-- | spec/lib/gitlab/database/migration_helpers_spec.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/spec/lib/gitlab/database/migration_helpers_spec.rb b/spec/lib/gitlab/database/migration_helpers_spec.rb index 737fac14f92..d6535f97665 100644 --- a/spec/lib/gitlab/database/migration_helpers_spec.rb +++ b/spec/lib/gitlab/database/migration_helpers_spec.rb @@ -382,11 +382,13 @@ describe Gitlab::Database::MigrationHelpers, lib: true do expect(model).to receive(:add_column). with(:users, :new, :integer, limit: old_column.limit, - default: old_column.default, null: old_column.null, precision: old_column.precision, scale: old_column.scale) + expect(model).to receive(:change_column_default). + with(:users, :new, old_column.default) + expect(model).to receive(:update_column_in_batches) expect(model).to receive(:copy_indexes).with(:users, :old, :new) @@ -406,11 +408,13 @@ describe Gitlab::Database::MigrationHelpers, lib: true do expect(model).to receive(:add_column). with(:users, :new, :integer, limit: old_column.limit, - default: old_column.default, null: old_column.null, precision: old_column.precision, scale: old_column.scale) + expect(model).to receive(:change_column_default). + with(:users, :new, old_column.default) + expect(model).to receive(:update_column_in_batches) expect(model).to receive(:copy_indexes).with(:users, :old, :new) |