summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/gitlab/database/migration_helpers.rb13
-rw-r--r--spec/lib/gitlab/database/migration_helpers_spec.rb16
2 files changed, 6 insertions, 23 deletions
diff --git a/lib/gitlab/database/migration_helpers.rb b/lib/gitlab/database/migration_helpers.rb
index 73d2bc2a66c..e76c9abbe04 100644
--- a/lib/gitlab/database/migration_helpers.rb
+++ b/lib/gitlab/database/migration_helpers.rb
@@ -278,8 +278,6 @@ module Gitlab
raise 'rename_column_concurrently can not be run inside a transaction'
end
-<<<<<<< HEAD
-=======
old_col = column_for(table, old)
new_type = type || old_col.type
@@ -293,7 +291,6 @@ module Gitlab
# necessary since we copy over old values further down.
change_column_default(table, new, old_col.default) if old_col.default
->>>>>>> c53d06c4d8... Merge branch 'dm-rename-column-concurrently-with-null' into 'master'
trigger_name = rename_trigger_name(table, old, new)
quoted_table = quote_table_name(table)
quoted_old = quote_column_name(old)
@@ -307,16 +304,6 @@ module Gitlab
quoted_old, quoted_new)
end
- old_col = column_for(table, old)
- new_type = type || old_col.type
-
- add_column(table, new, new_type,
- limit: old_col.limit,
- default: old_col.default,
- null: old_col.null,
- precision: old_col.precision,
- scale: old_col.scale)
-
update_column_in_batches(table, new, Arel::Table.new(table)[old])
change_column_null(table, new, false) unless old_col.null
diff --git a/spec/lib/gitlab/database/migration_helpers_spec.rb b/spec/lib/gitlab/database/migration_helpers_spec.rb
index 942635d3dae..dfa3ae9142e 100644
--- a/spec/lib/gitlab/database/migration_helpers_spec.rb
+++ b/spec/lib/gitlab/database/migration_helpers_spec.rb
@@ -382,14 +382,12 @@ describe Gitlab::Database::MigrationHelpers, lib: true do
expect(model).to receive(:add_column).
with(:users, :new, :integer,
limit: old_column.limit,
-<<<<<<< HEAD
- default: old_column.default,
- null: old_column.null,
-=======
->>>>>>> c53d06c4d8... Merge branch 'dm-rename-column-concurrently-with-null' into 'master'
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(:change_column_null).with(:users, :new, false)
@@ -411,14 +409,12 @@ describe Gitlab::Database::MigrationHelpers, lib: true do
expect(model).to receive(:add_column).
with(:users, :new, :integer,
limit: old_column.limit,
-<<<<<<< HEAD
- default: old_column.default,
- null: old_column.null,
-=======
->>>>>>> c53d06c4d8... Merge branch 'dm-rename-column-concurrently-with-null' into 'master'
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(:change_column_null).with(:users, :new, false)