Class: Chicago::Database::MigrationFileWriter Private
- Inherits:
-
Object
- Object
- Chicago::Database::MigrationFileWriter
- Defined in:
- lib/chicago/database/migration_file_writer.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Writes Sequel migrations for the star schema
Instance Method Summary collapse
-
#migration_file(directory) ⇒ Object
private
Returns the path the migration file has been written to.
-
#write_migration_file(db, schema, directory, generate_key_tables = true) ⇒ Object
private
Writes the migration file necessary for all defined facts and dimensions.
Instance Method Details
#migration_file(directory) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns the path the migration file has been written to.
20 21 22 |
# File 'lib/chicago/database/migration_file_writer.rb', line 20 def migration_file(directory) File.join(directory, migration_file_name) end |
#write_migration_file(db, schema, directory, generate_key_tables = true) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Writes the migration file necessary for all defined facts and dimensions.
9 10 11 12 13 14 15 16 17 |
# File 'lib/chicago/database/migration_file_writer.rb', line 9 def write_migration_file(db, schema, directory, generate_key_tables=true) schema_strategy = ConcreteSchemaStrategy.for_db(db) tables = SchemaGenerator.new(schema_strategy, generate_key_tables).traverse(schema) File.open(migration_file(directory), "w") do |fh| fh.write Sequel::MigrationBuilder.new(db, schema_strategy.). generate_migration(tables) end end |