Class: Tern
- Inherits:
-
Object
- Object
- Tern
- Defined in:
- lib/tern.rb
Instance Method Summary collapse
-
#initialize(alterations_table, alterations_column, definitions_table) ⇒ Tern
constructor
A new instance of Tern.
- #migrate(options = {}) ⇒ Object
Constructor Details
#initialize(alterations_table, alterations_column, definitions_table) ⇒ Tern
Returns a new instance of Tern.
180 181 182 183 184 185 186 187 188 189 190 |
# File 'lib/tern.rb', line 180 def initialize(alterations_table, alterations_column, definitions_table) Alteration.table_name = alterations_table.to_sym Alteration.version_column = alterations_column.to_sym Alteration.ensure_table_exists @alterations = Alteration.load 'alterations' Definition.table_name = definitions_table.to_sym Definition.ensure_table_exists @existing_definitions = Definition.load_existing @target_definitions = Definition.load_targets 'definitions/sequence.yml' end |
Instance Method Details
#migrate(options = {}) ⇒ Object
192 193 194 195 196 197 198 199 |
# File 'lib/tern.rb', line 192 def migrate(={}) sequences = [:sequences] || ['default'] DB.transaction do drop_existing_definitions(sequences) run_alterations([:version]) create_target_definitions(sequences) end end |