Class: ActiveRecord::ConnectionAdapters::PostgreSQL::TableDefinition
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
|
|
Instance Chain:
|
|
Inherits: |
ActiveRecord::ConnectionAdapters::TableDefinition
|
Defined in: | activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb |
Overview
Active Record PostgreSQL Adapter Table Definition
Class Method Summary
- .new ⇒ TableDefinition constructor
::ActiveRecord::ConnectionAdapters::TableDefinition
- Inherited
Instance Attribute Summary
- #exclusion_constraints readonly
- #unique_constraints readonly
- #unlogged readonly
::ActiveRecord::ConnectionAdapters::TableDefinition
- Inherited
Instance Method Summary
- #exclusion_constraint(expression, **options)
- #unique_constraint(column_name, **options)
- #aliased_types(name, fallback) private
- #integer_like_primary_key_type(type, options) private
- #valid_column_definition_options private
- #new_column_definition(name, type, **options) Internal use only
- #new_exclusion_constraint_definition(expression, options) Internal use only
- #new_unique_constraint_definition(column_name, options) Internal use only
ColumnMethods
- Included
#bigserial, #bit, #bit_varying, #box, #cidr, #circle, #citext, #daterange, #enum, #hstore, #inet, #int4range, #int8range, #interval, #jsonb, #line, #lseg, #ltree, #macaddr, #money, #numrange, #oid, #path, #point, #polygon, | |
#primary_key | Defines the primary key field. |
#serial, #timestamptz, #tsrange, #tstzrange, #tsvector, #uuid, #xml |
::ActiveRecord::ConnectionAdapters::TableDefinition
- Inherited
#[] | Returns a |
#belongs_to | Alias for TableDefinition#references. |
#blob, #check_constraint, | |
#column | Instantiates a new column for the table. |
#columns | Returns an array of |
#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 |
#set_primary_key, | |
#timestamps | Appends |
#aliased_types, #create_column_definition, #integer_like_primary_key?, #integer_like_primary_key_type, #raise_on_duplicate_column, #valid_column_definition_options, #new_check_constraint_definition, #new_column_definition, #new_foreign_key_definition, #primary_keys |
::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
.new ⇒ TableDefinition
# 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
#aliased_types(name, fallback) (private)
[ GitHub ]# File 'activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb', line 287
def aliased_types(name, fallback) fallback end
#exclusion_constraint(expression, **options)
[ GitHub ]# File 'activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb', line 255
def exclusion_constraint(expression, ** ) exclusion_constraints << new_exclusion_constraint_definition(expression, ) end
#integer_like_primary_key_type(type, options) (private)
[ GitHub ]# File 'activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb', line 291
def integer_like_primary_key_type(type, ) if type == :bigint || [:limit] == 8 :bigserial else :serial end end
#new_column_definition(name, type, **options)
This method is for internal use only.
[ GitHub ]
# File 'activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb', line 273
def new_column_definition(name, type, ** ) # :nodoc: case type when :virtual type = [:type] end super end
#new_exclusion_constraint_definition(expression, options)
This method is for internal use only.
[ GitHub ]
# File 'activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb', line 263
def new_exclusion_constraint_definition(expression, ) # :nodoc: = @conn. (name, expression, ) ExclusionConstraintDefinition.new(name, expression, ) end
#new_unique_constraint_definition(column_name, options)
This method is for internal use only.
[ GitHub ]
# File 'activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb', line 268
def new_unique_constraint_definition(column_name, ) # :nodoc: = @conn. (name, column_name, ) UniqueConstraintDefinition.new(name, column_name, ) 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, ** ) unique_constraints << new_unique_constraint_definition(column_name, ) end
#valid_column_definition_options (private)
[ GitHub ]# File 'activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb', line 283
def super + [:array, :using, :cast_as, :as, :type, :enum_type, :stored] end