Module: ActiveRecord::Dbt::Factory::Columns::YmlFactory

Defined in:
lib/active_record/dbt/factory/columns/yml_factory.rb

Class Method Summary collapse

Class Method Details

.build(table_name, primary_keys: ActiveRecord::Base.connection.primary_keys(table_name), foreign_keys: ActiveRecord::Base.connection.foreign_keys(table_name)) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/active_record/dbt/factory/columns/yml_factory.rb', line 8

def self.build(
  table_name,
  primary_keys: ActiveRecord::Base.connection.primary_keys(table_name),
  foreign_keys: ActiveRecord::Base.connection.foreign_keys(table_name)
)
  ActiveRecord::Base.connection.columns(table_name).map do |column|
    column_data_test = ActiveRecord::Dbt::Column::DataTest.new(
      table_name,
      column,
      primary_keys: primary_keys,
      foreign_keys: foreign_keys
    )

    ActiveRecord::Dbt::Column::Yml.new(
      table_name,
      column,
      column_data_test,
      primary_keys: primary_keys
    )
  end
end