Class: ActiveRecord::ConnectionAdapters::PostgreSQL::UniqueKeyDefinition

Inherits:
Struct
  • Object
show all
Defined in:
lib/active_record/connection_adapters/postgresql/schema_definitions.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#columnObject

Returns the value of attribute column

Returns:

  • (Object)

    the current value of column



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

def column
  @column
end

#optionsObject

Returns the value of attribute options

Returns:

  • (Object)

    the current value of options



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

def options
  @options
end

#table_nameObject

Returns the value of attribute table_name

Returns:

  • (Object)

    the current value of table_name



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

def table_name
  @table_name
end

Instance Method Details

#deferrableObject



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

def deferrable
  options[:deferrable]
end

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

Returns:

  • (Boolean)


231
232
233
234
235
# File '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

#export_name_on_schema_dump?Boolean

Returns:

  • (Boolean)


227
228
229
# File '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

#nameObject



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

def name
  options[:name]
end

#using_indexObject



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

def using_index
  options[:using_index]
end