123456789_123456789_123456789_123456789_123456789_

Class: ActiveRecord::ConnectionAdapters::PostgreSQL::UniqueConstraintDefinition

Relationships & Source Files
Inherits: Struct
  • ::Object
Defined in: activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb

Instance Attribute Summary

Instance Method Summary

Instance Attribute Details

#column (rw)

[ GitHub ]

  
# File 'activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb', line 214

UniqueConstraintDefinition = Struct.new(:table_name, :column, :options)

#export_name_on_schema_dump?Boolean (readonly)

[ GitHub ]

  
# File 'activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb', line 227

def export_name_on_schema_dump?
  !ActiveRecord::SchemaDumper.unique_ignore_pattern.match?(name) if name
end

#options (rw)

[ GitHub ]

  
# File 'activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb', line 214

UniqueConstraintDefinition = Struct.new(:table_name, :column, :options)

#table_name (rw)

[ GitHub ]

  
# File 'activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb', line 214

UniqueConstraintDefinition = Struct.new(:table_name, :column, :options)

Instance Method Details

#deferrable

[ GitHub ]

  
# File 'activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb', line 219

def deferrable
  options[:deferrable]
end

#defined_for?(name: nil, column: nil, **options) ⇒ Boolean

[ GitHub ]

  
# File 'activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb', line 231

def defined_for?(name: nil, column: nil, **options)
  (name.nil? || self.name == name.to_s) &&
    (column.nil? || Array(self.column) == Array(column).map(&:to_s)) &&
    options.all? { |k, v| self.options[k].to_s == v.to_s }
end

#name

[ GitHub ]

  
# File 'activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb', line 215

def name
  options[:name]
end

#using_index

[ GitHub ]

  
# File 'activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb', line 223

def using_index
  options[:using_index]
end