Sha256: 31274c67d76a7a63a284eae5bafd15a5a67740c8ddc4283cd6200c085fee8826
Contents?: true
Size: 1.21 KB
Versions: 3
Compression:
Stored size: 1.21 KB
Contents
module Storey class Migrator def self.migrate_all(options={}) options[:version] = options[:version].to_i if options[:version] self.migrate 'public', options Dumper.dump Storey.schemas(public: false).each do |schema| self.migrate schema, options end end def self.migrate(schema, options={}) Storey.switch schema do puts "= Migrating #{schema}" ::ActiveRecord::Migrator.migrate(::ActiveRecord::Migrator.migrations_path, options[:version]) end end def self.run(direction, schema, version) Storey.switch schema do ::ActiveRecord::Migrator.run( direction, ::ActiveRecord::Migrator.migrations_path, version ) end end def self.rollback_all(step=1) Storey.schemas.each do |schema_name| self.rollback(schema_name, step) end Dumper.dump end def self.rollback(schema, step=1) Storey.switch schema do puts "= Rolling back `#{schema}` #{step} steps" ::ActiveRecord::Migrator.rollback( ::ActiveRecord::Migrator.migrations_path, step ) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
storey-1.0.0 | lib/storey/migrator.rb |
storey-0.6.0 | lib/storey/migrator.rb |
storey-0.5.2 | lib/storey/migrator.rb |