mirror of
https://gitlab.com/gitlab-org/gitlab-foss.git
synced 2025-07-25 16:03:48 +00:00
Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
@ -7,6 +7,7 @@ class MigrationSchemaValidator
|
||||
FILENAME = 'db/structure.sql'
|
||||
|
||||
MIGRATION_DIRS = %w[db/migrate db/post_migrate].freeze
|
||||
PARTITION_MANAGER_CONFIG = %w[config/initializers/postgres_partitioning.rb].freeze
|
||||
|
||||
SCHEMA_VERSION_DIR = 'db/schema_migrations'
|
||||
|
||||
@ -38,8 +39,8 @@ class MigrationSchemaValidator
|
||||
end
|
||||
|
||||
def validate!
|
||||
if committed_migrations.empty?
|
||||
puts "\e[32m No migrations found, skipping schema validation\e[0m"
|
||||
unless committed_migrations.any? || partition_manager_config_changes?
|
||||
puts "\e[32m No new migrations or partition configuration changes found, skipping schema validation\e[0m"
|
||||
return
|
||||
end
|
||||
|
||||
@ -184,6 +185,12 @@ class MigrationSchemaValidator
|
||||
end
|
||||
end
|
||||
|
||||
def partition_manager_config_changes?
|
||||
git_command = "git diff --name-only #{diff_target} -- #{PARTITION_MANAGER_CONFIG.join(' ')}"
|
||||
|
||||
run(git_command).split("\n").any?
|
||||
end
|
||||
|
||||
def diff_target
|
||||
@diff_target ||= pipeline_for_merged_results? ? target_branch : merge_base
|
||||
end
|
||||
|
Reference in New Issue
Block a user