Class: Storey::Migrator
- Inherits:
-
Object
- Object
- Storey::Migrator
- Defined in:
- lib/storey/migrator.rb
Class Method Summary collapse
- .migrate(schema, options = {}) ⇒ Object
- .migrate_all(options = {}) ⇒ Object
- .rollback(schema, step = 1) ⇒ Object
- .rollback_all(step = 1) ⇒ Object
- .run(direction, schema, version) ⇒ Object
Class Method Details
.migrate(schema, options = {}) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/storey/migrator.rb', line 13 def self.migrate(schema, ={}) Storey.switch schema do puts "= Migrating #{schema}" active_record_migrate([:version]) end end |
.migrate_all(options = {}) ⇒ Object
4 5 6 7 8 9 10 11 |
# File 'lib/storey/migrator.rb', line 4 def self.migrate_all(={}) [:version] = [:version].to_i if [:version] self.migrate 'public', Dumper.dump Storey.schemas(public: false).each do |schema| self.migrate schema, end end |
.rollback(schema, step = 1) ⇒ Object
33 34 35 36 37 38 39 40 41 |
# File 'lib/storey/migrator.rb', line 33 def self.rollback(schema, step=1) Storey.switch schema do puts "= Rolling back `#{schema}` #{step} steps" ::ActiveRecord::Migrator.rollback( ::ActiveRecord::Migrator.migrations_paths, step ) end end |