Module: ActiveRecord::ConnectionAdapters::SQLServer::ColumnMethods
- Included in:
- Table, TableDefinition
- Defined in:
- lib/active_record/connection_adapters/sqlserver/table_definition.rb
Instance Method Summary collapse
- #binary_basic(*names, **options) ⇒ Object
- #char(*names, **options) ⇒ Object
- #datetime(*names, **options) ⇒ Object
- #datetime2(*names, **options) ⇒ Object
- #datetimeoffset(*names, **options) ⇒ Object
- #json(*names, **options) ⇒ Object
- #money(*names, **options) ⇒ Object
- #nchar(*names, **options) ⇒ Object
- #ntext(*names, **options) ⇒ Object
- #primary_key(name, type = :primary_key, **options) ⇒ Object
- #primary_key_nonclustered(*names, **options) ⇒ Object
- #real(*names, **options) ⇒ Object
- #smalldatetime(*names, **options) ⇒ Object
- #smallmoney(*names, **options) ⇒ Object
- #ss_timestamp(*names, **options) ⇒ Object
- #text_basic(*names, **options) ⇒ Object
- #uuid(*names, **options) ⇒ Object
- #varbinary(*names, **options) ⇒ Object
- #varchar(*names, **options) ⇒ Object
- #varchar_max(*names, **options) ⇒ Object
Instance Method Details
#binary_basic(*names, **options) ⇒ Object
78 79 80 |
# File 'lib/active_record/connection_adapters/sqlserver/table_definition.rb', line 78 def binary_basic(*names, **) names.each { |name| column(name, :binary_basic, **) } end |
#char(*names, **options) ⇒ Object
54 55 56 |
# File 'lib/active_record/connection_adapters/sqlserver/table_definition.rb', line 54 def char(*names, **) names.each { |name| column(name, :char, **) } end |
#datetime(*names, **options) ⇒ Object
32 33 34 35 36 37 38 39 40 |
# File 'lib/active_record/connection_adapters/sqlserver/table_definition.rb', line 32 def datetime(*names, **) names.each do |name| if [:precision] datetime2(name, **) else column(name, :datetime, **) end end end |
#datetime2(*names, **options) ⇒ Object
42 43 44 |
# File 'lib/active_record/connection_adapters/sqlserver/table_definition.rb', line 42 def datetime2(*names, **) names.each { |name| column(name, :datetime2, **) } end |
#datetimeoffset(*names, **options) ⇒ Object
46 47 48 |
# File 'lib/active_record/connection_adapters/sqlserver/table_definition.rb', line 46 def datetimeoffset(*names, **) names.each { |name| column(name, :datetimeoffset, **) } end |
#json(*names, **options) ⇒ Object
94 95 96 |
# File 'lib/active_record/connection_adapters/sqlserver/table_definition.rb', line 94 def json(*names, **) names.each { |name| column(name, :text, **) } end |
#money(*names, **options) ⇒ Object
24 25 26 |
# File 'lib/active_record/connection_adapters/sqlserver/table_definition.rb', line 24 def money(*names, **) names.each { |name| column(name, :money, **) } end |
#nchar(*names, **options) ⇒ Object
70 71 72 |
# File 'lib/active_record/connection_adapters/sqlserver/table_definition.rb', line 70 def nchar(*names, **) names.each { |name| column(name, :nchar, **) } end |
#ntext(*names, **options) ⇒ Object
74 75 76 |
# File 'lib/active_record/connection_adapters/sqlserver/table_definition.rb', line 74 def ntext(*names, **) names.each { |name| column(name, :ntext, **) } end |
#primary_key(name, type = :primary_key, **options) ⇒ Object
7 8 9 10 11 12 13 14 |
# File 'lib/active_record/connection_adapters/sqlserver/table_definition.rb', line 7 def primary_key(name, type = :primary_key, **) if [:integer, :bigint].include?(type) [:is_identity] = true unless .key?(:default) elsif type == :uuid [:default] = .fetch(:default, "NEWID()") end super end |
#primary_key_nonclustered(*names, **options) ⇒ Object
16 17 18 |
# File 'lib/active_record/connection_adapters/sqlserver/table_definition.rb', line 16 def primary_key_nonclustered(*names, **) names.each { |name| column(name, :primary_key_nonclustered, **) } end |
#real(*names, **options) ⇒ Object
20 21 22 |
# File 'lib/active_record/connection_adapters/sqlserver/table_definition.rb', line 20 def real(*names, **) names.each { |name| column(name, :real, **) } end |
#smalldatetime(*names, **options) ⇒ Object
28 29 30 |
# File 'lib/active_record/connection_adapters/sqlserver/table_definition.rb', line 28 def smalldatetime(*names, **) names.each { |name| column(name, :smalldatetime, **) } end |
#smallmoney(*names, **options) ⇒ Object
50 51 52 |
# File 'lib/active_record/connection_adapters/sqlserver/table_definition.rb', line 50 def smallmoney(*names, **) names.each { |name| column(name, :smallmoney, **) } end |
#ss_timestamp(*names, **options) ⇒ Object
90 91 92 |
# File 'lib/active_record/connection_adapters/sqlserver/table_definition.rb', line 90 def (*names, **) names.each { |name| column(name, :ss_timestamp, **) } end |
#text_basic(*names, **options) ⇒ Object
66 67 68 |
# File 'lib/active_record/connection_adapters/sqlserver/table_definition.rb', line 66 def text_basic(*names, **) names.each { |name| column(name, :text_basic, **) } end |
#uuid(*names, **options) ⇒ Object
86 87 88 |
# File 'lib/active_record/connection_adapters/sqlserver/table_definition.rb', line 86 def uuid(*names, **) names.each { |name| column(name, :uniqueidentifier, **) } end |
#varbinary(*names, **options) ⇒ Object
82 83 84 |
# File 'lib/active_record/connection_adapters/sqlserver/table_definition.rb', line 82 def varbinary(*names, **) names.each { |name| column(name, :varbinary, **) } end |
#varchar(*names, **options) ⇒ Object
58 59 60 |
# File 'lib/active_record/connection_adapters/sqlserver/table_definition.rb', line 58 def varchar(*names, **) names.each { |name| column(name, :varchar, **) } end |
#varchar_max(*names, **options) ⇒ Object
62 63 64 |
# File 'lib/active_record/connection_adapters/sqlserver/table_definition.rb', line 62 def varchar_max(*names, **) names.each { |name| column(name, :varchar_max, **) } end |