class ActiveRecord::ConnectionAdapters::SQLServer::Column
Public Class Methods
Source
# File lib/active_record/connection_adapters/sqlserver_column.rb, line 9 def initialize(*, is_identity: nil, is_primary: nil, table_name: nil, ordinal_position: nil, **) super @is_identity = is_identity @is_primary = is_primary @table_name = table_name @ordinal_position = ordinal_position end
Calls superclass method
Public Instance Methods
Source
# File lib/active_record/connection_adapters/sqlserver_column.rb, line 50 def ==(other) other.is_a?(Column) && super && is_identity? == other.is_identity? && is_primary? == other.is_primary? && table_name == other.table_name && ordinal_position == other.ordinal_position end
Calls superclass method
Also aliased as: eql?
Source
# File lib/active_record/connection_adapters/sqlserver_column.rb, line 30 def case_sensitive? collation && collation.match(/_CS/) end
Source
# File lib/active_record/connection_adapters/sqlserver_column.rb, line 42 def encode_with(coder) coder["is_identity"] = @is_identity coder["is_primary"] = @is_primary coder["table_name"] = @table_name coder["ordinal_position"] = @ordinal_position super end
Calls superclass method
Source
# File lib/active_record/connection_adapters/sqlserver_column.rb, line 60 def hash Column.hash ^ super.hash ^ is_identity?.hash ^ is_primary?.hash ^ table_name.hash ^ ordinal_position.hash end
Calls superclass method
Source
# File lib/active_record/connection_adapters/sqlserver_column.rb, line 34 def init_with(coder) @is_identity = coder["is_identity"] @is_primary = coder["is_primary"] @table_name = coder["table_name"] @ordinal_position = coder["ordinal_position"] super end
Calls superclass method
Source
# File lib/active_record/connection_adapters/sqlserver_column.rb, line 17 def is_identity? is_identity end
Also aliased as: auto_incremented_by_db?
Source
# File lib/active_record/connection_adapters/sqlserver_column.rb, line 22 def is_primary? is_primary end
Source
# File lib/active_record/connection_adapters/sqlserver_column.rb, line 26 def is_utf8? sql_type =~ /nvarchar|ntext|nchar/i end
Private Instance Methods
Source
# File lib/active_record/connection_adapters/sqlserver_column.rb, line 75 def deduplicated @name = -name @sql_type_metadata = sql_type_metadata.deduplicate if sql_type_metadata @default = (default.is_a?(String) ? -default : default.dup.freeze) if default @default_function = -default_function if default_function @collation = -collation if collation @comment = -comment if comment freeze end
In the Rails version of this method there is an assumption that the ‘default` value will always be a `String` class, which must be true for the MySQL/PostgreSQL/SQLite adapters. However, in the SQL Server adapter the `default` value can also be Boolean/Date/Time/etc. Changed the implementation of this method to handle non-String `default` objects.