abstract class Marten::DB::Migration::Operation::Base
- Marten::DB::Migration::Operation::Base
- Reference
- Object
Overview
Base abstract class for migration operations.
A migration operation is responsible for (i) mutating project states in order to identify changes to a given set of models and (ii) mutating actual databases (applying or unapplying a given operation at the database level).
Included Modules
Direct Known Subclasses
- Marten::DB::Migration::Operation::AddColumn
- Marten::DB::Migration::Operation::AddIndex
- Marten::DB::Migration::Operation::AddUniqueConstraint
- Marten::DB::Migration::Operation::ChangeColumn
- Marten::DB::Migration::Operation::CreateTable
- Marten::DB::Migration::Operation::DeleteTable
- Marten::DB::Migration::Operation::ExecuteSQL
- Marten::DB::Migration::Operation::RemoveColumn
- Marten::DB::Migration::Operation::RemoveIndex
- Marten::DB::Migration::Operation::RemoveUniqueConstraint
- Marten::DB::Migration::Operation::RenameColumn
- Marten::DB::Migration::Operation::RenameTable
- Marten::DB::Migration::Operation::RunCode
Defined in:
marten/db/migration/operation/base.crInstance Method Summary
-
#describe : String
Returns a human-friendly description of what the operation is doing.
-
#faked=(faked : Bool)
Allows to set whether or not the mutation should be faked.
-
#faked? : Bool
Returns
true
if the mutation should be faked. -
#mutate_db_backward(app_label : String, schema_editor : Management::SchemaEditor::Base, from_state : Management::ProjectState, to_state : Management::ProjectState) : Nil
Applies the operation in a backward way at the database level.
-
#mutate_db_forward(app_label : String, schema_editor : Management::SchemaEditor::Base, from_state : Management::ProjectState, to_state : Management::ProjectState) : Nil
Applies the operation at the database level.
-
#mutate_state_forward(app_label : String, state : Management::ProjectState) : Nil
Applies the operation at the project state level.
-
#optimize(operation : Base) : Optimization::Result
Combines the specified operation with the current one and return an array of corresponding operations.
-
#references_column?(other_table_name : String, other_column_name : String) : Bool
Returns
true
if the operation references the specified table column. -
#references_table?(other_table_name : String) : Bool
Returns
true
if the operation references the specified table. -
#serialize : String
Renders a serialized version of the mutation.
Instance methods inherited from module Marten::DB::CanFormatStringsOrSymbols
format_string_or_symbol(value : String)
format_string_or_symbol
Instance Method Detail
Returns a human-friendly description of what the operation is doing.
Applies the operation in a backward way at the database level.
For most operation, this will involve "unapplying" whatever was done as part of the #mutate_db_forward
method.
Applies the operation at the database level.
Applies the operation at the project state level.
Combines the specified operation with the current one and return an array of corresponding operations.
Returns true
if the operation references the specified table column.
Returns true
if the operation references the specified table.
Renders a serialized version of the mutation.
This method is used when generating migrations: the serialized operation is inserted in the #plan
method
of the generated migration.