Sha256: cea2aa5a2ea0c6ede705994137b810597b6946cf2ede46283b07024ad2cdfdeb

Contents?: true

Size: 846 Bytes

Versions: 3

Compression:

Stored size: 846 Bytes

Contents

# frozen_string_literal: true

module ActiveRecord
  module Dbt
    module Factory
      module ColumnsFactory
        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_test = ActiveRecord::Dbt::Column::Test.new(
              table_name,
              column,
              primary_keys: primary_keys,
              foreign_keys: foreign_keys
            )

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
activerecord-dbt-0.3.0 lib/active_record/dbt/factory/columns_factory.rb
activerecord-dbt-0.2.0 lib/active_record/dbt/factory/columns_factory.rb
activerecord-dbt-0.1.0 lib/active_record/dbt/factory/columns_factory.rb