diff options
35 files changed, 47 insertions, 44 deletions
diff --git a/.rubocop.yml b/.rubocop.yml index 2a8c30eff3f..1850c31e344 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -354,6 +354,9 @@ Style/MultilineTernaryOperator: # mutable literal (e.g. array or hash). Style/MutableConstant: Enabled: true + Exclude: + - 'db/migrate/**/*' + - 'db/post_migrate/**/*' # Favor unless over if for negative conditions (or control flow or). Style/NegatedIf: diff --git a/db/migrate/20160705055254_move_from_developers_can_merge_to_protected_branches_merge_access.rb b/db/migrate/20160705055254_move_from_developers_can_merge_to_protected_branches_merge_access.rb index cd5d4286b31..1db0df92bec 100644 --- a/db/migrate/20160705055254_move_from_developers_can_merge_to_protected_branches_merge_access.rb +++ b/db/migrate/20160705055254_move_from_developers_can_merge_to_protected_branches_merge_access.rb @@ -3,7 +3,7 @@ class MoveFromDevelopersCanMergeToProtectedBranchesMergeAccess < ActiveRecord::Migration 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 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. diff --git a/db/migrate/20160705055308_move_from_developers_can_push_to_protected_branches_push_access.rb b/db/migrate/20160705055308_move_from_developers_can_push_to_protected_branches_push_access.rb index 45e3368fa9b..5c3e189bb5b 100644 --- a/db/migrate/20160705055308_move_from_developers_can_push_to_protected_branches_push_access.rb +++ b/db/migrate/20160705055308_move_from_developers_can_push_to_protected_branches_push_access.rb @@ -3,7 +3,7 @@ class MoveFromDevelopersCanPushToProtectedBranchesPushAccess < ActiveRecord::Migration 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 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. diff --git a/db/migrate/20160729173930_remove_project_id_from_spam_logs.rb b/db/migrate/20160729173930_remove_project_id_from_spam_logs.rb index 9995191ed9b..e28ab31d629 100644 --- a/db/migrate/20160729173930_remove_project_id_from_spam_logs.rb +++ b/db/migrate/20160729173930_remove_project_id_from_spam_logs.rb @@ -10,7 +10,7 @@ class RemoveProjectIdFromSpamLogs < ActiveRecord::Migration # When a migration requires downtime you **must** uncomment the following # constant and define a short and easy to understand explanation as to why the # 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" # you must disable the use of transactions as these methods can not run in an diff --git a/db/migrate/20160823081327_change_merge_error_to_text.rb b/db/migrate/20160823081327_change_merge_error_to_text.rb index 6dbf8a8d5e5..7920389cd83 100644 --- a/db/migrate/20160823081327_change_merge_error_to_text.rb +++ b/db/migrate/20160823081327_change_merge_error_to_text.rb @@ -2,7 +2,7 @@ class ChangeMergeErrorToText < ActiveRecord::Migration include Gitlab::Database::MigrationHelpers 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 change_column :merge_requests, :merge_error, :text, limit: 65535 diff --git a/db/migrate/20160824124900_add_table_issue_metrics.rb b/db/migrate/20160824124900_add_table_issue_metrics.rb index 9e52c54a35b..e9bb79b3c62 100644 --- a/db/migrate/20160824124900_add_table_issue_metrics.rb +++ b/db/migrate/20160824124900_add_table_issue_metrics.rb @@ -10,7 +10,7 @@ class AddTableIssueMetrics < ActiveRecord::Migration # When a migration requires downtime you **must** uncomment the following # constant and define a short and easy to understand explanation as to why the # 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" # you must disable the use of transactions as these methods can not run in an diff --git a/db/migrate/20160825052008_add_table_merge_request_metrics.rb b/db/migrate/20160825052008_add_table_merge_request_metrics.rb index 195baf5f45b..e01cc5038b9 100644 --- a/db/migrate/20160825052008_add_table_merge_request_metrics.rb +++ b/db/migrate/20160825052008_add_table_merge_request_metrics.rb @@ -10,7 +10,7 @@ class AddTableMergeRequestMetrics < ActiveRecord::Migration # When a migration requires downtime you **must** uncomment the following # constant and define a short and easy to understand explanation as to why the # 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" # you must disable the use of transactions as these methods can not run in an diff --git a/db/migrate/20160831223750_remove_features_enabled_from_projects.rb b/db/migrate/20160831223750_remove_features_enabled_from_projects.rb index 8202c6a7b79..a2c207b49ea 100644 --- a/db/migrate/20160831223750_remove_features_enabled_from_projects.rb +++ b/db/migrate/20160831223750_remove_features_enabled_from_projects.rb @@ -7,7 +7,7 @@ class RemoveFeaturesEnabledFromProjects < ActiveRecord::Migration # Set this constant to true if this migration requires downtime. DOWNTIME = true - DOWNTIME_REASON = "Removing fields from database requires downtine.".freeze + DOWNTIME_REASON = "Removing fields from database requires downtine." def up remove_column :projects, :issues_enabled diff --git a/db/migrate/20160913162434_remove_projects_pushes_since_gc.rb b/db/migrate/20160913162434_remove_projects_pushes_since_gc.rb index 919bfcdd86e..18ea9d43a43 100644 --- a/db/migrate/20160913162434_remove_projects_pushes_since_gc.rb +++ b/db/migrate/20160913162434_remove_projects_pushes_since_gc.rb @@ -5,7 +5,7 @@ class RemoveProjectsPushesSinceGc < ActiveRecord::Migration include Gitlab::Database::MigrationHelpers DOWNTIME = true - DOWNTIME_REASON = 'This migration removes an existing column'.freeze + DOWNTIME_REASON = 'This migration removes an existing column' disable_ddl_transaction! diff --git a/db/migrate/20160913212128_change_artifacts_size_column.rb b/db/migrate/20160913212128_change_artifacts_size_column.rb index 8cda4b66c5a..063bbca537c 100644 --- a/db/migrate/20160913212128_change_artifacts_size_column.rb +++ b/db/migrate/20160913212128_change_artifacts_size_column.rb @@ -3,7 +3,7 @@ class ChangeArtifactsSizeColumn < ActiveRecord::Migration 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 change_column :ci_builds, :artifacts_size, :integer, limit: 8 diff --git a/db/migrate/20160915042921_create_merge_requests_closing_issues.rb b/db/migrate/20160915042921_create_merge_requests_closing_issues.rb index 105278d49f7..94874a853da 100644 --- a/db/migrate/20160915042921_create_merge_requests_closing_issues.rb +++ b/db/migrate/20160915042921_create_merge_requests_closing_issues.rb @@ -10,7 +10,7 @@ class CreateMergeRequestsClosingIssues < ActiveRecord::Migration # When a migration requires downtime you **must** uncomment the following # constant and define a short and easy to understand explanation as to why the # 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" # you must disable the use of transactions as these methods can not run in an diff --git a/db/migrate/20160919144305_add_type_to_labels.rb b/db/migrate/20160919144305_add_type_to_labels.rb index f028c9460d1..66172bda6ff 100644 --- a/db/migrate/20160919144305_add_type_to_labels.rb +++ b/db/migrate/20160919144305_add_type_to_labels.rb @@ -2,7 +2,7 @@ class AddTypeToLabels < ActiveRecord::Migration include Gitlab::Database::MigrationHelpers 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 add_column :labels, :type, :string diff --git a/db/migrate/20161014173530_create_label_priorities.rb b/db/migrate/20161014173530_create_label_priorities.rb index 73c9897631c..2c22841c28a 100644 --- a/db/migrate/20161014173530_create_label_priorities.rb +++ b/db/migrate/20161014173530_create_label_priorities.rb @@ -2,7 +2,7 @@ class CreateLabelPriorities < ActiveRecord::Migration include Gitlab::Database::MigrationHelpers DOWNTIME = true - DOWNTIME_REASON = 'This migration adds foreign keys'.freeze + DOWNTIME_REASON = 'This migration adds foreign keys' disable_ddl_transaction! diff --git a/db/migrate/20161017125927_add_unique_index_to_labels.rb b/db/migrate/20161017125927_add_unique_index_to_labels.rb index 5571160ccb4..f2b56ebfb7b 100644 --- a/db/migrate/20161017125927_add_unique_index_to_labels.rb +++ b/db/migrate/20161017125927_add_unique_index_to_labels.rb @@ -2,7 +2,7 @@ class AddUniqueIndexToLabels < ActiveRecord::Migration include Gitlab::Database::MigrationHelpers DOWNTIME = true - DOWNTIME_REASON = 'This migration removes duplicated labels.'.freeze + DOWNTIME_REASON = 'This migration removes duplicated labels.' disable_ddl_transaction! diff --git a/db/migrate/20161018024215_migrate_labels_priority.rb b/db/migrate/20161018024215_migrate_labels_priority.rb index 9529bd3d494..22bec2382f4 100644 --- a/db/migrate/20161018024215_migrate_labels_priority.rb +++ b/db/migrate/20161018024215_migrate_labels_priority.rb @@ -2,7 +2,7 @@ class MigrateLabelsPriority < ActiveRecord::Migration include Gitlab::Database::MigrationHelpers 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! diff --git a/db/migrate/20161018024550_remove_priority_from_labels.rb b/db/migrate/20161018024550_remove_priority_from_labels.rb index 4415a2e91af..b7416cca664 100644 --- a/db/migrate/20161018024550_remove_priority_from_labels.rb +++ b/db/migrate/20161018024550_remove_priority_from_labels.rb @@ -2,7 +2,7 @@ class RemovePriorityFromLabels < ActiveRecord::Migration include Gitlab::Database::MigrationHelpers DOWNTIME = true - DOWNTIME_REASON = 'This migration removes an existing column'.freeze + DOWNTIME_REASON = 'This migration removes an existing column' disable_ddl_transaction! diff --git a/db/migrate/20161019190736_migrate_sidekiq_queues_from_default.rb b/db/migrate/20161019190736_migrate_sidekiq_queues_from_default.rb index 3a7acc84028..9f502a8df73 100644 --- a/db/migrate/20161019190736_migrate_sidekiq_queues_from_default.rb +++ b/db/migrate/20161019190736_migrate_sidekiq_queues_from_default.rb @@ -8,7 +8,7 @@ class MigrateSidekiqQueuesFromDefault < ActiveRecord::Migration DOWNTIME = true - DOWNTIME_REASON = <<-EOF.freeze + DOWNTIME_REASON = <<-EOF 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 migration completes. diff --git a/db/migrate/20161019213545_generate_project_feature_for_projects.rb b/db/migrate/20161019213545_generate_project_feature_for_projects.rb index 6486181575d..4554e14b0df 100644 --- a/db/migrate/20161019213545_generate_project_feature_for_projects.rb +++ b/db/migrate/20161019213545_generate_project_feature_for_projects.rb @@ -1,7 +1,7 @@ class GenerateProjectFeatureForProjects < ActiveRecord::Migration DOWNTIME = true - DOWNTIME_REASON = <<-HEREDOC.freeze + DOWNTIME_REASON = <<-HEREDOC 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 makes sure all projects have a project_feature record associated. diff --git a/db/migrate/20161020083353_add_pipeline_id_to_merge_request_metrics.rb b/db/migrate/20161020083353_add_pipeline_id_to_merge_request_metrics.rb index b396c03ecbf..2abfe47b776 100644 --- a/db/migrate/20161020083353_add_pipeline_id_to_merge_request_metrics.rb +++ b/db/migrate/20161020083353_add_pipeline_id_to_merge_request_metrics.rb @@ -12,7 +12,7 @@ class AddPipelineIdToMergeRequestMetrics < ActiveRecord::Migration # When a migration requires downtime you **must** uncomment the following # constant and define a short and easy to understand explanation as to why the # 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" # you must disable the use of transactions as these methods can not run in an diff --git a/db/migrate/20161024042317_migrate_mailroom_queue_from_default.rb b/db/migrate/20161024042317_migrate_mailroom_queue_from_default.rb index 91d078f6293..fc2e4c12b30 100644 --- a/db/migrate/20161024042317_migrate_mailroom_queue_from_default.rb +++ b/db/migrate/20161024042317_migrate_mailroom_queue_from_default.rb @@ -8,7 +8,7 @@ class MigrateMailroomQueueFromDefault < ActiveRecord::Migration DOWNTIME = true - DOWNTIME_REASON = <<-EOF.freeze + DOWNTIME_REASON = <<-EOF 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 migration completes. diff --git a/db/migrate/20161025231710_migrate_jira_to_gem.rb b/db/migrate/20161025231710_migrate_jira_to_gem.rb index 38824ba9fe5..870b00411d2 100644 --- a/db/migrate/20161025231710_migrate_jira_to_gem.rb +++ b/db/migrate/20161025231710_migrate_jira_to_gem.rb @@ -1,7 +1,7 @@ class MigrateJiraToGem < ActiveRecord::Migration DOWNTIME = true - DOWNTIME_REASON = <<-HEREDOC.freeze + DOWNTIME_REASON = <<-HEREDOC 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 service refactoring: api_url, project_url, new_issue_url, issues_url. diff --git a/db/migrate/20161031174110_migrate_subscriptions_project_id.rb b/db/migrate/20161031174110_migrate_subscriptions_project_id.rb index 130b5f556ff..549145a0a65 100644 --- a/db/migrate/20161031174110_migrate_subscriptions_project_id.rb +++ b/db/migrate/20161031174110_migrate_subscriptions_project_id.rb @@ -2,7 +2,7 @@ class MigrateSubscriptionsProjectId < ActiveRecord::Migration include Gitlab::Database::MigrationHelpers 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 execute <<-EOF.strip_heredoc diff --git a/db/migrate/20161031181638_add_unique_index_to_subscriptions.rb b/db/migrate/20161031181638_add_unique_index_to_subscriptions.rb index 1b675a36db7..4b1b29e1265 100644 --- a/db/migrate/20161031181638_add_unique_index_to_subscriptions.rb +++ b/db/migrate/20161031181638_add_unique_index_to_subscriptions.rb @@ -2,7 +2,7 @@ class AddUniqueIndexToSubscriptions < ActiveRecord::Migration include Gitlab::Database::MigrationHelpers 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! diff --git a/db/migrate/20161103171205_rename_repository_storage_column.rb b/db/migrate/20161103171205_rename_repository_storage_column.rb index 32d22e630d8..93280573939 100644 --- a/db/migrate/20161103171205_rename_repository_storage_column.rb +++ b/db/migrate/20161103171205_rename_repository_storage_column.rb @@ -10,7 +10,7 @@ class RenameRepositoryStorageColumn < ActiveRecord::Migration # When a migration requires downtime you **must** uncomment the following # constant and define a short and easy to understand explanation as to why the # 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" # you must disable the use of transactions as these methods can not run in an diff --git a/db/migrate/20161124141322_migrate_process_commit_worker_jobs.rb b/db/migrate/20161124141322_migrate_process_commit_worker_jobs.rb index 3865f3e3a08..f4fe8103218 100644 --- a/db/migrate/20161124141322_migrate_process_commit_worker_jobs.rb +++ b/db/migrate/20161124141322_migrate_process_commit_worker_jobs.rb @@ -25,7 +25,7 @@ class MigrateProcessCommitWorkerJobs < ActiveRecord::Migration end 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! diff --git a/db/migrate/20161130095245_fill_routes_table.rb b/db/migrate/20161130095245_fill_routes_table.rb index ccd2cceee0c..c3536d6d911 100644 --- a/db/migrate/20161130095245_fill_routes_table.rb +++ b/db/migrate/20161130095245_fill_routes_table.rb @@ -5,7 +5,7 @@ class FillRoutesTable < ActiveRecord::Migration include Gitlab::Database::MigrationHelpers 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 execute <<-EOF diff --git a/db/migrate/20161130101252_fill_projects_routes_table.rb b/db/migrate/20161130101252_fill_projects_routes_table.rb index 5e7d0e75ad8..56ba6fcdbe3 100644 --- a/db/migrate/20161130101252_fill_projects_routes_table.rb +++ b/db/migrate/20161130101252_fill_projects_routes_table.rb @@ -5,7 +5,7 @@ class FillProjectsRoutesTable < ActiveRecord::Migration include Gitlab::Database::MigrationHelpers 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 if Gitlab::Database.postgresql? diff --git a/db/migrate/20161201160452_migrate_project_statistics.rb b/db/migrate/20161201160452_migrate_project_statistics.rb index afd5ce95068..3ae3f2c159b 100644 --- a/db/migrate/20161201160452_migrate_project_statistics.rb +++ b/db/migrate/20161201160452_migrate_project_statistics.rb @@ -2,7 +2,7 @@ class MigrateProjectStatistics < ActiveRecord::Migration include Gitlab::Database::MigrationHelpers DOWNTIME = true - DOWNTIME_REASON = 'Removes two columns from the projects table'.freeze + DOWNTIME_REASON = 'Removes two columns from the projects table' def up # convert repository_size in float (megabytes) to integer (bytes), diff --git a/db/migrate/20161207231620_fixup_environment_name_uniqueness.rb b/db/migrate/20161207231620_fixup_environment_name_uniqueness.rb index b31f9699f3d..f73e4f6c99b 100644 --- a/db/migrate/20161207231620_fixup_environment_name_uniqueness.rb +++ b/db/migrate/20161207231620_fixup_environment_name_uniqueness.rb @@ -2,7 +2,7 @@ class FixupEnvironmentNameUniqueness < ActiveRecord::Migration include Gitlab::Database::MigrationHelpers DOWNTIME = true - DOWNTIME_REASON = 'Renaming non-unique environments'.freeze + DOWNTIME_REASON = 'Renaming non-unique environments' def up environments = Arel::Table.new(:environments) @@ -42,10 +42,10 @@ class FixupEnvironmentNameUniqueness < ActiveRecord::Migration conflicts.each do |id, name| update_sql = Arel::UpdateManager.new(ActiveRecord::Base) - .table(environments) - .set(environments[:name] => name + "-" + id.to_s) - .where(environments[:id].eq(id)) - .to_sql + .table(environments) + .set(environments[:name] => name + "-" + id.to_s) + .where(environments[:id].eq(id)) + .to_sql connection.exec_update(update_sql, self.class.name, []) end diff --git a/db/migrate/20161207231621_create_environment_name_unique_index.rb b/db/migrate/20161207231621_create_environment_name_unique_index.rb index 94fa3b6838c..ac680c8d10f 100644 --- a/db/migrate/20161207231621_create_environment_name_unique_index.rb +++ b/db/migrate/20161207231621_create_environment_name_unique_index.rb @@ -4,7 +4,7 @@ class CreateEnvironmentNameUniqueIndex < ActiveRecord::Migration disable_ddl_transaction! 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 remove_index :environments, [:project_id, :name] diff --git a/db/migrate/20161207231626_add_environment_slug.rb b/db/migrate/20161207231626_add_environment_slug.rb index 1dec96a1299..83cdd484c4c 100644 --- a/db/migrate/20161207231626_add_environment_slug.rb +++ b/db/migrate/20161207231626_add_environment_slug.rb @@ -5,7 +5,7 @@ class AddEnvironmentSlug < ActiveRecord::Migration include Gitlab::Database::MigrationHelpers 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 LETTERS = 'a'..'z' diff --git a/db/migrate/20161209153400_add_unique_index_for_environment_slug.rb b/db/migrate/20161209153400_add_unique_index_for_environment_slug.rb index fbf6e4c2a45..e9fcef1cd45 100644 --- a/db/migrate/20161209153400_add_unique_index_for_environment_slug.rb +++ b/db/migrate/20161209153400_add_unique_index_for_environment_slug.rb @@ -5,7 +5,7 @@ class AddUniqueIndexForEnvironmentSlug < ActiveRecord::Migration include Gitlab::Database::MigrationHelpers DOWNTIME = true - DOWNTIME_REASON = 'Adding a *unique* index to environments.slug'.freeze + DOWNTIME_REASON = 'Adding a *unique* index to environments.slug' disable_ddl_transaction! diff --git a/db/migrate/20170124174637_add_foreign_keys_to_timelogs.rb b/db/migrate/20170124174637_add_foreign_keys_to_timelogs.rb index 2b2b7ab27ce..69bfa2d3fc4 100644 --- a/db/migrate/20170124174637_add_foreign_keys_to_timelogs.rb +++ b/db/migrate/20170124174637_add_foreign_keys_to_timelogs.rb @@ -9,7 +9,7 @@ class AddForeignKeysToTimelogs < ActiveRecord::Migration # When a migration requires downtime you **must** uncomment the following # constant and define a short and easy to understand explanation as to why the # migration requires downtime. - DOWNTIME_REASON = ''.freeze + DOWNTIME_REASON = '' # 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 diff --git a/db/post_migrate/20161011222551_remove_inactive_jira_service_properties.rb b/db/post_migrate/20161011222551_remove_inactive_jira_service_properties.rb index eacc6d1b033..319d86ac159 100644 --- a/db/post_migrate/20161011222551_remove_inactive_jira_service_properties.rb +++ b/db/post_migrate/20161011222551_remove_inactive_jira_service_properties.rb @@ -2,7 +2,7 @@ class RemoveInactiveJiraServiceProperties < ActiveRecord::Migration include Gitlab::Database::MigrationHelpers DOWNTIME = true - DOWNTIME_REASON = "Removes all inactive jira_service properties".freeze + DOWNTIME_REASON = "Removes all inactive jira_service properties" def up execute("UPDATE services SET properties = '{}' WHERE services.type = 'JiraService' and services.active = false") diff --git a/db/post_migrate/20161109150329_fix_project_records_with_invalid_visibility.rb b/db/post_migrate/20161109150329_fix_project_records_with_invalid_visibility.rb index 823274b08c0..69007b8e8ed 100644 --- a/db/post_migrate/20161109150329_fix_project_records_with_invalid_visibility.rb +++ b/db/post_migrate/20161109150329_fix_project_records_with_invalid_visibility.rb @@ -14,15 +14,15 @@ class FixProjectRecordsWithInvalidVisibility < ActiveRecord::Migration finder_sql = projects - .join(namespaces, Arel::Nodes::InnerJoin) - .on(projects[:namespace_id].eq(namespaces[:id])) - .where(projects[:visibility_level].gt(namespaces[:visibility_level])) - .project(projects[:id], namespaces[:visibility_level]) - .take(BATCH_SIZE) - .to_sql + .join(namespaces, Arel::Nodes::InnerJoin) + .on(projects[:namespace_id].eq(namespaces[:id])) + .where(projects[:visibility_level].gt(namespaces[:visibility_level])) + .project(projects[:id], namespaces[:visibility_level]) + .take(BATCH_SIZE) + .to_sql # Update matching rows in batches. Each batch can cause up to 3 UPDATE - # statements, in addition to the SELECT: one per visibility_level + # statements, in addition to the SELECT: one per visibility_level loop do to_update = connection.exec_query(finder_sql) break if to_update.rows.count == 0 |