Class: ActiveRecord::ConnectionAdapters::PostgreSQL::Table
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
|
|
Instance Chain:
|
|
Inherits: |
ActiveRecord::ConnectionAdapters::Table
|
Defined in: | activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb |
Overview
Active Record PostgreSQL Adapter Table
Class Method Summary
::ActiveRecord::ConnectionAdapters::Table
- Inherited
Instance Attribute Summary
::ActiveRecord::ConnectionAdapters::Table
- Inherited
Instance Method Summary
-
#exclusion_constraint(*args)
Adds an exclusion constraint.
-
#remove_exclusion_constraint(*args)
Removes the given exclusion constraint from the table.
-
#remove_unique_constraint(*args)
Removes the given unique constraint from the table.
-
#unique_constraint(*args)
Adds a unique constraint.
-
#validate_check_constraint(*args)
Validates the given check constraint on the table.
-
#validate_constraint(*args)
Validates the given constraint on the table.
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::Table
- Inherited
#belongs_to | Alias for Table#references. |
#blob, | |
#change | Changes the column’s definition according to the new options. |
#change_default | Sets a new default value for a column. |
#change_null | Sets or removes a NOT NULL constraint on a column. |
#check_constraint | Adds a check constraint. |
#check_constraint_exists? | Checks if a check_constraint exists on a table. |
#column | Adds a new column to the named table. |
#column_exists? | Checks to see if a column exists. |
#foreign_key | Adds a foreign key to the table using a supplied table name. |
#foreign_key_exists? | Checks to see if a foreign key exists. |
#index | Adds a new index to the table. |
#index_exists? | Checks to see if an index exists. |
#numeric, | |
#references | Adds a reference. |
#remove | Removes the column(s) from the table definition. |
#remove_belongs_to | Alias for Table#remove_references. |
#remove_check_constraint | Removes the given check constraint from the table. |
#remove_foreign_key | Removes the given foreign key from the table. |
#remove_index | Removes the given index from the table. |
#remove_references | Removes a reference. |
#remove_timestamps | Removes the timestamp columns ( |
#rename | Renames a column. |
#rename_index | Renames the given index on the table. |
#timestamps | Adds timestamps ( |
#raise_on_if_exist_options |
::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
This class inherits a constructor from ActiveRecord::ConnectionAdapters::Table
Instance Method Details
#exclusion_constraint(*args)
Adds an exclusion constraint.
t.exclusion_constraint("price WITH =, availability_range WITH &&", using: :gist, name: "price_check")
# File 'activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb', line 309
def exclusion_constraint(*args) @base.add_exclusion_constraint(name, *args) end
#remove_exclusion_constraint(*args)
Removes the given exclusion constraint from the table.
t.remove_exclusion_constraint(name: "price_check")
# File 'activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb', line 318
def remove_exclusion_constraint(*args) @base.remove_exclusion_constraint(name, *args) end
#remove_unique_constraint(*args)
Removes the given unique constraint from the table.
t.remove_unique_constraint(name: "unique_position")
# File 'activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb', line 336
def remove_unique_constraint(*args) @base.remove_unique_constraint(name, *args) end
#unique_constraint(*args)
Adds a unique constraint.
t.unique_constraint(:position, name: 'unique_position', deferrable: :deferred, nulls_not_distinct: true)
# File 'activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb', line 327
def unique_constraint(*args) @base.add_unique_constraint(name, *args) end
#validate_check_constraint(*args)
Validates the given check constraint on the table
t.check_constraint("price > 0", name: "price_check", validate: false)
t.validate_check_constraint name: "price_check"
# File 'activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb', line 356
def validate_check_constraint(*args) @base.validate_check_constraint(name, *args) end
#validate_constraint(*args)
Validates the given constraint on the table.
t.check_constraint("price > 0", name: "price_check", validate: false)
t.validate_constraint "price_check"
# File 'activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb', line 346
def validate_constraint(*args) @base.validate_constraint(name, *args) end