class Marten::DB::Migration::Operation::AddColumn

Defined in:

marten/db/migration/operation/add_column.cr

Constructors

Instance Method Summary

Instance methods inherited from class Marten::DB::Migration::Operation::Base

describe : String describe, faked=(faked : Bool) faked=, faked? : Bool faked?, mutate_db_backward(app_label : String, schema_editor : Management::SchemaEditor::Base, from_state : Management::ProjectState, to_state : Management::ProjectState) : Nil mutate_db_backward, mutate_db_forward(app_label : String, schema_editor : Management::SchemaEditor::Base, from_state : Management::ProjectState, to_state : Management::ProjectState) : Nil mutate_db_forward, mutate_state_forward(app_label : String, state : Management::ProjectState) : Nil mutate_state_forward, optimize(operation : Base) : Optimization::Result optimize, references_column?(other_table_name : String, other_column_name : String) : Bool references_column?, references_table?(other_table_name : String) : Bool references_table?, serialize : String serialize

Instance methods inherited from module Marten::DB::CanFormatStringsOrSymbols

format_string_or_symbol(value : String) format_string_or_symbol

Constructor Detail

def self.new(table_name : String | Symbol, column : Management::Column::Base) #

[View source]

Instance Method Detail


[View source]
def describe : String #
Description copied from class Marten::DB::Migration::Operation::Base

Returns a human-friendly description of what the operation is doing.


[View source]
def mutate_db_backward(app_label : String, schema_editor : Management::SchemaEditor::Base, from_state : Management::ProjectState, to_state : Management::ProjectState) : Nil #
Description copied from class Marten::DB::Migration::Operation::Base

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.


[View source]
def mutate_db_forward(app_label : String, schema_editor : Management::SchemaEditor::Base, from_state : Management::ProjectState, to_state : Management::ProjectState) : Nil #
Description copied from class Marten::DB::Migration::Operation::Base

Applies the operation at the database level.


[View source]
def mutate_state_forward(app_label : String, state : Management::ProjectState) : Nil #
Description copied from class Marten::DB::Migration::Operation::Base

Applies the operation at the project state level.


[View source]
def optimize(operation : Base) : Optimization::Result #
Description copied from class Marten::DB::Migration::Operation::Base

Combines the specified operation with the current one and return an array of corresponding operations.


[View source]
def references_column?(other_table_name : String, other_column_name : String) : Bool #
Description copied from class Marten::DB::Migration::Operation::Base

Returns true if the operation references the specified table column.


[View source]
def references_table?(other_table_name : String) : Bool #
Description copied from class Marten::DB::Migration::Operation::Base

Returns true if the operation references the specified table.


[View source]
def serialize : String #
Description copied from class Marten::DB::Migration::Operation::Base

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.


[View source]
def table_name : String #

[View source]