Class: ActiveRecord::ConnectionAdapters::AbstractTableConstraint
- Inherits:
-
Object
- Object
- ActiveRecord::ConnectionAdapters::AbstractTableConstraint
- Defined in:
- lib/connection_adapters/abstract_adapter.rb
Overview
This is abstract class serves as the template for table constraints from all databases compatible with the ISO SQL:2003 information schema standard
Direct Known Subclasses
IBM_DBConstraint, MysqlConstraint, OracleConstraint, PostgreSQLConstraint, SQLServerConstraint
Constant Summary collapse
- PRIMARY_KEY_TYPE =
"PRIMARY KEY"
- FOREIGN_KEY_TYPE =
"FOREIGN KEY"
- UNIQUE_KEY_TYPE =
"UNIQUE"
- CHECK_CONSTRAINT_TYPE =
"CHECK"
Instance Attribute Summary collapse
-
#column_names ⇒ Object
readonly
Returns the value of attribute column_names.
-
#constraint_name ⇒ Object
readonly
Returns the value of attribute constraint_name.
-
#constraint_type ⇒ Object
readonly
Returns the value of attribute constraint_type.
-
#referenced_column_names ⇒ Object
readonly
Returns the value of attribute referenced_column_names.
-
#referenced_table_name ⇒ Object
readonly
Returns the value of attribute referenced_table_name.
-
#table_name ⇒ Object
readonly
Returns the value of attribute table_name.
-
#table_schema ⇒ Object
readonly
Returns the value of attribute table_schema.
Instance Method Summary collapse
- #foreign_key? ⇒ Boolean
- #primary_key? ⇒ Boolean
- #raise_subclass_responsibility_error ⇒ Object (also: #initialize, #is_foreign_constraint?)
- #unique_key? ⇒ Boolean
Instance Attribute Details
#column_names ⇒ Object (readonly)
Returns the value of attribute column_names.
14 15 16 |
# File 'lib/connection_adapters/abstract_adapter.rb', line 14 def column_names @column_names end |
#constraint_name ⇒ Object (readonly)
Returns the value of attribute constraint_name.
14 15 16 |
# File 'lib/connection_adapters/abstract_adapter.rb', line 14 def constraint_name @constraint_name end |
#constraint_type ⇒ Object (readonly)
Returns the value of attribute constraint_type.
14 15 16 |
# File 'lib/connection_adapters/abstract_adapter.rb', line 14 def constraint_type @constraint_type end |
#referenced_column_names ⇒ Object (readonly)
Returns the value of attribute referenced_column_names.
14 15 16 |
# File 'lib/connection_adapters/abstract_adapter.rb', line 14 def referenced_column_names @referenced_column_names end |
#referenced_table_name ⇒ Object (readonly)
Returns the value of attribute referenced_table_name.
14 15 16 |
# File 'lib/connection_adapters/abstract_adapter.rb', line 14 def referenced_table_name @referenced_table_name end |
#table_name ⇒ Object (readonly)
Returns the value of attribute table_name.
14 15 16 |
# File 'lib/connection_adapters/abstract_adapter.rb', line 14 def table_name @table_name end |
#table_schema ⇒ Object (readonly)
Returns the value of attribute table_schema.
14 15 16 |
# File 'lib/connection_adapters/abstract_adapter.rb', line 14 def table_schema @table_schema end |
Instance Method Details
#foreign_key? ⇒ Boolean
30 31 32 |
# File 'lib/connection_adapters/abstract_adapter.rb', line 30 def foreign_key? constraint_type == FOREIGN_KEY_TYPE end |
#primary_key? ⇒ Boolean
26 27 28 |
# File 'lib/connection_adapters/abstract_adapter.rb', line 26 def primary_key? constraint_type == PRIMARY_KEY_TYPE end |
#raise_subclass_responsibility_error ⇒ Object Also known as: initialize, is_foreign_constraint?
19 20 21 |
# File 'lib/connection_adapters/abstract_adapter.rb', line 19 def raise_subclass_responsibility_error raise NotImplementedError, "AbstractTableConstraint subclass #{self.class} did not implement this method" end |
#unique_key? ⇒ Boolean
34 35 36 |
# File 'lib/connection_adapters/abstract_adapter.rb', line 34 def unique_key? constraint_type == UNIQUE_KEY_TYPE end |