Class: ActiveRecord::ConnectionAdapters::MSSQL::TableDefinition
- Inherits:
-
TableDefinition
- Object
- TableDefinition
- ActiveRecord::ConnectionAdapters::MSSQL::TableDefinition
show all
- Includes:
- ColumnMethods
- Defined in:
- lib/arjdbc/mssql/schema_definitions.rb
Instance Method Summary
collapse
#binary_basic, #char, #datetime_basic, #money, #nchar, #ntext, #primary_key, #real, #smalldatetime, #smallmoney, #text_basic, #uuid, #varbinary, #varchar, #varchar_max
Instance Method Details
#column(name, type, index: nil, **options) ⇒ Object
78
79
80
81
82
83
84
85
86
87
88
89
90
|
# File 'lib/arjdbc/mssql/schema_definitions.rb', line 78
def column(name, type, index: nil, **options)
if @conn.supports_datetime_with_precision?
if type == :datetime && !options.key?(:precision)
options[:precision] = 7
end
end
super
end
|
#new_column_definition(name, type, **options) ⇒ Object
93
94
95
96
97
98
99
100
101
102
|
# File 'lib/arjdbc/mssql/schema_definitions.rb', line 93
def new_column_definition(name, type, **options)
case type
when :primary_key
options[:is_identity] = true
when :datetime
options[:precision] = 7 if !options.key?(:precision) && @conn.supports_datetime_with_precision?
end
super
end
|
#timestamps(**options) ⇒ Object
104
105
106
107
108
|
# File 'lib/arjdbc/mssql/schema_definitions.rb', line 104
def timestamps(**options)
options[:precision] = 7 if !options.key?(:precision) && @conn.supports_datetime_with_precision?
super
end
|