Commit fefa5515 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Remove trasnaction when update_column_in_batches is used

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent a51ca2a4
......@@ -19,14 +19,12 @@ class ConvertApplicationSettingsRepositorySizeLimitToBytes < ActiveRecord::Migra
sql_expression = Arel::Nodes::SqlLiteral.new(bigint_string)
connection.transaction do
update_column_in_batches(:application_settings, :repository_size_limit, sql_expression) do |t, query|
query.where(t[:repository_size_limit_mb].not_eq(nil))
end
remove_column :application_settings, :repository_size_limit_mb
end
end
def down
connection.transaction do
......@@ -36,12 +34,10 @@ class ConvertApplicationSettingsRepositorySizeLimitToBytes < ActiveRecord::Migra
sql_expression = Arel::Nodes::SqlLiteral.new('repository_size_limit_bytes / 1024 / 1024')
connection.transaction do
update_column_in_batches(:application_settings, :repository_size_limit, sql_expression) do |t, query|
query.where(t[:repository_size_limit_bytes].not_eq(nil))
end
remove_column :application_settings, :repository_size_limit_bytes
end
end
end
......@@ -19,14 +19,12 @@ class ConvertProjectsRepositorySizeLimitToBytes < ActiveRecord::Migration
sql_expression = Arel::Nodes::SqlLiteral.new(bigint_string)
connection.transaction do
update_column_in_batches(:projects, :repository_size_limit, sql_expression) do |t, query|
query.where(t[:repository_size_limit_mb].not_eq(nil))
end
remove_column :projects, :repository_size_limit_mb
end
end
def down
connection.transaction do
......@@ -36,12 +34,10 @@ class ConvertProjectsRepositorySizeLimitToBytes < ActiveRecord::Migration
sql_expression = Arel::Nodes::SqlLiteral.new('repository_size_limit_bytes / 1024 / 1024')
connection.transaction do
update_column_in_batches(:projects, :repository_size_limit, sql_expression) do |t, query|
query.where(t[:repository_size_limit_bytes].not_eq(nil))
end
remove_column :projects, :repository_size_limit_bytes
end
end
end
......@@ -19,14 +19,12 @@ class ConvertNamespacesRepositorySizeLimitToBytes < ActiveRecord::Migration
sql_expression = Arel::Nodes::SqlLiteral.new(bigint_string)
connection.transaction do
update_column_in_batches(:namespaces, :repository_size_limit, sql_expression) do |t, query|
query.where(t[:repository_size_limit_mb].not_eq(nil))
end
remove_column :namespaces, :repository_size_limit_mb
end
end
def down
connection.transaction do
......@@ -36,12 +34,10 @@ class ConvertNamespacesRepositorySizeLimitToBytes < ActiveRecord::Migration
sql_expression = Arel::Nodes::SqlLiteral.new('repository_size_limit_bytes / 1024 / 1024')
connection.transaction do
update_column_in_batches(:namespaces, :repository_size_limit, sql_expression) do |t, query|
query.where(t[:repository_size_limit_bytes].not_eq(nil))
end
remove_column :namespaces, :repository_size_limit_bytes
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment