abstract class Marten::DB::Migration
- Marten::DB::Migration
- Reference
- Object
Included Modules
Defined in:
marten/db/migration.crmarten/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
-
.atomic(atomic : Bool)
Allows to specify whether the whole migration should run inside a single transaction or not.
- .atomic : Bool
-
.depends_on(app_name : String | Symbol, migration_name : String | Symbol)
Allows to specify the dependencies of the current migration.
- .depends_on
- .id
- .migration_name
- .replacement_ids
-
.replaces(app_name : String | Symbol, migration_name : String | Symbol)
Allows to specify the migrations the current migration is replacing.
- .replaces
Instance Method Summary
- #apply
- #apply_backward(pre_forward_project_state : Management::ProjectState, project_state : Management::ProjectState, schema_editor : Management::SchemaEditor::Base)
- #apply_forward(project_state : Management::ProjectState, schema_editor : Management::SchemaEditor::Base)
- #atomic?
- #id
- #mutate_state_forward(project_state : Management::ProjectState, preserve = true)
- #plan
- #unapply
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
Class Method Detail
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.
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.
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.