class ActiveRecord::ConnectionAdapters::PostgreSQLConstraint

This is a base class for other PostgreSQL constraint classes. It isn’t really meant to be used directly.

Constants

DEFERRABLE_TYPES

Attributes

base[RW]
options[RW]

Private Instance Methods

assert_valid_deferrable_option(option) click to toggle source
# File lib/active_record/postgresql_extensions/constraints.rb, line 96
def assert_valid_deferrable_option option
  if !DEFERRABLE_TYPES.include?(option.to_s.downcase)
    raise ActiveRecord::InvalidDeferrableOption.new(option)
  end unless option.nil?
end
constraint_name() click to toggle source
# File lib/active_record/postgresql_extensions/constraints.rb, line 115
def constraint_name
  if options[:name]
    "CONSTRAINT #{base.quote_generic(options[:name])} "
  end
end
deferrable() click to toggle source
# File lib/active_record/postgresql_extensions/constraints.rb, line 102
def deferrable
  case options[:deferrable]
    when true
      ' DEFERRABLE'
    when false
      ' NOT DEFERRABLE'
    when nil
      ''
    else
      " DEFERRABLE INITIALLY #{options[:deferrable].to_s.upcase}"
  end
end
index_parameters()
Alias for: storage_parameters
no_inherit() click to toggle source
# File lib/active_record/postgresql_extensions/constraints.rb, line 146
def no_inherit
  if options[:no_inherit]
    " NO INHERIT"
  else
    ''
  end
end
not_valid() click to toggle source
# File lib/active_record/postgresql_extensions/constraints.rb, line 138
def not_valid
  if options[:not_valid]
    " NOT VALID"
  else
    ''
  end
end
storage_parameters() click to toggle source
# File lib/active_record/postgresql_extensions/constraints.rb, line 121
def storage_parameters
  if options[:index_parameters] || options[:storage_parameters]
    " WITH (#{options_from_hash_or_string(options[:index_parameters] || options[:storage_parameters])})"
  else
    ''
  end
end
Also aliased as: index_parameters
using_tablespace() click to toggle source
# File lib/active_record/postgresql_extensions/constraints.rb, line 130
def using_tablespace
  if options[:tablespace]
    " USING INDEX TABLESPACE #{base.quote_tablespace(options[:tablespace])}"
  else
    ''
  end
end