Commit d3ac3c94 authored by Lin Jen-Shin's avatar Lin Jen-Shin

Fix Rubocop offenses for EE migrations

parent 43971ef2
# rubocop:disable Migration/Timestamps
# rubocop:disable Migration/Datetime
class CreateUserActivities < ActiveRecord::Migration
# Set this constant to true if this migration requires downtime.
DOWNTIME = true
......
# See http://doc.gitlab.com/ce/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.
# rubocop:disable Migration/Datetime
class DropUserActivitiesTable < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers
......
......@@ -12,13 +12,13 @@ class AddPartialIndexProjectRepositoryVerification < ActiveRecord::Migration
[:project_id],
name: REPO_INDEX_NAME,
where: 'repository_verification_checksum_sha IS NULL AND last_repository_verification_failure IS NULL'
)
)
add_concurrent_index(:project_registry,
[:project_id],
name: WIKI_INDEX_NAME,
where: 'wiki_verification_checksum_sha IS NULL AND last_wiki_verification_failure IS NULL'
)
)
end
def down
......
class SetResyncFlagForRetriedProjects < ActiveRecord::Migration
def up
execute <<-SQL
execute <<-SQL
UPDATE project_registry SET resync_repository = 't' WHERE repository_retry_count > 0 AND resync_repository = 'f';
UPDATE project_registry SET resync_wiki = 't' WHERE wiki_retry_count > 0 AND resync_wiki = 'f';
SQL
......
# rubocop:disable Rails/ReversibleMigration
class UpdateGroupLinks < ActiveRecord::Migration
def change
provider = quote_string(Gitlab::Auth::LDAP::Config.providers.first)
......
......@@ -19,6 +19,7 @@ class CanonicalizeKerberosIdentities < ActiveRecord::Migration
def change
reversible do |dir|
# rubocop:disable Cop/AvoidReturnFromBlocks
return unless kerberos_default_realm.present?
dir.up do
......
# rubocop:disable Migration/Timestamps
# rubocop:disable Migration/Datetime
class CreateIndexStatuses < ActiveRecord::Migration
def change
create_table :index_statuses do |t|
......
# rubocop:disable Migration/Datetime
# rubocop:disable Migration/Timestamps
class CreateRemoteMirrorsEE < ActiveRecord::Migration
def up
......
# Migration type: online without errors (works on previous version and new one)
# rubocop:disable Migration/AddColumnWithDefaultToLargeTable
# rubocop:disable Migration/Datetime
# rubocop:disable Migration/UpdateLargeTable
class AddLdapSyncStateToGroups < ActiveRecord::Migration
......
# rubocop:disable Migration/AddColumnWithDefaultToLargeTable
# rubocop:disable Migration/UpdateLargeTable
class AddSquashToMergeRequestsEE < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers
......
# See http://doc.gitlab.com/ce/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.
# rubocop:disable Migration/AddColumnWithDefaultToLargeTable
# rubocop:disable Migration/UpdateLargeTable
class AddColumnAuditorToUsers < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers
......
# rubocop:disable Migration/AddColumnWithDefaultToLargeTable
# rubocop:disable Migration/UpdateLargeTable
class AddSyncScheduleToProjectsAndRemoteProjects < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers
......
# rubocop:disable Migration/Datetime
class CreateGeoRepositoryUpdatedEvents < ActiveRecord::Migration
DOWNTIME = false
......
# rubocop:disable Migration/Datetime
class CreateGeoEventLog < ActiveRecord::Migration
DOWNTIME = false
......
class CreateProjectRepositoryStates < ActiveRecord::Migration
class CreateProjectRepositoryStates < ActiveRecord::Migration
DOWNTIME = false
def change
......
......@@ -18,6 +18,7 @@ class CreateChatopsTables < ActiveRecord::Migration
t.index :pipeline_id, unique: true
end
# rubocop:disable Migration/AddConcurrentForeignKey
add_foreign_key :ci_pipeline_chat_data, :ci_pipelines,
column: :pipeline_id,
on_delete: :cascade
......
......@@ -13,7 +13,7 @@ class AddPartialIndexToProjectRepositoryStatesChecksumColumns < ActiveRecord::Mi
name: INDEX_NAME,
length: Gitlab::Database.mysql? ? 20 : nil,
where: 'repository_verification_checksum IS NULL OR wiki_verification_checksum IS NULL'
)
)
end
end
......
class AddExternalAuthMutualTlsFieldsToProjectSettings < ActiveRecord::Migration
DOWNTIME = false
def change
......
......@@ -5,7 +5,7 @@ class DropNullConstraintGeoEventsStoragePath < ActiveRecord::Migration
TABLES = %i(geo_hashed_storage_migrated_events geo_repository_created_events
geo_repository_deleted_events geo_repository_renamed_events)
def up
def up
TABLES.each do |table|
change_column_null(table, :repository_storage_path, true)
end
......
......@@ -11,4 +11,3 @@ class AddNegativeMatchingCommitMessagePushRule < ActiveRecord::Migration
remove_column :push_rules, :commit_message_negative_regex
end
end
......@@ -10,6 +10,7 @@ class AddIndexesToProjectMirrorDataEE < ActiveRecord::Migration
end
def down
# rubocop:disable Migration/RemoveIndex
remove_index :project_mirror_data, :last_successful_update_at if index_exists? :project_mirror_data, :last_successful_update_at
end
end
......@@ -4,6 +4,7 @@ class AddGeoNodesVerificationMaxCapacity < ActiveRecord::Migration
DOWNTIME = false
def change
# rubocop:disable Migration/AddColumn
add_column :geo_nodes, :verification_max_capacity, :integer, default: 100, null: false
end
end
......@@ -29,6 +29,7 @@ class DropRepositoryStorageEventsForGeoEvents < ActiveRecord::Migration
private
def update_repository_storage_path(table)
# rubocop:disable Migration/UpdateColumnInBatches
update_column_in_batches(table, :repository_storage_path, update_statement) do |t, q|
q.where(t[:repository_storage_path].eq(nil))
end
......
......@@ -98,7 +98,7 @@ class MigrateMirrorAttributesDataFromProjectsToImportState < ActiveRecord::Migra
execute <<~SQL
UPDATE project_mirror_data
SET status = 'none'
FROM projects
FROM projects
WHERE projects.id = project_id
AND projects.mirror = TRUE
AND projects.id BETWEEN #{start} AND #{stop}
......
......@@ -14,7 +14,7 @@ class FixPartialIndexToProjectRepositoryStatesChecksumColumns < ActiveRecord::Mi
:project_id,
name: NEW_INDEX_NAME,
where: '(repository_verification_checksum IS NULL AND last_repository_verification_failure is NULL) OR (wiki_verification_checksum IS NULL AND last_wiki_verification_failure IS NULL)'
)
)
end
def down
......@@ -25,6 +25,6 @@ class FixPartialIndexToProjectRepositoryStatesChecksumColumns < ActiveRecord::Mi
name: OLD_INDEX_NAME,
length: Gitlab::Database.mysql? ? 20 : nil,
where: 'repository_verification_checksum IS NULL OR wiki_verification_checksum IS NULL'
)
)
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