abstract class Marten::DB::Migration

Included Modules

Defined in:

marten/db/migration.cr
marten/db/migration/dsl.cr
marten/db/migration/dsl/create_table.cr
marten/db/migration/operation/add_column.cr
marten/db/migration/operation/add_index.cr
marten/db/migration/operation/add_unique_constraint.cr
marten/db/migration/operation/base.cr
marten/db/migration/operation/change_column.cr
marten/db/migration/operation/create_table.cr
marten/db/migration/operation/delete_table.cr
marten/db/migration/operation/execute_sql.cr
marten/db/migration/operation/optimization/result.cr
marten/db/migration/operation/optimization/result_type.cr
marten/db/migration/operation/remove_column.cr
marten/db/migration/operation/remove_index.cr
marten/db/migration/operation/remove_unique_constraint.cr
marten/db/migration/operation/rename_column.cr
marten/db/migration/operation/rename_table.cr
marten/db/migration/operation/run_code.cr

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new #

[View source]

Class Method Detail

def self.atomic(atomic : Bool) #

Allows to specify whether the whole migration should run inside a single transaction or not.

By default, for databases that support DDL transactions, each migration will run inside a single transaction. This can be disabled on a per-migration basis, which can be useful is the migration is intended to affect large tables or when performing data migrations.


[View source]
def self.atomic? : Bool #

[View source]
def self.depends_on(app_name : String | Symbol, migration_name : String | Symbol) #

Allows to specify the dependencies of the current migration.

This class method takes an app_name and a .migration_name as argument and adds the corresponding migration to the list of migration dependencies of the current migration.


[View source]
def self.depends_on #

[View source]
def self.id #

[View source]
def self.migration_name #

[View source]
def self.replacement_ids #

[View source]
def self.replaces(app_name : String | Symbol, migration_name : String | Symbol) #

Allows to specify the migrations the current migration is replacing.

This class method takes an app_name and a .migration_name as argument and adds the corresponding migration to the list of migration replaced by the current migration.


[View source]
def self.replaces #

[View source]

Instance Method Detail

def apply #

[View source]
def apply_backward(pre_forward_project_state : Management::ProjectState, project_state : Management::ProjectState, schema_editor : Management::SchemaEditor::Base) #

[View source]
def apply_forward(project_state : Management::ProjectState, schema_editor : Management::SchemaEditor::Base) #

[View source]
def atomic? #

[View source]
def id #

[View source]
def mutate_state_forward(project_state : Management::ProjectState, preserve = true) #

[View source]
def plan #

[View source]
def unapply #

[View source]