abstract class MG::Base
- MG::Base
- Reference
- Object
Overview
All user defined versions must inherite from this class, and implement
the up
and down
methods.
class CreateUser < MG::Base
def up : String
<<-SQL
CREATE TABLE users (
username TEXT NOT NULL,
password TEXT NOT NULL,
email TEXT NOT NULL
);
CREATE UNIQUE INDEX user_idx ON users (username);
SQL
end
def down : String
<<-SQL
DROP TABLE users;
SQL
end
end
Defined in:
mg/base.crClass Method Summary
-
.versions : Array(Version)
Lists all versions available.
Instance Method Summary
-
#after_down(db : DB::Connection)
Optional lifecycle method.
-
#after_up(db : DB::Connection)
Optional lifecycle method.
Class Method Detail
Lists all versions available. The versions are sorted by version number.
Instance Method Detail
def after_down(db : DB::Connection)
#
Optional lifecycle method.
Overwrite this method to execute Crystal code after running the down
query.
def after_up(db : DB::Connection)
#
Optional lifecycle method.
Overwrite this method to execute Crystal code after running the up
query.