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_names, #constraint_name, #constraint_type, #referenced_column_names, #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
#foreign_key?, #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.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/connection_adapters/postgresql_adapter.rb', line 17 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_names = [column_name] @constraint_name = constraint_name @constraint_type = constraint_type @referenced_constraint_name = referenced_constraint_name @referenced_table_name = referenced_table_name @referenced_column_names = [referenced_column_name] if referenced_column_name @update_rule = update_rule @delete_rule = delete_rule end |
Instance Method Details
#is_foreign_constraint?(table_name) ⇒ Boolean
33 34 35 36 37 |
# File 'lib/connection_adapters/postgresql_adapter.rb', line 33 def is_foreign_constraint?(table_name) !@referenced_table_name.nil? && @referenced_table_name.upcase == table_name.upcase && @table_name.upcase != table_name.upcase end |