class

MG::Migration

Inherits Reference < Object

Constructors

new(db : DB::Database, *, tag : String | Nil = nil, version_table : String = "mg_version", version_column : String = "mg_version", log : Log | Nil = nil)

Instantiates a Migration object to migrate a DB.

  • tag: See Tags.
  • version_table: The name of the table to create to store the current schema version
  • version_column: The column in version_table that stores the current schema version

NOTE: In SQLite, version_table and version_column are ignored, because we can use the built-in user_version pragma to store the version.

Source

Instance methods

migrate(*, to : Int32 = -1)

Migrates to a specific version. When to is negative, migrates to the latest version available.

Source
user_version

Returns the current schema version.

Source
versions

Lists the available versions for the current migration.

Source