class Marten::DB::Management::Constraint::Unique

Overview

Represents a unique constraint used when creating or altering tables.

Included Modules

Defined in:

marten/db/management/constraint/unique.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.from(unique_constraint : DB::Constraint::Unique) : Unique #

Returns a management unique constraint from a unique constraint definition.


[View source]
def self.new(name : String | Symbol, column_names : Array(String | Symbol)) #

[View source]

Instance Method Detail

def ==(other : self) #

Returns true if the other unique constraint corresponds to the same unique constraint configuration.


[View source]
def clone #

Returns a copy of the unique constraint.


[View source]
def column_names : Array(String) #

Returns the column names that are part of the unique constraint.


[View source]
def name : String #

Returns the unique constraint name.


[View source]
def serialize_args : String #

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

The returned string will be used in the context of add_unique_constraint / unique_constraint statements in generated migrations.


[View source]