abstract class Marten::DB::Management::Column::Base

Overview

Abstract base migration column implementation.

Included Modules

Direct Known Subclasses

Defined in:

marten/db/management/column/base.cr

Constructors

Instance Method Summary

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

format_string_or_symbol(value : String) format_string_or_symbol

Constructor Detail

def self.new(name : ::String, primary_key : ::Bool = false, null : ::Bool = false, unique : ::Bool = false, index : ::Bool = false, default : ::DB::Any | Nil = nil) #

[View source]

Instance Method Detail

def ==(other : self) #

Returns true if the other column corresponds to the same column configuration.


[View source]
abstract def clone #

Returns a copy of the column.


[View source]
def default : Bool | Float32 | Float64 | Int32 | Int64 | Slice(UInt8) | String | Time | Nil #

[View source]
def index? : Bool #

Returns true if an index should be created at the database level for the column.


[View source]
def name : String #

[View source]
def name=(name : ::String) #

[View source]
def null? : Bool #

Returns a boolean indicating whether the column can be null or not.


[View source]
def primary_key=(primary_key : ::Bool) #

[View source]
def primary_key? : Bool #

Returns a boolean indicating whether the column is a primary key.


[View source]
def same_config?(other : Base) #

Returns true if the other column (which can have a different name) corresponds to the same configuration.


[View source]
def serialize_args : ::String #

Returns a serialized version of the column arguments to be used when generating migrations.

The returned string will be used in the context of add_column / column statements in generated migrations.


[View source]
abstract def sql_quoted_default_value(connection : Connection::Base) : ::String | Nil #

Returns the literal quoted value of the default value for a specific database connection.


[View source]
abstract def sql_type(connection : Connection::Base) : ::String #

Returns the raw type of the column to use for the column at hand and a specific database connection.


[View source]
def sql_type_suffix(connection : Connection::Base) : ::String | Nil #

Returns the raw type suffix of the column to use for the column at hand and a specific database connection.


[View source]
def type : ::String #

Returns the column type identifier.


[View source]
def unique? : Bool #

Returns a boolean indicating whether the column value should be unique throughout the associated table.


[View source]