Class: ActiveRecord::ConnectionAdapters::PostgreSQLConstraint
- Inherits:
-
AbstractTableConstraint
- Object
- AbstractTableConstraint
- ActiveRecord::ConnectionAdapters::PostgreSQLConstraint
- Defined in:
- lib/connection_adapters/postgresql_adapter.rb
Constant Summary
Constants inherited from AbstractTableConstraint
AbstractTableConstraint::CHECK_CONSTRAINT_TYPE, AbstractTableConstraint::FOREIGN_KEY_TYPE, AbstractTableConstraint::PRIMARY_KEY_TYPE, AbstractTableConstraint::UNIQUE_KEY_TYPE
Instance Attribute Summary
Attributes inherited from AbstractTableConstraint
#column_name, #constraint_name, #constraint_type, #member_of_composite, #referenced_column_name, #referenced_table_name, #table_name, #table_schema
Instance Method Summary collapse
-
#initialize(constraint_name, table_catalog, table_schema, table_name, constraint_type, column_name, referenced_constraint_name, referenced_table_name, referenced_column_name, delete_rule, update_rule) ⇒ PostgreSQLConstraint
constructor
A new instance of PostgreSQLConstraint.
- #is_foreign_constraint?(table_name) ⇒ Boolean
Methods inherited from AbstractTableConstraint
#component_of_unique_key?, #foreign_key?, #is_member_of_composite?, #primary_key?, #raise_subclass_responsibility_error, #unique_key?
Constructor Details
#initialize(constraint_name, table_catalog, table_schema, table_name, constraint_type, column_name, referenced_constraint_name, referenced_table_name, referenced_column_name, delete_rule, update_rule) ⇒ PostgreSQLConstraint
Returns a new instance of PostgreSQLConstraint.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/connection_adapters/postgresql_adapter.rb', line 19 def initialize(constraint_name, table_catalog, table_schema, table_name, constraint_type, column_name, referenced_constraint_name, referenced_table_name, referenced_column_name, delete_rule, update_rule) @table_catalog = table_catalog @table_schema = table_schema @table_name = table_name @column_name = column_name @constraint_name = constraint_name @constraint_type = constraint_type @referenced_constraint_name = referenced_constraint_name @referenced_table_name = referenced_table_name @referenced_column_name = referenced_column_name @update_rule = update_rule @delete_rule = delete_rule end |
Instance Method Details
#is_foreign_constraint?(table_name) ⇒ Boolean
35 36 37 38 39 |
# File 'lib/connection_adapters/postgresql_adapter.rb', line 35 def is_foreign_constraint?(table_name) !@referenced_table_name.nil? && @referenced_table_name.upcase == table_name.upcase && @table_name.upcase != table_name.upcase end |