Disable transactions in migrations that should not use it
This commit is contained in:
parent
e4d42a62d9
commit
3fd4a37d58
10 changed files with 21 additions and 0 deletions
|
@ -2,6 +2,8 @@
|
||||||
class SetMissingStageOnCiBuilds < ActiveRecord::Migration
|
class SetMissingStageOnCiBuilds < ActiveRecord::Migration
|
||||||
include Gitlab::Database::MigrationHelpers
|
include Gitlab::Database::MigrationHelpers
|
||||||
|
|
||||||
|
disable_ddl_transaction!
|
||||||
|
|
||||||
def up
|
def up
|
||||||
update_column_in_batches(:ci_builds, :stage, :test) do |table, query|
|
update_column_in_batches(:ci_builds, :stage, :test) do |table, query|
|
||||||
query.where(table[:stage].eq(nil))
|
query.where(table[:stage].eq(nil))
|
||||||
|
|
|
@ -5,6 +5,8 @@ class DropAndReaddHasExternalWikiInProjects < ActiveRecord::Migration
|
||||||
# Set this constant to true if this migration requires downtime.
|
# Set this constant to true if this migration requires downtime.
|
||||||
DOWNTIME = false
|
DOWNTIME = false
|
||||||
|
|
||||||
|
disable_ddl_transaction!
|
||||||
|
|
||||||
def up
|
def up
|
||||||
update_column_in_batches(:projects, :has_external_wiki, nil) do |table, query|
|
update_column_in_batches(:projects, :has_external_wiki, nil) do |table, query|
|
||||||
query.where(table[:has_external_wiki].not_eq(nil))
|
query.where(table[:has_external_wiki].not_eq(nil))
|
||||||
|
|
|
@ -4,6 +4,8 @@ class SetConfidentialIssuesEventsOnWebhooks < ActiveRecord::Migration
|
||||||
|
|
||||||
DOWNTIME = false
|
DOWNTIME = false
|
||||||
|
|
||||||
|
disable_ddl_transaction!
|
||||||
|
|
||||||
def up
|
def up
|
||||||
update_column_in_batches(:web_hooks, :confidential_issues_events, true) do |table, query|
|
update_column_in_batches(:web_hooks, :confidential_issues_events, true) do |table, query|
|
||||||
query.where(table[:issues_events].eq(true))
|
query.where(table[:issues_events].eq(true))
|
||||||
|
|
|
@ -5,6 +5,8 @@ class AddTypeToLabels < ActiveRecord::Migration
|
||||||
DOWNTIME = true
|
DOWNTIME = true
|
||||||
DOWNTIME_REASON = 'Labels will not work as expected until this migration is complete.'
|
DOWNTIME_REASON = 'Labels will not work as expected until this migration is complete.'
|
||||||
|
|
||||||
|
disable_ddl_transaction!
|
||||||
|
|
||||||
def change
|
def change
|
||||||
add_column :labels, :type, :string
|
add_column :labels, :type, :string
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,8 @@ class MakeProjectOwnersMasters < ActiveRecord::Migration
|
||||||
|
|
||||||
DOWNTIME = false
|
DOWNTIME = false
|
||||||
|
|
||||||
|
disable_ddl_transaction!
|
||||||
|
|
||||||
def up
|
def up
|
||||||
update_column_in_batches(:members, :access_level, 40) do |table, query|
|
update_column_in_batches(:members, :access_level, 40) do |table, query|
|
||||||
query.where(table[:access_level].eq(50).and(table[:source_type].eq('Project')))
|
query.where(table[:access_level].eq(50).and(table[:source_type].eq('Project')))
|
||||||
|
|
|
@ -4,6 +4,8 @@ class RenameSlackAndMattermostNotificationServices < ActiveRecord::Migration
|
||||||
|
|
||||||
DOWNTIME = false
|
DOWNTIME = false
|
||||||
|
|
||||||
|
disable_ddl_transaction!
|
||||||
|
|
||||||
def up
|
def up
|
||||||
update_column_in_batches(:services, :type, 'SlackService') do |table, query|
|
update_column_in_batches(:services, :type, 'SlackService') do |table, query|
|
||||||
query.where(table[:type].eq('SlackNotificationService'))
|
query.where(table[:type].eq('SlackNotificationService'))
|
||||||
|
|
|
@ -4,6 +4,8 @@ class ResetRelativePositionForIssue < ActiveRecord::Migration
|
||||||
|
|
||||||
DOWNTIME = false
|
DOWNTIME = false
|
||||||
|
|
||||||
|
disable_ddl_transaction!
|
||||||
|
|
||||||
def up
|
def up
|
||||||
update_column_in_batches(:issues, :relative_position, nil) do |table, query|
|
update_column_in_batches(:issues, :relative_position, nil) do |table, query|
|
||||||
query.where(table[:relative_position].not_eq(nil))
|
query.where(table[:relative_position].not_eq(nil))
|
||||||
|
@ -11,5 +13,6 @@ class ResetRelativePositionForIssue < ActiveRecord::Migration
|
||||||
end
|
end
|
||||||
|
|
||||||
def down
|
def down
|
||||||
|
# noop
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,6 +7,8 @@ class UpdateUploadPathsToSystem < ActiveRecord::Migration
|
||||||
DOWNTIME = false
|
DOWNTIME = false
|
||||||
AFFECTED_MODELS = %w(User Project Note Namespace Appearance)
|
AFFECTED_MODELS = %w(User Project Note Namespace Appearance)
|
||||||
|
|
||||||
|
disable_ddl_transaction!
|
||||||
|
|
||||||
def up
|
def up
|
||||||
update_column_in_batches(:uploads, :path, replace_sql(arel_table[:path], base_directory, new_upload_dir)) do |_table, query|
|
update_column_in_batches(:uploads, :path, replace_sql(arel_table[:path], base_directory, new_upload_dir)) do |_table, query|
|
||||||
query.where(uploads_to_switch_to_new_path)
|
query.where(uploads_to_switch_to_new_path)
|
||||||
|
|
|
@ -7,6 +7,8 @@ class MigrateUserProjectView < ActiveRecord::Migration
|
||||||
# Set this constant to true if this migration requires downtime.
|
# Set this constant to true if this migration requires downtime.
|
||||||
DOWNTIME = false
|
DOWNTIME = false
|
||||||
|
|
||||||
|
disable_ddl_transaction!
|
||||||
|
|
||||||
def up
|
def up
|
||||||
update_column_in_batches(:users, :project_view, 2) do |table, query|
|
update_column_in_batches(:users, :project_view, 2) do |table, query|
|
||||||
query.where(table[:project_view].eq(0))
|
query.where(table[:project_view].eq(0))
|
||||||
|
|
|
@ -3,6 +3,8 @@ class AddHeadPipelineForEachMergeRequest < ActiveRecord::Migration
|
||||||
|
|
||||||
DOWNTIME = false
|
DOWNTIME = false
|
||||||
|
|
||||||
|
disable_ddl_transaction!
|
||||||
|
|
||||||
def up
|
def up
|
||||||
disable_statement_timeout
|
disable_statement_timeout
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue