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

Macros inherited from module Marten::DB::Migration::DSL

add_column(table_name, *args, **kwargs) add_column, add_index(table_name, name, column_names) add_index, add_unique_constraint(table_name, name, column_names) add_unique_constraint, change_column(table_name, *args, **kwargs) change_column, create_table(name) create_table, delete_table(name) delete_table, execute(forward_sql, backward_sql = nil) execute, faked faked, remove_column(table_name, column_name) remove_column, remove_index(table_name, index_name) remove_index, remove_unique_constraint(table_name, constraint_name) remove_unique_constraint, rename_column(table_name, old_name, new_name) rename_column, rename_table(old_name, new_name) rename_table, run_code(forward_method)
run_code(forward_method, backward_method)
run_code

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]