Class: ActiveRecord::ConnectionAdapters::SQLServer::TableDefinition
- Inherits:
-
TableDefinition
- Object
- TableDefinition
- ActiveRecord::ConnectionAdapters::SQLServer::TableDefinition
- Includes:
- ColumnMethods
- Defined in:
- lib/active_record/connection_adapters/sqlserver/table_definition.rb
Instance Method Summary collapse
Methods included from ColumnMethods
#binary_basic, #char, #datetime, #datetime2, #datetimeoffset, #json, #money, #nchar, #ntext, #primary_key, #primary_key_nonclustered, #real, #smalldatetime, #smallmoney, #ss_timestamp, #text_basic, #uuid, #varbinary, #varchar, #varchar_max
Instance Method Details
#new_column_definition(name, type, **options) ⇒ Object
102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/active_record/connection_adapters/sqlserver/table_definition.rb', line 102 def new_column_definition(name, type, **) case type when :datetime, :timestamp # If no precision then default it to 6. [:precision] = 6 unless .key?(:precision) # If there is precision then column must be of type 'datetime2'. type = :datetime2 unless [:precision].nil? when :primary_key [:is_identity] = true end super end |