Class: ActiveRecord::ConnectionAdapters::SQLServerConstraint

Inherits:
AbstractTableConstraint show all
Defined in:
lib/connection_adapters/sqlserver_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

Methods inherited from AbstractTableConstraint

#foreign_key?, #primary_key?, #raise_subclass_responsibility_error, #unique_key?

Constructor Details

#initialize(constraint_schema, table_name, column_name, constraint_name, constraint_type, referenced_constraint_name, referenced_table_name, referenced_column_name) ⇒ SQLServerConstraint

Returns a new instance of SQLServerConstraint.



27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/connection_adapters/sqlserver_adapter.rb', line 27

def initialize(constraint_schema, table_name, column_name, constraint_name, constraint_type, 
  referenced_constraint_name, referenced_table_name, referenced_column_name)
  @table_schema = table_schema
  @table_name = table_name
  @column_names = [column_name]
  @referenced_table_name = referenced_table_name
  @referenced_column_names = [referenced_column_name] if referenced_column_name
  @constraint_schema = constraint_schema
  @referenced_constraint_name = referenced_constraint_name 
  @constraint_name = constraint_name 
  @constraint_type = constraint_type
end

Instance Method Details

#is_foreign_constraint?(table_name) ⇒ Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/connection_adapters/sqlserver_adapter.rb', line 41

def is_foreign_constraint?(table_name)
  @table_name.upcase != table_name.upcase
end