Class: ActiveRecord::ConnectionAdapters::TableDefinition

Inherits:
Object
  • Object
show all
Defined in:
lib/monkey_patch_postgres.rb

Overview

Patches associated with building check constraints.

Instance Method Summary collapse

Instance Method Details

#check_constraint(constraint) ⇒ Object

Builds a SQL check constraint

Parameters:

  • constraint (String)

    a SQL constraint



20
21
22
# File 'lib/monkey_patch_postgres.rb', line 20

def check_constraint(constraint)
  @columns << Struct.new(:to_sql).new("CHECK (#{constraint})")
end