module Interro::Migrations
Defined in:
migrations.cr
Constant Summary
-
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_83 = name
__temp_84 = NAME_MAP
__temp_84[__temp_83]? || (__temp_84[__temp_83] = Migration.new(name, time))
)
if path.ends_with?("up.sql")
migration.up = File.read(path)
else
if path.ends_with?("down.sql")
migration.down = File.read(path)
else
raise("Migration files must be named up.sql or down.sql")
end
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 Method Summary
Class Method Detail
def self.
call(args : Array(String))
#
def self.
completed_migrations
#
def self.
ensure_migration_table_exists
#
def self.
redo(migration : Nil)
#
def self.
rollback(migration : Nil)
#
def self.
run(migration : Nil)
#