abstract class Avram::Migrator::Migration::V1

Included Modules

Defined in:

avram/migrator/migration.cr

Instance Method Summary

Instance methods inherited from module Avram::Migrator::StatementHelpers

create_foreign_key(from : TableName, to : TableName, on_delete : Symbol, column : Symbol | Nil, primary_key = :id) create_foreign_key, create_function(name : String, body : String, returns : String = "trigger") create_function, create_index(table_name : TableName, columns : Columns, unique = false, using = :btree, name : String | Nil | Symbol | Nil = nil) create_index, create_sequence(table : TableName, column : Symbol) create_sequence, create_trigger(table_name : TableName, name : String, function_name : String, callback : Symbol = :before, on : Array(Symbol) = [:update]) create_trigger, disable_extension(name : String) disable_extension, drop(table_name, *, if_exists = false) drop, drop_foreign_key(from : TableName, references : TableName, column : Symbol | Nil) drop_foreign_key, drop_function(name : String) drop_function, drop_index(table_name : TableName, columns : Columns | Nil = nil, if_exists = false, on_delete = :do_nothing, name : String | Nil | Symbol | Nil = nil) drop_index, drop_sequence(table : TableName, column : Symbol) drop_sequence, drop_trigger(table_name : TableName, name : String) drop_trigger, enable_extension(name : String) enable_extension, make_optional(table : TableName, column : Symbol) make_optional, make_required(table : TableName, column : Symbol) make_required, update_extension(name : String, to : String | Nil = nil) update_extension

Macros inherited from module Avram::Migrator::StatementHelpers

alter(table_name, *, if_exists = false) alter, create(table_name, *, if_not_exists = false) create

Macros inherited from module Avram::TableFor

table_for(model) table_for

Instance methods inherited from module Avram::Migrator::IndexStatementHelpers

add_index(column : Symbol, unique = false, using : Symbol = :btree) add_index, index_added?(index : String, column : Symbol) index_added?

Instance methods inherited from class Object

blank_for_validates_required? : Bool blank_for_validates_required?

Instance Method Detail

def down(quiet = false) #

Same as #up except calls rollback method in migration.


[View source]
abstract def migrate #

[View source]
def migrated? #

[View source]
def pending? #

[View source]
def prepared_statements : Array(String) #

[View source]
def reset_prepared_statements #

[View source]
def up(quiet = false) #

Unless already migrated, calls migrate which in turn calls statement helpers to generate and collect SQL statements in the @prepared_statements array. Each statement is then executed in a transaction and tracked upon completion.


[View source]
abstract def version : Int64 #

[View source]