MG::Base
Inherits Reference < Object
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
Class methods
Instance methods
after_down(db : DB::Connection)
Optional lifecycle method.
Overwrite this method to execute Crystal code after running the down query.
after_up(db : DB::Connection)
Optional lifecycle method.
Overwrite this method to execute Crystal code after running the up query.