Class: Miguel::Importer
- Inherits:
-
Object
- Object
- Miguel::Importer
- Defined in:
- lib/miguel/importer.rb
Overview
Class for importing database schema from Sequel database.
Constant Summary collapse
- IGNORED_TABLES =
Which tables we automatically ignore on import.
[ :schema_info ]
Instance Attribute Summary collapse
-
#db ⇒ Object
readonly
The database we operate upon.
Instance Method Summary collapse
-
#initialize(db) ⇒ Importer
constructor
Create new instance for importing schema from given database.
-
#schema ⇒ Object
Import the database schema.
Constructor Details
#initialize(db) ⇒ Importer
Create new instance for importing schema from given database.
14 15 16 |
# File 'lib/miguel/importer.rb', line 14 def initialize( db ) @db = db end |
Instance Attribute Details
#db ⇒ Object (readonly)
The database we operate upon.
11 12 13 |
# File 'lib/miguel/importer.rb', line 11 def db @db end |
Instance Method Details
#schema ⇒ Object
Import the database schema.
278 279 280 281 282 283 284 285 286 287 288 |
# File 'lib/miguel/importer.rb', line 278 def schema schema = Schema.new for name in db.tables next if IGNORED_TABLES.include? name table = schema.add_table( name ) import_table( table ) end schema end |