Class: DbBlaster::SourceTablesSchemaBuilder
- Inherits:
-
Object
- Object
- DbBlaster::SourceTablesSchemaBuilder
- Defined in:
- lib/db_blaster/source_tables_schema_builder.rb
Overview
Builds an array of tables and their columns
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.build_schema ⇒ Object
6 7 8 |
# File 'lib/db_blaster/source_tables_schema_builder.rb', line 6 def self.build_schema new.build_schema end |
Instance Method Details
#build_columns_from_source_table(source_table) ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/db_blaster/source_tables_schema_builder.rb', line 18 def build_columns_from_source_table(source_table) ActiveRecord::Base.connection.columns(source_table.name).collect do |column| next if source_table.ignored_columns.include?(column.name) { name: column.name, type: column.type, limit: column.limit } end.compact end |
#build_schema ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/db_blaster/source_tables_schema_builder.rb', line 10 def build_schema SyncSourceTablesWithConfiguration.sync DbBlaster::SourceTable.all.each_with_object({}) do |source_table, hash| hash[source_table.name] = build_columns_from_source_table(source_table) end end |