Class: Rooq::SchemaValidator
- Inherits:
-
Object
- Object
- Rooq::SchemaValidator
- Defined in:
- lib/rooq/schema_validator.rb
Instance Method Summary collapse
-
#initialize(connection, schema: "public") ⇒ SchemaValidator
constructor
A new instance of SchemaValidator.
- #validate(tables) ⇒ Object
Constructor Details
#initialize(connection, schema: "public") ⇒ SchemaValidator
Returns a new instance of SchemaValidator.
5 6 7 8 |
# File 'lib/rooq/schema_validator.rb', line 5 def initialize(connection, schema: "public") @introspector = Generator::Introspector.new(connection) @schema = schema end |
Instance Method Details
#validate(tables) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/rooq/schema_validator.rb', line 10 def validate(tables) errors = [] tables.each do |table| table_errors = validate_table(table) errors.concat(table_errors) end raise SchemaValidationError.new(errors) unless errors.empty? true end |