Class: ActiveRecord::ConnectionAdapters::OracleConstraint
Constant Summary
collapse
- PRIMARY_KEY_TYPE =
"P"
- FOREIGN_KEY_TYPE =
"R"
- UNIQUE_KEY_TYPE =
"U"
- CHECK_CONSTRAINT_TYPE =
"C"
Instance Attribute Summary
#column_names, #constraint_name, #constraint_type, #referenced_column_names, #referenced_table_name, #table_name, #table_schema
Instance Method Summary
collapse
#raise_subclass_responsibility_error
Constructor Details
#initialize(constraint_name, constraint_type, table_name, column_name, referenced_constraint_name, referenced_table_name, referenced_column_name, delete_rule) ⇒ OracleConstraint
Returns a new instance of OracleConstraint.
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/connection_adapters/oracle_adapter.rb', line 29
def initialize(constraint_name, constraint_type, table_name, column_name,
referenced_constraint_name, referenced_table_name, referenced_column_name, delete_rule)
@constraint_name = constraint_name
@table_schema = table_schema
@table_name = table_name
@constraint_type = constraint_type
@column_names = [column_name]
@referenced_table_name = referenced_table_name
@referenced_column_names = [ referenced_column_name ] if referenced_column_name
@delete_rule = delete_rule
end
|
Instance Method Details
#foreign_key? ⇒ Boolean
49
50
51
|
# File 'lib/connection_adapters/oracle_adapter.rb', line 49
def foreign_key?
constraint_type == FOREIGN_KEY_TYPE
end
|
#is_foreign_constraint?(table_name) ⇒ Boolean
41
42
43
|
# File 'lib/connection_adapters/oracle_adapter.rb', line 41
def is_foreign_constraint?(table_name)
@table_name.upcase != table_name.upcase
end
|
#primary_key? ⇒ Boolean
45
46
47
|
# File 'lib/connection_adapters/oracle_adapter.rb', line 45
def primary_key?
constraint_type == PRIMARY_KEY_TYPE
end
|
#unique_key? ⇒ Boolean
53
54
55
|
# File 'lib/connection_adapters/oracle_adapter.rb', line 53
def unique_key?
constraint_type == UNIQUE_KEY_TYPE
end
|