Sha256: d17a56c343e0aa1e1b30cc1f13ec1d2720ab91ac21e3f48e47b318aa29161a57
Contents?: true
Size: 819 Bytes
Versions: 11
Compression:
Stored size: 819 Bytes
Contents
module Apartment module Migrator extend self # Migrate to latest def migrate(database) Database.process(database) do ActiveRecord::Migrator.migrate(ActiveRecord::Migrator.migrations_path, ENV["VERSION"] ? ENV["VERSION"].to_i : nil) do |migration| ENV["SCOPE"].blank? || (ENV["SCOPE"] == migration.scope) end end end # Migrate up/down to a specific version def run(direction, database, version) Database.process(database){ ActiveRecord::Migrator.run(direction, ActiveRecord::Migrator.migrations_path, version) } end # rollback latest migration `step` number of times def rollback(database, step = 1) Database.process(database){ ActiveRecord::Migrator.rollback(ActiveRecord::Migrator.migrations_path, step) } end end end
Version data entries
11 entries across 11 versions & 1 rubygems