class MG::Migration
- MG::Migration
- Reference
- Object
Defined in:
mg/migration.crConstructors
-
.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.
Instance Method Summary
-
#migrate(*, to : Int32 = -1)
Migrates to a specific version.
-
#user_version
Returns the current schema version.
-
#versions
Lists the available versions for the current migration.
Constructor Detail
def self.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.
Instance Method Detail
def migrate(*, to : Int32 = -1)
#
Migrates to a specific version. When to
is negative, migrates to the
latest version available.