class Cql::Index

Overview

An index on a table This class represents an index on a table It provides methods for setting the columns and unique constraint It also provides methods for generating the index name

Example Creating a new index

schema.build do
  table :users do
    column :name, String
    column :email, String
    index [:name, :email], unique: true
  end
end

Defined in:

index.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(table : Table, columns : Array(Symbol), unique : Bool = false, name : String | Nil = nil) #

[View source]

Instance Method Detail

def columns : Array(Symbol) #

[View source]
def index_name #

[View source]
def name : String | Nil #

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

[View source]
def table : Table #

[View source]
def unique? : Bool #

[View source]