class

Luna::BaseMigration

Inherits Reference < Object

Rails-ish migration base

Constructors

new(connection_name : Symbol = :default)
Source

Instance methods

add_column(table : Symbol | String, col : Symbol, type : Symbol, **opts)

---- Column helpers ----

Source
add_index(table : Symbol | String, cols : Symbol | Array(Symbol), unique : Bool = false, name : String | Nil = nil)

---- Index helpers ----

Source
change

---- Directional API (choose one style) ---- Implement either change (default) or up/down.

Source
change_table(name : Symbol | String, & : Migrations::ChangeTable -> )

change_table : yields a builder that just appends ALTERs

Source
connection_name
Source
create_table(name : Symbol | String, id : Bool | Symbol = true, force : Bool = false, & : Migrations::TableDefinition -> )

---- Table builder (Rails-like) ----

Source
down
Source
drop_table(name : Symbol | String)
Source
execute(sql : String)

---- SQL passthrough ----

Source
execute(sql : String, *params : DB::Any)
Source
remove_column(table : Symbol | String, col : Symbol)
Source
remove_index(table : Symbol | String, name : String | Nil = nil, columns : Array(Symbol) | Nil = nil)
Source
rename_column(table : Symbol | String, from : Symbol, to : Symbol)
Source
rename_table(from : Symbol | String, to : Symbol | String)

---- Table rename ----

Source