Commit 0a5b670a authored by Douwe Maan's avatar Douwe Maan

Exclude migrations from Style/MutableConstant

parent 32a70410
...@@ -354,6 +354,9 @@ Style/MultilineTernaryOperator: ...@@ -354,6 +354,9 @@ Style/MultilineTernaryOperator:
# mutable literal (e.g. array or hash). # mutable literal (e.g. array or hash).
Style/MutableConstant: Style/MutableConstant:
Enabled: true Enabled: true
Exclude:
- 'db/migrate/**/*'
- 'db/post_migrate/**/*'
# Favor unless over if for negative conditions (or control flow or). # Favor unless over if for negative conditions (or control flow or).
Style/NegatedIf: Style/NegatedIf:
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
class MoveFromDevelopersCanMergeToProtectedBranchesMergeAccess < ActiveRecord::Migration class MoveFromDevelopersCanMergeToProtectedBranchesMergeAccess < ActiveRecord::Migration
DOWNTIME = true DOWNTIME = true
DOWNTIME_REASON = <<-HEREDOC.freeze DOWNTIME_REASON = <<-HEREDOC
We're creating a `merge_access_level` for each `protected_branch`. If a user creates a `protected_branch` while this We're creating a `merge_access_level` for each `protected_branch`. If a user creates a `protected_branch` while this
is running, we might be left with a `protected_branch` _without_ an associated `merge_access_level`. The `protected_branches` is running, we might be left with a `protected_branch` _without_ an associated `merge_access_level`. The `protected_branches`
table must not change while this is running, so downtime is required. table must not change while this is running, so downtime is required.
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
class MoveFromDevelopersCanPushToProtectedBranchesPushAccess < ActiveRecord::Migration class MoveFromDevelopersCanPushToProtectedBranchesPushAccess < ActiveRecord::Migration
DOWNTIME = true DOWNTIME = true
DOWNTIME_REASON = <<-HEREDOC.freeze DOWNTIME_REASON = <<-HEREDOC
We're creating a `push_access_level` for each `protected_branch`. If a user creates a `protected_branch` while this We're creating a `push_access_level` for each `protected_branch`. If a user creates a `protected_branch` while this
is running, we might be left with a `protected_branch` _without_ an associated `push_access_level`. The `protected_branches` is running, we might be left with a `protected_branch` _without_ an associated `push_access_level`. The `protected_branches`
table must not change while this is running, so downtime is required. table must not change while this is running, so downtime is required.
......
...@@ -10,7 +10,7 @@ class RemoveProjectIdFromSpamLogs < ActiveRecord::Migration ...@@ -10,7 +10,7 @@ class RemoveProjectIdFromSpamLogs < ActiveRecord::Migration
# When a migration requires downtime you **must** uncomment the following # When a migration requires downtime you **must** uncomment the following
# constant and define a short and easy to understand explanation as to why the # constant and define a short and easy to understand explanation as to why the
# migration requires downtime. # migration requires downtime.
DOWNTIME_REASON = 'Removing a column that contains data that is not used anywhere.'.freeze DOWNTIME_REASON = 'Removing a column that contains data that is not used anywhere.'
# When using the methods "add_concurrent_index" or "add_column_with_default" # When using the methods "add_concurrent_index" or "add_column_with_default"
# you must disable the use of transactions as these methods can not run in an # you must disable the use of transactions as these methods can not run in an
......
...@@ -2,7 +2,7 @@ class ChangeMergeErrorToText < ActiveRecord::Migration ...@@ -2,7 +2,7 @@ class ChangeMergeErrorToText < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers include Gitlab::Database::MigrationHelpers
DOWNTIME = true DOWNTIME = true
DOWNTIME_REASON = 'This migration requires downtime because it alters a column from varchar(255) to text.'.freeze DOWNTIME_REASON = 'This migration requires downtime because it alters a column from varchar(255) to text.'
def change def change
change_column :merge_requests, :merge_error, :text, limit: 65535 change_column :merge_requests, :merge_error, :text, limit: 65535
......
...@@ -10,7 +10,7 @@ class AddTableIssueMetrics < ActiveRecord::Migration ...@@ -10,7 +10,7 @@ class AddTableIssueMetrics < ActiveRecord::Migration
# When a migration requires downtime you **must** uncomment the following # When a migration requires downtime you **must** uncomment the following
# constant and define a short and easy to understand explanation as to why the # constant and define a short and easy to understand explanation as to why the
# migration requires downtime. # migration requires downtime.
DOWNTIME_REASON = 'Adding foreign key'.freeze DOWNTIME_REASON = 'Adding foreign key'
# When using the methods "add_concurrent_index" or "add_column_with_default" # When using the methods "add_concurrent_index" or "add_column_with_default"
# you must disable the use of transactions as these methods can not run in an # you must disable the use of transactions as these methods can not run in an
......
...@@ -10,7 +10,7 @@ class AddTableMergeRequestMetrics < ActiveRecord::Migration ...@@ -10,7 +10,7 @@ class AddTableMergeRequestMetrics < ActiveRecord::Migration
# When a migration requires downtime you **must** uncomment the following # When a migration requires downtime you **must** uncomment the following
# constant and define a short and easy to understand explanation as to why the # constant and define a short and easy to understand explanation as to why the
# migration requires downtime. # migration requires downtime.
DOWNTIME_REASON = 'Adding foreign key'.freeze DOWNTIME_REASON = 'Adding foreign key'
# When using the methods "add_concurrent_index" or "add_column_with_default" # When using the methods "add_concurrent_index" or "add_column_with_default"
# you must disable the use of transactions as these methods can not run in an # you must disable the use of transactions as these methods can not run in an
......
...@@ -7,7 +7,7 @@ class RemoveFeaturesEnabledFromProjects < ActiveRecord::Migration ...@@ -7,7 +7,7 @@ class RemoveFeaturesEnabledFromProjects < ActiveRecord::Migration
# Set this constant to true if this migration requires downtime. # Set this constant to true if this migration requires downtime.
DOWNTIME = true DOWNTIME = true
DOWNTIME_REASON = "Removing fields from database requires downtine.".freeze DOWNTIME_REASON = "Removing fields from database requires downtine."
def up def up
remove_column :projects, :issues_enabled remove_column :projects, :issues_enabled
......
...@@ -5,7 +5,7 @@ class RemoveProjectsPushesSinceGc < ActiveRecord::Migration ...@@ -5,7 +5,7 @@ class RemoveProjectsPushesSinceGc < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers include Gitlab::Database::MigrationHelpers
DOWNTIME = true DOWNTIME = true
DOWNTIME_REASON = 'This migration removes an existing column'.freeze DOWNTIME_REASON = 'This migration removes an existing column'
disable_ddl_transaction! disable_ddl_transaction!
......
...@@ -3,7 +3,7 @@ class ChangeArtifactsSizeColumn < ActiveRecord::Migration ...@@ -3,7 +3,7 @@ class ChangeArtifactsSizeColumn < ActiveRecord::Migration
DOWNTIME = true DOWNTIME = true
DOWNTIME_REASON = 'Changing an integer column size requires a full table rewrite.'.freeze DOWNTIME_REASON = 'Changing an integer column size requires a full table rewrite.'
def up def up
change_column :ci_builds, :artifacts_size, :integer, limit: 8 change_column :ci_builds, :artifacts_size, :integer, limit: 8
......
...@@ -10,7 +10,7 @@ class CreateMergeRequestsClosingIssues < ActiveRecord::Migration ...@@ -10,7 +10,7 @@ class CreateMergeRequestsClosingIssues < ActiveRecord::Migration
# When a migration requires downtime you **must** uncomment the following # When a migration requires downtime you **must** uncomment the following
# constant and define a short and easy to understand explanation as to why the # constant and define a short and easy to understand explanation as to why the
# migration requires downtime. # migration requires downtime.
DOWNTIME_REASON = 'Adding foreign keys'.freeze DOWNTIME_REASON = 'Adding foreign keys'
# When using the methods "add_concurrent_index" or "add_column_with_default" # When using the methods "add_concurrent_index" or "add_column_with_default"
# you must disable the use of transactions as these methods can not run in an # you must disable the use of transactions as these methods can not run in an
......
...@@ -2,7 +2,7 @@ class AddTypeToLabels < ActiveRecord::Migration ...@@ -2,7 +2,7 @@ class AddTypeToLabels < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers include Gitlab::Database::MigrationHelpers
DOWNTIME = true DOWNTIME = true
DOWNTIME_REASON = 'Labels will not work as expected until this migration is complete.'.freeze DOWNTIME_REASON = 'Labels will not work as expected until this migration is complete.'
def change def change
add_column :labels, :type, :string add_column :labels, :type, :string
......
...@@ -2,7 +2,7 @@ class CreateLabelPriorities < ActiveRecord::Migration ...@@ -2,7 +2,7 @@ class CreateLabelPriorities < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers include Gitlab::Database::MigrationHelpers
DOWNTIME = true DOWNTIME = true
DOWNTIME_REASON = 'This migration adds foreign keys'.freeze DOWNTIME_REASON = 'This migration adds foreign keys'
disable_ddl_transaction! disable_ddl_transaction!
......
...@@ -2,7 +2,7 @@ class AddUniqueIndexToLabels < ActiveRecord::Migration ...@@ -2,7 +2,7 @@ class AddUniqueIndexToLabels < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers include Gitlab::Database::MigrationHelpers
DOWNTIME = true DOWNTIME = true
DOWNTIME_REASON = 'This migration removes duplicated labels.'.freeze DOWNTIME_REASON = 'This migration removes duplicated labels.'
disable_ddl_transaction! disable_ddl_transaction!
......
...@@ -2,7 +2,7 @@ class MigrateLabelsPriority < ActiveRecord::Migration ...@@ -2,7 +2,7 @@ class MigrateLabelsPriority < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers include Gitlab::Database::MigrationHelpers
DOWNTIME = true DOWNTIME = true
DOWNTIME_REASON = 'Prioritized labels will not work as expected until this migration is complete.'.freeze DOWNTIME_REASON = 'Prioritized labels will not work as expected until this migration is complete.'
disable_ddl_transaction! disable_ddl_transaction!
......
...@@ -2,7 +2,7 @@ class RemovePriorityFromLabels < ActiveRecord::Migration ...@@ -2,7 +2,7 @@ class RemovePriorityFromLabels < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers include Gitlab::Database::MigrationHelpers
DOWNTIME = true DOWNTIME = true
DOWNTIME_REASON = 'This migration removes an existing column'.freeze DOWNTIME_REASON = 'This migration removes an existing column'
disable_ddl_transaction! disable_ddl_transaction!
......
...@@ -8,7 +8,7 @@ class MigrateSidekiqQueuesFromDefault < ActiveRecord::Migration ...@@ -8,7 +8,7 @@ class MigrateSidekiqQueuesFromDefault < ActiveRecord::Migration
DOWNTIME = true DOWNTIME = true
DOWNTIME_REASON = <<-EOF.freeze DOWNTIME_REASON = <<-EOF
Moving Sidekiq jobs from queues requires Sidekiq to be stopped. Not stopping Moving Sidekiq jobs from queues requires Sidekiq to be stopped. Not stopping
Sidekiq will result in the loss of jobs that are scheduled after this Sidekiq will result in the loss of jobs that are scheduled after this
migration completes. migration completes.
......
class GenerateProjectFeatureForProjects < ActiveRecord::Migration class GenerateProjectFeatureForProjects < ActiveRecord::Migration
DOWNTIME = true DOWNTIME = true
DOWNTIME_REASON = <<-HEREDOC.freeze DOWNTIME_REASON = <<-HEREDOC
Application was eager loading project_feature for all projects generating an extra query Application was eager loading project_feature for all projects generating an extra query
everytime a project was fetched. We removed that behavior to avoid the extra query, this migration everytime a project was fetched. We removed that behavior to avoid the extra query, this migration
makes sure all projects have a project_feature record associated. makes sure all projects have a project_feature record associated.
......
...@@ -12,7 +12,7 @@ class AddPipelineIdToMergeRequestMetrics < ActiveRecord::Migration ...@@ -12,7 +12,7 @@ class AddPipelineIdToMergeRequestMetrics < ActiveRecord::Migration
# When a migration requires downtime you **must** uncomment the following # When a migration requires downtime you **must** uncomment the following
# constant and define a short and easy to understand explanation as to why the # constant and define a short and easy to understand explanation as to why the
# migration requires downtime. # migration requires downtime.
DOWNTIME_REASON = 'Adding a foreign key'.freeze DOWNTIME_REASON = 'Adding a foreign key'
# When using the methods "add_concurrent_index" or "add_column_with_default" # When using the methods "add_concurrent_index" or "add_column_with_default"
# you must disable the use of transactions as these methods can not run in an # you must disable the use of transactions as these methods can not run in an
......
...@@ -8,7 +8,7 @@ class MigrateMailroomQueueFromDefault < ActiveRecord::Migration ...@@ -8,7 +8,7 @@ class MigrateMailroomQueueFromDefault < ActiveRecord::Migration
DOWNTIME = true DOWNTIME = true
DOWNTIME_REASON = <<-EOF.freeze DOWNTIME_REASON = <<-EOF
Moving Sidekiq jobs from queues requires Sidekiq to be stopped. Not stopping Moving Sidekiq jobs from queues requires Sidekiq to be stopped. Not stopping
Sidekiq will result in the loss of jobs that are scheduled after this Sidekiq will result in the loss of jobs that are scheduled after this
migration completes. migration completes.
......
class MigrateJiraToGem < ActiveRecord::Migration class MigrateJiraToGem < ActiveRecord::Migration
DOWNTIME = true DOWNTIME = true
DOWNTIME_REASON = <<-HEREDOC.freeze DOWNTIME_REASON = <<-HEREDOC
Refactor all Jira services properties(serialized field) to use new jira-ruby gem. Refactor all Jira services properties(serialized field) to use new jira-ruby gem.
There were properties on old Jira service that are not needed anymore after the There were properties on old Jira service that are not needed anymore after the
service refactoring: api_url, project_url, new_issue_url, issues_url. service refactoring: api_url, project_url, new_issue_url, issues_url.
......
...@@ -2,7 +2,7 @@ class MigrateSubscriptionsProjectId < ActiveRecord::Migration ...@@ -2,7 +2,7 @@ class MigrateSubscriptionsProjectId < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers include Gitlab::Database::MigrationHelpers
DOWNTIME = true DOWNTIME = true
DOWNTIME_REASON = 'Subscriptions will not work as expected until this migration is complete.'.freeze DOWNTIME_REASON = 'Subscriptions will not work as expected until this migration is complete.'
def up def up
execute <<-EOF.strip_heredoc execute <<-EOF.strip_heredoc
......
...@@ -2,7 +2,7 @@ class AddUniqueIndexToSubscriptions < ActiveRecord::Migration ...@@ -2,7 +2,7 @@ class AddUniqueIndexToSubscriptions < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers include Gitlab::Database::MigrationHelpers
DOWNTIME = true DOWNTIME = true
DOWNTIME_REASON = 'This migration requires downtime because it changes a column to not accept null values.'.freeze DOWNTIME_REASON = 'This migration requires downtime because it changes a column to not accept null values.'
disable_ddl_transaction! disable_ddl_transaction!
......
...@@ -10,7 +10,7 @@ class RenameRepositoryStorageColumn < ActiveRecord::Migration ...@@ -10,7 +10,7 @@ class RenameRepositoryStorageColumn < ActiveRecord::Migration
# When a migration requires downtime you **must** uncomment the following # When a migration requires downtime you **must** uncomment the following
# constant and define a short and easy to understand explanation as to why the # constant and define a short and easy to understand explanation as to why the
# migration requires downtime. # migration requires downtime.
DOWNTIME_REASON = 'Renaming the application_settings.repository_storage column'.freeze DOWNTIME_REASON = 'Renaming the application_settings.repository_storage column'
# When using the methods "add_concurrent_index" or "add_column_with_default" # When using the methods "add_concurrent_index" or "add_column_with_default"
# you must disable the use of transactions as these methods can not run in an # you must disable the use of transactions as these methods can not run in an
......
...@@ -25,7 +25,7 @@ class MigrateProcessCommitWorkerJobs < ActiveRecord::Migration ...@@ -25,7 +25,7 @@ class MigrateProcessCommitWorkerJobs < ActiveRecord::Migration
end end
DOWNTIME = true DOWNTIME = true
DOWNTIME_REASON = 'Existing workers will error until they are using a newer version of the code'.freeze DOWNTIME_REASON = 'Existing workers will error until they are using a newer version of the code'
disable_ddl_transaction! disable_ddl_transaction!
......
...@@ -5,7 +5,7 @@ class FillRoutesTable < ActiveRecord::Migration ...@@ -5,7 +5,7 @@ class FillRoutesTable < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers include Gitlab::Database::MigrationHelpers
DOWNTIME = true DOWNTIME = true
DOWNTIME_REASON = 'No new namespaces should be created during data copy'.freeze DOWNTIME_REASON = 'No new namespaces should be created during data copy'
def up def up
execute <<-EOF execute <<-EOF
......
...@@ -5,7 +5,7 @@ class FillProjectsRoutesTable < ActiveRecord::Migration ...@@ -5,7 +5,7 @@ class FillProjectsRoutesTable < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers include Gitlab::Database::MigrationHelpers
DOWNTIME = true DOWNTIME = true
DOWNTIME_REASON = 'No new projects should be created during data copy'.freeze DOWNTIME_REASON = 'No new projects should be created during data copy'
def up def up
if Gitlab::Database.postgresql? if Gitlab::Database.postgresql?
......
...@@ -2,7 +2,7 @@ class MigrateProjectStatistics < ActiveRecord::Migration ...@@ -2,7 +2,7 @@ class MigrateProjectStatistics < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers include Gitlab::Database::MigrationHelpers
DOWNTIME = true DOWNTIME = true
DOWNTIME_REASON = 'Removes two columns from the projects table'.freeze DOWNTIME_REASON = 'Removes two columns from the projects table'
def up def up
# convert repository_size in float (megabytes) to integer (bytes), # convert repository_size in float (megabytes) to integer (bytes),
......
...@@ -2,7 +2,7 @@ class FixupEnvironmentNameUniqueness < ActiveRecord::Migration ...@@ -2,7 +2,7 @@ class FixupEnvironmentNameUniqueness < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers include Gitlab::Database::MigrationHelpers
DOWNTIME = true DOWNTIME = true
DOWNTIME_REASON = 'Renaming non-unique environments'.freeze DOWNTIME_REASON = 'Renaming non-unique environments'
def up def up
environments = Arel::Table.new(:environments) environments = Arel::Table.new(:environments)
......
...@@ -4,7 +4,7 @@ class CreateEnvironmentNameUniqueIndex < ActiveRecord::Migration ...@@ -4,7 +4,7 @@ class CreateEnvironmentNameUniqueIndex < ActiveRecord::Migration
disable_ddl_transaction! disable_ddl_transaction!
DOWNTIME = true DOWNTIME = true
DOWNTIME_REASON = 'Making a non-unique index into a unique index'.freeze DOWNTIME_REASON = 'Making a non-unique index into a unique index'
def up def up
remove_index :environments, [:project_id, :name] remove_index :environments, [:project_id, :name]
......
...@@ -5,7 +5,7 @@ class AddEnvironmentSlug < ActiveRecord::Migration ...@@ -5,7 +5,7 @@ class AddEnvironmentSlug < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers include Gitlab::Database::MigrationHelpers
DOWNTIME = true DOWNTIME = true
DOWNTIME_REASON = 'Adding NOT NULL column environments.slug with dependent data'.freeze DOWNTIME_REASON = 'Adding NOT NULL column environments.slug with dependent data'
# Used to generate random suffixes for the slug # Used to generate random suffixes for the slug
LETTERS = 'a'..'z' LETTERS = 'a'..'z'
......
...@@ -5,7 +5,7 @@ class AddUniqueIndexForEnvironmentSlug < ActiveRecord::Migration ...@@ -5,7 +5,7 @@ class AddUniqueIndexForEnvironmentSlug < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers include Gitlab::Database::MigrationHelpers
DOWNTIME = true DOWNTIME = true
DOWNTIME_REASON = 'Adding a *unique* index to environments.slug'.freeze DOWNTIME_REASON = 'Adding a *unique* index to environments.slug'
disable_ddl_transaction! disable_ddl_transaction!
......
...@@ -9,7 +9,7 @@ class AddForeignKeysToTimelogs < ActiveRecord::Migration ...@@ -9,7 +9,7 @@ class AddForeignKeysToTimelogs < ActiveRecord::Migration
# When a migration requires downtime you **must** uncomment the following # When a migration requires downtime you **must** uncomment the following
# constant and define a short and easy to understand explanation as to why the # constant and define a short and easy to understand explanation as to why the
# migration requires downtime. # migration requires downtime.
DOWNTIME_REASON = ''.freeze DOWNTIME_REASON = ''
# When using the methods "add_concurrent_index" or "add_column_with_default" # When using the methods "add_concurrent_index" or "add_column_with_default"
# you must disable the use of transactions as these methods can not run in an # you must disable the use of transactions as these methods can not run in an
......
...@@ -2,7 +2,7 @@ class RemoveInactiveJiraServiceProperties < ActiveRecord::Migration ...@@ -2,7 +2,7 @@ class RemoveInactiveJiraServiceProperties < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers include Gitlab::Database::MigrationHelpers
DOWNTIME = true DOWNTIME = true
DOWNTIME_REASON = "Removes all inactive jira_service properties".freeze DOWNTIME_REASON = "Removes all inactive jira_service properties"
def up def up
execute("UPDATE services SET properties = '{}' WHERE services.type = 'JiraService' and services.active = false") execute("UPDATE services SET properties = '{}' WHERE services.type = 'JiraService' and services.active = false")
......
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