class

Ralph::Migrations::Migrator

Inherits Reference / Object

Constants

DEFAULT_MIGRATIONS_DIR = "./db/migrations"

Default migrations directory

Constructors

new(database : Database::Backend, migrations_dir : String = DEFAULT_MIGRATIONS_DIR, output : IO = STDOUT)
Source

Class methods

create(name : String, dir : String = DEFAULT_MIGRATIONS_DIR) : String

Create a new migration file

Returns the path to the created file.

Source

Instance methods

all_migrations

Get all available migrations (from filesystem)

Source
applied_migrations

Get applied migrations (in applied order)

Source
applied_versions

Get all applied migration versions

Source
current_version

Get current (latest applied) version

Source
database

The database backend

Source
migrate

Run all pending migrations

Returns the number of migrations executed.

Source
migrations_dir

Path to migrations directory

Source
output

Output for status messages

Source
output=(output : IO)

Output for status messages

Source
pending_migrations

Get pending migrations (not yet applied)

Source
rollback(steps : Int32 = 1) : Int32

Roll back the last applied migration

Returns true if a migration was rolled back.

Source
rollback_all

Roll back all migrations

Source
status

Get migration status as version => applied?

Source