Sha256: 7cdc648f47e92409787342d4ef437948d2716dfce777f60384e1d16e9c12f892

Contents?: true

Size: 731 Bytes

Versions: 3

Compression:

Stored size: 731 Bytes

Contents

module Storey::Migrator
  extend self

  def migrate_all
    self.migrate 'public'
    Storey::Dumper.dump
    Storey.schemas(public: false).each do |schema|
      self.migrate schema
    end
  end

  def migrate(schema)
    Storey.switch schema do
      ActiveRecord::Migrator.migrate ActiveRecord::Migrator.migrations_path
    end
  end

  def run(direction, schema, version)
    Storey.switch schema do
      ActiveRecord::Migrator.run(
        direction,
        ActiveRecord::Migrator.migrations_path,
        version
      )
    end
  end

  def rollback(schema, step=1)
    Storey.switch schema do
      ActiveRecord::Migrator.rollback(
        ActiveRecord::Migrator.migrations_path,
        step
      )
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
storey-0.3.4 lib/storey/migrator.rb
storey-0.3.3 lib/storey/migrator.rb
storey-0.3.1 lib/storey/migrator.rb