123456789_123456789_123456789_123456789_123456789_

Class: ActiveRecord::ConnectionAdapters::PostgreSQL::TableDefinition

Overview

Active Record PostgreSQL Adapter Table Definition

Class Method Summary

Instance Attribute Summary

Instance Method Summary

ColumnMethods - Included

::ActiveRecord::ConnectionAdapters::TableDefinition - Inherited

#[]

Returns a ::ActiveRecord::ConnectionAdapters::ColumnDefinition for the column with name name.

#belongs_to
#blob, #check_constraint,
#column

Instantiates a new column for the table.

#columns

Returns an array of ::ActiveRecord::ConnectionAdapters::ColumnDefinition objects for the columns of the table.

#foreign_key,
#index

Adds index options to the indexes hash, keyed by column name This is primarily used to track indexes that need to be created after the table.

#numeric,
#references

Adds a reference.

#remove_column

remove the column name from the table.

#set_primary_key,
#timestamps

Appends :datetime columns :created_at and :updated_at to the table.

::ActiveRecord::ConnectionAdapters::ColumnMethods - Included

#column

Appends a column or columns of a specified type.

#primary_key

Appends a primary key definition to the table definition.

Constructor Details

.newTableDefinition

[ GitHub ]

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

def initialize(*, **)
  super
  @exclusion_constraints = []
  @unique_constraints = []
  @unlogged = ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.create_unlogged_tables
end

Instance Attribute Details

#exclusion_constraints (readonly)

[ GitHub ]

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

attr_reader :exclusion_constraints, :unique_constraints, :unlogged

#unique_constraints (readonly)

[ GitHub ]

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

attr_reader :exclusion_constraints, :unique_constraints, :unlogged

#unlogged (readonly)

[ GitHub ]

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

attr_reader :exclusion_constraints, :unique_constraints, :unlogged

Instance Method Details

#exclusion_constraint(expression, **options)

[ GitHub ]

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

def exclusion_constraint(expression, **options)
  exclusion_constraints << new_exclusion_constraint_definition(expression, options)
end

#unique_constraint(column_name, **options)

[ GitHub ]

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

def unique_constraint(column_name, **options)
  unique_constraints << new_unique_constraint_definition(column_name, options)
end