module

Interro::Migrations

Constants

ALL_MIGRATIONS = Dir["db/migrations/**/*.sql"].map do |path| filename = File.basename(File.dirname(path)) timestamp, name = filename.split("-") time = Time.parse_utc(timestamp, "%Y_%m_%d_%H_%M_%S_%9N") migration = ( __temp_39d19f95_1 = name __temp_39d19f95_2 = NAME_MAP __temp_39d19f95_2[__temp_39d19f95_1]? || (__temp_39d19f95_2[__temp_39d19f95_1] = Migration.new(name, time)) ) if path.ends_with?("up.sql") migration.up = File.read(path) elsif path.ends_with?("down.sql") migration.down = File.read(path) else raise("Migration files must be named up.sql or down.sql") end SchemaMigration.new(name, time) end.uniq
MigrationLog = ::Log.for("migrations", level: :info)
NAME_MAP = {} of String => Migration
TIME_FORMAT = Time::Format::ISO_8601_DATE_TIME

Class methods

call(args : Array(String))
Source
completed_migrations
Source
ensure_migration_table_exists
Source
redo(migration : Nil)
Source
redo(migration : SchemaMigration)
Source
rollback(migration : Nil)
Source
rollback(migration : SchemaMigration)
Source
run(migration : Nil)
Source
run(migration : SchemaMigration)
Source

Nested types