abstract class MG::Base

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.cr

Class Method Summary

Instance Method Summary

Class Method Detail

def self.versions : Array(Version) #

Lists all versions available. The versions are sorted by version number.


[View source]

Instance Method Detail

def after_down(db : DB::Connection) #

Optional lifecycle method. Overwrite this method to execute Crystal code after running the down query.


[View source]
def after_up(db : DB::Connection) #

Optional lifecycle method. Overwrite this method to execute Crystal code after running the up query.


[View source]