Class: Hecks::Adapters::SQLDatabase::SchemaFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/schema_factory.rb

Instance Method Summary collapse

Constructor Details

#initialize(domain_spec) ⇒ SchemaFactory

Returns a new instance of SchemaFactory.



5
6
7
8
9
# File 'lib/schema_factory.rb', line 5

def initialize(domain_spec)
  @domain_spec = domain_spec
  @tables = Table.factory(domain_objects)
  @join_tables = []
end

Instance Method Details

#buildObject



11
12
13
14
15
16
17
18
19
# File 'lib/schema_factory.rb', line 11

def build
  @tables.each do |table|
    swap_domain_references(table)
    build_join_tables(table)
    remove_domain_columns(table)
  end

  Schema.new(@tables + @join_tables)
end