discourse/migrations/lib/database/schema/validation/schema_config_validator.rb
Gerhard Schlager 17ba19c7ae REFACTOR: Code generator for migrations IntemerdiateDB
* Splits the existing script into multiple classes
* Adds command for generating IntermediateDB schema (`migrations/bin/cli schema generate`)
* Changes the syntax of the IntermediateDB schema config
* Adds validation for the schema config
* It uses YAML schema aka JSON schema to validate the config file
* It generates the SQL schema file and Ruby classes for storing data in the IntermediateDB
2025-04-07 17:22:36 +02:00

18 lines
505 B
Ruby
Vendored

# frozen_string_literal: true
module Migrations::Database::Schema::Validation
class SchemaConfigValidator
def initialize(config, errors)
@config = config
@errors = errors
end
def validate
ActiveRecord::Base.with_connection do |db|
GloballyExcludedTablesValidator.new(@config, @errors, db).validate
GloballyConfiguredColumnsValidator.new(@config, @errors, db).validate
TablesValidator.new(@config, @errors, db).validate
end
end
end
end