activerecord-sqlserver-adapter 6.0.0.rc1 → 6.0.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (134) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.rubocop.yml +29 -0
  4. data/CHANGELOG.md +20 -0
  5. data/Gemfile +11 -5
  6. data/Guardfile +9 -8
  7. data/Rakefile +12 -16
  8. data/VERSION +1 -1
  9. data/activerecord-sqlserver-adapter.gemspec +3 -3
  10. data/lib/active_record/connection_adapters/sqlserver/core_ext/active_record.rb +0 -4
  11. data/lib/active_record/connection_adapters/sqlserver/core_ext/attribute_methods.rb +1 -4
  12. data/lib/active_record/connection_adapters/sqlserver/core_ext/calculations.rb +3 -4
  13. data/lib/active_record/connection_adapters/sqlserver/core_ext/explain.rb +1 -3
  14. data/lib/active_record/connection_adapters/sqlserver/core_ext/finder_methods.rb +2 -3
  15. data/lib/active_record/connection_adapters/sqlserver/core_ext/query_methods.rb +2 -3
  16. data/lib/active_record/connection_adapters/sqlserver/database_statements.rb +35 -32
  17. data/lib/active_record/connection_adapters/sqlserver/database_tasks.rb +7 -12
  18. data/lib/active_record/connection_adapters/sqlserver/errors.rb +0 -3
  19. data/lib/active_record/connection_adapters/sqlserver/quoting.rb +8 -8
  20. data/lib/active_record/connection_adapters/sqlserver/schema_creation.rb +0 -2
  21. data/lib/active_record/connection_adapters/sqlserver/schema_dumper.rb +7 -7
  22. data/lib/active_record/connection_adapters/sqlserver/schema_statements.rb +106 -103
  23. data/lib/active_record/connection_adapters/sqlserver/showplan.rb +6 -8
  24. data/lib/active_record/connection_adapters/sqlserver/showplan/printer_table.rb +2 -2
  25. data/lib/active_record/connection_adapters/sqlserver/showplan/printer_xml.rb +1 -1
  26. data/lib/active_record/connection_adapters/sqlserver/sql_type_metadata.rb +0 -2
  27. data/lib/active_record/connection_adapters/sqlserver/table_definition.rb +1 -4
  28. data/lib/active_record/connection_adapters/sqlserver/transaction.rb +4 -8
  29. data/lib/active_record/connection_adapters/sqlserver/type.rb +35 -35
  30. data/lib/active_record/connection_adapters/sqlserver/type/big_integer.rb +0 -2
  31. data/lib/active_record/connection_adapters/sqlserver/type/binary.rb +0 -2
  32. data/lib/active_record/connection_adapters/sqlserver/type/boolean.rb +0 -2
  33. data/lib/active_record/connection_adapters/sqlserver/type/char.rb +2 -2
  34. data/lib/active_record/connection_adapters/sqlserver/type/data.rb +0 -2
  35. data/lib/active_record/connection_adapters/sqlserver/type/date.rb +2 -3
  36. data/lib/active_record/connection_adapters/sqlserver/type/datetime.rb +2 -3
  37. data/lib/active_record/connection_adapters/sqlserver/type/datetime2.rb +0 -2
  38. data/lib/active_record/connection_adapters/sqlserver/type/datetimeoffset.rb +0 -2
  39. data/lib/active_record/connection_adapters/sqlserver/type/decimal.rb +0 -2
  40. data/lib/active_record/connection_adapters/sqlserver/type/float.rb +0 -2
  41. data/lib/active_record/connection_adapters/sqlserver/type/integer.rb +0 -2
  42. data/lib/active_record/connection_adapters/sqlserver/type/json.rb +0 -1
  43. data/lib/active_record/connection_adapters/sqlserver/type/money.rb +0 -2
  44. data/lib/active_record/connection_adapters/sqlserver/type/real.rb +0 -2
  45. data/lib/active_record/connection_adapters/sqlserver/type/small_integer.rb +0 -2
  46. data/lib/active_record/connection_adapters/sqlserver/type/small_money.rb +0 -2
  47. data/lib/active_record/connection_adapters/sqlserver/type/smalldatetime.rb +0 -2
  48. data/lib/active_record/connection_adapters/sqlserver/type/string.rb +0 -2
  49. data/lib/active_record/connection_adapters/sqlserver/type/text.rb +0 -2
  50. data/lib/active_record/connection_adapters/sqlserver/type/time.rb +2 -3
  51. data/lib/active_record/connection_adapters/sqlserver/type/time_value_fractional.rb +6 -9
  52. data/lib/active_record/connection_adapters/sqlserver/type/timestamp.rb +0 -2
  53. data/lib/active_record/connection_adapters/sqlserver/type/tiny_integer.rb +0 -2
  54. data/lib/active_record/connection_adapters/sqlserver/type/unicode_char.rb +1 -3
  55. data/lib/active_record/connection_adapters/sqlserver/type/unicode_string.rb +0 -2
  56. data/lib/active_record/connection_adapters/sqlserver/type/unicode_text.rb +0 -2
  57. data/lib/active_record/connection_adapters/sqlserver/type/unicode_varchar.rb +0 -2
  58. data/lib/active_record/connection_adapters/sqlserver/type/unicode_varchar_max.rb +0 -2
  59. data/lib/active_record/connection_adapters/sqlserver/type/uuid.rb +1 -2
  60. data/lib/active_record/connection_adapters/sqlserver/type/varbinary.rb +1 -3
  61. data/lib/active_record/connection_adapters/sqlserver/type/varbinary_max.rb +0 -2
  62. data/lib/active_record/connection_adapters/sqlserver/type/varchar.rb +1 -3
  63. data/lib/active_record/connection_adapters/sqlserver/type/varchar_max.rb +0 -2
  64. data/lib/active_record/connection_adapters/sqlserver/utils.rb +8 -11
  65. data/lib/active_record/connection_adapters/sqlserver/version.rb +0 -2
  66. data/lib/active_record/connection_adapters/sqlserver_adapter.rb +85 -83
  67. data/lib/active_record/connection_adapters/sqlserver_column.rb +0 -2
  68. data/lib/active_record/sqlserver_base.rb +1 -1
  69. data/lib/active_record/tasks/sqlserver_database_tasks.rb +26 -32
  70. data/lib/activerecord-sqlserver-adapter.rb +1 -1
  71. data/lib/arel/visitors/sqlserver.rb +18 -14
  72. data/lib/arel_sqlserver.rb +2 -2
  73. data/test/cases/adapter_test_sqlserver.rb +161 -182
  74. data/test/cases/change_column_null_test_sqlserver.rb +12 -12
  75. data/test/cases/coerced_tests.rb +88 -270
  76. data/test/cases/column_test_sqlserver.rb +281 -283
  77. data/test/cases/connection_test_sqlserver.rb +15 -20
  78. data/test/cases/execute_procedure_test_sqlserver.rb +18 -20
  79. data/test/cases/fetch_test_sqlserver.rb +14 -22
  80. data/test/cases/fully_qualified_identifier_test_sqlserver.rb +12 -18
  81. data/test/cases/helper_sqlserver.rb +13 -15
  82. data/test/cases/in_clause_test_sqlserver.rb +9 -9
  83. data/test/cases/index_test_sqlserver.rb +13 -15
  84. data/test/cases/json_test_sqlserver.rb +23 -25
  85. data/test/cases/migration_test_sqlserver.rb +22 -28
  86. data/test/cases/order_test_sqlserver.rb +51 -54
  87. data/test/cases/pessimistic_locking_test_sqlserver.rb +25 -33
  88. data/test/cases/rake_test_sqlserver.rb +31 -45
  89. data/test/cases/schema_dumper_test_sqlserver.rb +104 -108
  90. data/test/cases/schema_test_sqlserver.rb +18 -26
  91. data/test/cases/scratchpad_test_sqlserver.rb +2 -4
  92. data/test/cases/showplan_test_sqlserver.rb +24 -33
  93. data/test/cases/specific_schema_test_sqlserver.rb +66 -65
  94. data/test/cases/transaction_test_sqlserver.rb +16 -19
  95. data/test/cases/trigger_test_sqlserver.rb +12 -12
  96. data/test/cases/utils_test_sqlserver.rb +68 -70
  97. data/test/cases/uuid_test_sqlserver.rb +11 -13
  98. data/test/debug.rb +6 -6
  99. data/test/migrations/create_clients_and_change_column_null.rb +1 -1
  100. data/test/migrations/transaction_table/1_table_will_never_be_created.rb +2 -4
  101. data/test/models/sqlserver/booking.rb +1 -1
  102. data/test/models/sqlserver/customers_view.rb +1 -1
  103. data/test/models/sqlserver/dollar_table_name.rb +1 -1
  104. data/test/models/sqlserver/edge_schema.rb +1 -3
  105. data/test/models/sqlserver/fk_has_fk.rb +1 -1
  106. data/test/models/sqlserver/fk_has_pk.rb +1 -1
  107. data/test/models/sqlserver/natural_pk_data.rb +2 -2
  108. data/test/models/sqlserver/natural_pk_int_data.rb +1 -1
  109. data/test/models/sqlserver/no_pk_data.rb +1 -1
  110. data/test/models/sqlserver/object_default.rb +1 -1
  111. data/test/models/sqlserver/quoted_table.rb +2 -2
  112. data/test/models/sqlserver/quoted_view_1.rb +1 -1
  113. data/test/models/sqlserver/quoted_view_2.rb +1 -1
  114. data/test/models/sqlserver/sst_memory.rb +1 -1
  115. data/test/models/sqlserver/string_default.rb +1 -1
  116. data/test/models/sqlserver/string_defaults_big_view.rb +1 -1
  117. data/test/models/sqlserver/string_defaults_view.rb +1 -1
  118. data/test/models/sqlserver/tinyint_pk.rb +1 -1
  119. data/test/models/sqlserver/trigger.rb +2 -2
  120. data/test/models/sqlserver/trigger_history.rb +1 -1
  121. data/test/models/sqlserver/upper.rb +1 -1
  122. data/test/models/sqlserver/uppered.rb +1 -1
  123. data/test/models/sqlserver/uuid.rb +1 -1
  124. data/test/schema/sqlserver_specific_schema.rb +20 -22
  125. data/test/support/coerceable_test_sqlserver.rb +1 -4
  126. data/test/support/connection_reflection.rb +1 -2
  127. data/test/support/core_ext/query_cache.rb +1 -1
  128. data/test/support/load_schema_sqlserver.rb +3 -5
  129. data/test/support/minitest_sqlserver.rb +1 -1
  130. data/test/support/paths_sqlserver.rb +9 -11
  131. data/test/support/rake_helpers.rb +12 -10
  132. data/test/support/sql_counter_sqlserver.rb +0 -4
  133. data/test/support/test_in_memory_oltp.rb +7 -7
  134. metadata +5 -4
@@ -1,30 +1,30 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'cases/helper_sqlserver'
3
+ require "cases/helper_sqlserver"
4
4
 
5
5
  class SQLServerTriggerTest < ActiveRecord::TestCase
6
- after { exclude_output_inserted_table_names.clear }
6
+ after { exclude_output_inserted_table_names.clear }
7
7
 
8
8
  let(:exclude_output_inserted_table_names) do
9
9
  ActiveRecord::ConnectionAdapters::SQLServerAdapter.exclude_output_inserted_table_names
10
10
  end
11
11
 
12
- it 'can insert into a table with output inserted - with a true setting for table name' do
13
- exclude_output_inserted_table_names['sst_table_with_trigger'] = true
12
+ it "can insert into a table with output inserted - with a true setting for table name" do
13
+ exclude_output_inserted_table_names["sst_table_with_trigger"] = true
14
14
  assert SSTestTriggerHistory.all.empty?
15
- obj = SSTestTrigger.create! event_name: 'test trigger'
16
- _(['Fixnum', 'Integer']).must_include obj.id.class.name
17
- _(obj.event_name).must_equal 'test trigger'
15
+ obj = SSTestTrigger.create! event_name: "test trigger"
16
+ _(["Fixnum", "Integer"]).must_include obj.id.class.name
17
+ _(obj.event_name).must_equal "test trigger"
18
18
  _(obj.id).must_be :present?
19
19
  _(obj.id.to_s).must_equal SSTestTriggerHistory.first.id_source
20
20
  end
21
21
 
22
- it 'can insert into a table with output inserted - with a uniqueidentifier value' do
23
- exclude_output_inserted_table_names['sst_table_with_uuid_trigger'] = 'uniqueidentifier'
22
+ it "can insert into a table with output inserted - with a uniqueidentifier value" do
23
+ exclude_output_inserted_table_names["sst_table_with_uuid_trigger"] = "uniqueidentifier"
24
24
  assert SSTestTriggerHistory.all.empty?
25
- obj = SSTestTriggerUuid.create! event_name: 'test uuid trigger'
26
- _(obj.id.class.name).must_equal 'String'
27
- _(obj.event_name).must_equal 'test uuid trigger'
25
+ obj = SSTestTriggerUuid.create! event_name: "test uuid trigger"
26
+ _(obj.id.class.name).must_equal "String"
27
+ _(obj.event_name).must_equal "test uuid trigger"
28
28
  _(obj.id).must_be :present?
29
29
  _(obj.id.to_s).must_equal SSTestTriggerHistory.first.id_source
30
30
  end
@@ -1,61 +1,62 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'cases/helper_sqlserver'
3
+ require "cases/helper_sqlserver"
4
4
 
5
5
  class UtilsTestSQLServer < ActiveRecord::TestCase
6
-
7
- it '.quote_string' do
6
+ it ".quote_string" do
8
7
  _(SQLServer::Utils.quote_string("I'll store this in C:\\Users")).must_equal "I''ll store this in C:\\Users"
9
8
  end
10
9
 
11
- it '.unquote_string' do
10
+ it ".unquote_string" do
12
11
  _(SQLServer::Utils.unquote_string("I''ll store this in C:\\Users")).must_equal "I'll store this in C:\\Users"
13
12
  end
14
13
 
15
- it '.quoted_raw' do
14
+ it ".quoted_raw" do
16
15
  _(SQLServer::Utils.quoted_raw("some.Name")).must_equal "[some.Name]"
17
16
  end
18
17
 
19
- describe '.extract_identifiers constructor and thus SQLServer::Utils::Name value object' do
20
-
18
+ describe ".extract_identifiers constructor and thus SQLServer::Utils::Name value object" do
21
19
  let(:valid_names) { valid_names_unquoted + valid_names_quoted }
22
20
 
23
- let(:valid_names_unquoted) {[
24
- 'server.database.schema.object',
25
- 'server.database..object',
26
- 'server..schema.object',
27
- 'server...object',
28
- 'database.schema.object',
29
- 'database..object',
30
- 'schema.object',
31
- 'object'
32
- ]}
33
-
34
- let(:valid_names_quoted) {[
35
- '[server].[database].[schema].[object]',
36
- '[server].[database]..[object]',
37
- '[server]..[schema].[object]',
38
- '[server]...[object]',
39
- '[database].[schema].[object]',
40
- '[database]..[object]',
41
- '[schema].[object]',
42
- '[object]'
43
- ]}
21
+ let(:valid_names_unquoted) {
22
+ [
23
+ "server.database.schema.object",
24
+ "server.database..object",
25
+ "server..schema.object",
26
+ "server...object",
27
+ "database.schema.object",
28
+ "database..object",
29
+ "schema.object",
30
+ "object"
31
+ ]
32
+ }
33
+
34
+ let(:valid_names_quoted) {
35
+ [
36
+ "[server].[database].[schema].[object]",
37
+ "[server].[database]..[object]",
38
+ "[server]..[schema].[object]",
39
+ "[server]...[object]",
40
+ "[database].[schema].[object]",
41
+ "[database]..[object]",
42
+ "[schema].[object]",
43
+ "[object]"
44
+ ]
45
+ }
44
46
 
45
47
  let(:server_names) { valid_names.partition { |name| name =~ /server/ } }
46
48
  let(:database_names) { valid_names.partition { |name| name =~ /database/ } }
47
49
  let(:schema_names) { valid_names.partition { |name| name =~ /schema/ } }
48
50
 
49
- it 'extracts and returns #object identifier unquoted by default or quoted as needed' do
51
+ it "extracts and returns #object identifier unquoted by default or quoted as needed" do
50
52
  valid_names.each do |n|
51
53
  name = extract_identifiers(n)
52
- _(name.object).must_equal 'object', "With #{n.inspect} for #object"
53
- _(name.object_quoted).must_equal '[object]', "With #{n.inspect} for #object_quoted"
54
+ _(name.object).must_equal "object", "With #{n.inspect} for #object"
55
+ _(name.object_quoted).must_equal "[object]", "With #{n.inspect} for #object_quoted"
54
56
  end
55
57
  end
56
58
 
57
59
  [:schema, :database, :server].each do |part|
58
-
59
60
  it "extracts and returns #{part} identifier unquoted by default or quoted as needed" do
60
61
  present, blank = send(:"#{part}_names")
61
62
  present.each do |n|
@@ -69,57 +70,55 @@ class UtilsTestSQLServer < ActiveRecord::TestCase
69
70
  _(name.send(:"#{part}_quoted")).must_be_nil "With #{n.inspect} for ##{part}_quoted method"
70
71
  end
71
72
  end
72
-
73
73
  end
74
74
 
75
- it 'does not blow up on nil or blank string name' do
75
+ it "does not blow up on nil or blank string name" do
76
76
  _(extract_identifiers(nil).object).must_be_nil
77
- _(extract_identifiers(' ').object).must_be_nil
77
+ _(extract_identifiers(" ").object).must_be_nil
78
78
  end
79
79
 
80
- it 'has a #quoted that returns a fully quoted name with all identifiers as orginially passed in' do
81
- _(extract_identifiers('object').quoted).must_equal '[object]'
82
- _(extract_identifiers('server.database..object').quoted).must_equal '[server].[database]..[object]'
83
- _(extract_identifiers('[server]...[object]').quoted).must_equal '[server]...[object]'
80
+ it "has a #quoted that returns a fully quoted name with all identifiers as orginially passed in" do
81
+ _(extract_identifiers("object").quoted).must_equal "[object]"
82
+ _(extract_identifiers("server.database..object").quoted).must_equal "[server].[database]..[object]"
83
+ _(extract_identifiers("[server]...[object]").quoted).must_equal "[server]...[object]"
84
84
  end
85
85
 
86
- it 'can take a symbol argument' do
87
- _(extract_identifiers(:object).object).must_equal 'object'
86
+ it "can take a symbol argument" do
87
+ _(extract_identifiers(:object).object).must_equal "object"
88
88
  end
89
89
 
90
- it 'allows identifiers with periods to work' do
91
- _(extract_identifiers('[obj.name]').quoted).must_equal '[obj.name]'
92
- _(extract_identifiers('[obj.name].[foo]').quoted).must_equal '[obj.name].[foo]'
90
+ it "allows identifiers with periods to work" do
91
+ _(extract_identifiers("[obj.name]").quoted).must_equal "[obj.name]"
92
+ _(extract_identifiers("[obj.name].[foo]").quoted).must_equal "[obj.name].[foo]"
93
93
  end
94
94
 
95
- it 'should indicate if a name is fully qualitified' do
96
- _(extract_identifiers('object').fully_qualified?).must_equal false
97
- _(extract_identifiers('schema.object').fully_qualified?).must_equal false
98
- _(extract_identifiers('database.schema.object').fully_qualified?).must_equal false
99
- _(extract_identifiers('database.object').fully_qualified?).must_equal false
100
- _(extract_identifiers('server...object').fully_qualified?).must_equal false
101
- _(extract_identifiers('server.database..object').fully_qualified?).must_equal false
102
- _(extract_identifiers('server.database.schema.object').fully_qualified?).must_equal true
103
- _(extract_identifiers('server.database.schema.').fully_qualified?).must_equal true
104
- _(extract_identifiers('[obj.name]').fully_qualified?).must_equal false
105
- _(extract_identifiers('[schema].[obj.name]').fully_qualified?).must_equal false
106
- _(extract_identifiers('[database].[schema].[obj.name]').fully_qualified?).must_equal false
107
- _(extract_identifiers('[database].[obj.name]').fully_qualified?).must_equal false
108
- _(extract_identifiers('[server.name]...[obj.name]').fully_qualified?).must_equal false
109
- _(extract_identifiers('[server.name].[database]..[obj.name]').fully_qualified?).must_equal false
110
- _(extract_identifiers('[server.name].[database].[schema].[obj.name]').fully_qualified?).must_equal true
111
- _(extract_identifiers('[server.name].[database].[schema].').fully_qualified?).must_equal true
95
+ it "should indicate if a name is fully qualitified" do
96
+ _(extract_identifiers("object").fully_qualified?).must_equal false
97
+ _(extract_identifiers("schema.object").fully_qualified?).must_equal false
98
+ _(extract_identifiers("database.schema.object").fully_qualified?).must_equal false
99
+ _(extract_identifiers("database.object").fully_qualified?).must_equal false
100
+ _(extract_identifiers("server...object").fully_qualified?).must_equal false
101
+ _(extract_identifiers("server.database..object").fully_qualified?).must_equal false
102
+ _(extract_identifiers("server.database.schema.object").fully_qualified?).must_equal true
103
+ _(extract_identifiers("server.database.schema.").fully_qualified?).must_equal true
104
+ _(extract_identifiers("[obj.name]").fully_qualified?).must_equal false
105
+ _(extract_identifiers("[schema].[obj.name]").fully_qualified?).must_equal false
106
+ _(extract_identifiers("[database].[schema].[obj.name]").fully_qualified?).must_equal false
107
+ _(extract_identifiers("[database].[obj.name]").fully_qualified?).must_equal false
108
+ _(extract_identifiers("[server.name]...[obj.name]").fully_qualified?).must_equal false
109
+ _(extract_identifiers("[server.name].[database]..[obj.name]").fully_qualified?).must_equal false
110
+ _(extract_identifiers("[server.name].[database].[schema].[obj.name]").fully_qualified?).must_equal true
111
+ _(extract_identifiers("[server.name].[database].[schema].").fully_qualified?).must_equal true
112
112
  end
113
113
 
114
- it 'can return fully qualified quoted table name' do
115
- name = extract_identifiers('[my.server].db.schema.')
116
- _(name.fully_qualified_database_quoted).must_equal '[my.server].[db]'
117
- name = extract_identifiers('[server.name].[database].[schema].[object]')
118
- _(name.fully_qualified_database_quoted).must_equal '[server.name].[database]'
119
- name = extract_identifiers('server.database.schema.object')
120
- _(name.fully_qualified_database_quoted).must_equal '[server].[database]'
114
+ it "can return fully qualified quoted table name" do
115
+ name = extract_identifiers("[my.server].db.schema.")
116
+ _(name.fully_qualified_database_quoted).must_equal "[my.server].[db]"
117
+ name = extract_identifiers("[server.name].[database].[schema].[object]")
118
+ _(name.fully_qualified_database_quoted).must_equal "[server.name].[database]"
119
+ name = extract_identifiers("server.database.schema.object")
120
+ _(name.fully_qualified_database_quoted).must_equal "[server].[database]"
121
121
  end
122
-
123
122
  end
124
123
 
125
124
  private
@@ -127,5 +126,4 @@ class UtilsTestSQLServer < ActiveRecord::TestCase
127
126
  def extract_identifiers(name)
128
127
  SQLServer::Utils.extract_identifiers(name)
129
128
  end
130
-
131
129
  end
@@ -1,48 +1,46 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'cases/helper_sqlserver'
3
+ require "cases/helper_sqlserver"
4
4
 
5
5
  class SQLServerUuidTest < ActiveRecord::TestCase
6
-
7
6
  let(:acceptable_uuid) { ActiveRecord::ConnectionAdapters::SQLServer::Type::Uuid::ACCEPTABLE_UUID }
8
7
 
9
- it 'has a uuid primary key' do
10
- _(SSTestUuid.columns_hash['id'].type).must_equal :uuid
8
+ it "has a uuid primary key" do
9
+ _(SSTestUuid.columns_hash["id"].type).must_equal :uuid
11
10
  assert SSTestUuid.primary_key
12
11
  end
13
12
 
14
- it 'can create with a new pk' do
13
+ it "can create with a new pk" do
15
14
  obj = SSTestUuid.create!
16
15
  _(obj.id).must_be :present?
17
16
  _(obj.id).must_match acceptable_uuid
18
17
  end
19
18
 
20
- it 'can create other uuid column on reload' do
19
+ it "can create other uuid column on reload" do
21
20
  obj = SSTestUuid.create!
22
21
  obj.reload
23
22
  _(obj.other_uuid).must_match acceptable_uuid
24
23
  end
25
24
 
26
- it 'can find uuid pk via connection' do
27
- _(connection.primary_key(SSTestUuid.table_name)).must_equal 'id'
25
+ it "can find uuid pk via connection" do
26
+ _(connection.primary_key(SSTestUuid.table_name)).must_equal "id"
28
27
  end
29
28
 
30
- it 'changing column default' do
29
+ it "changing column default" do
31
30
  table_name = SSTestUuid.table_name
32
31
  connection.add_column table_name, :thingy, :uuid, null: false, default: "NEWSEQUENTIALID()"
33
32
  SSTestUuid.reset_column_information
34
- column = SSTestUuid.columns_hash['thingy']
33
+ column = SSTestUuid.columns_hash["thingy"]
35
34
  _(column.default_function).must_equal "newsequentialid()"
36
35
  # Now to a different function.
37
36
  connection.change_column table_name, :thingy, :uuid, null: false, default: "NEWID()"
38
37
  SSTestUuid.reset_column_information
39
- column = SSTestUuid.columns_hash['thingy']
38
+ column = SSTestUuid.columns_hash["thingy"]
40
39
  _(column.default_function).must_equal "newid()"
41
40
  end
42
41
 
43
- it 'can insert even when use_output_inserted to false ' do
42
+ it "can insert even when use_output_inserted to false " do
44
43
  obj = with_use_output_inserted_disabled { SSTestUuid.create!(name: "😢") }
45
44
  _(obj.id).must_be :nil?
46
45
  end
47
-
48
46
  end
@@ -1,15 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # require 'rails/all'
4
- require 'tiny_tds'
4
+ require "tiny_tds"
5
5
 
6
6
  c = TinyTds::Client.new(
7
- host: ENV['CI_AZURE_HOST'],
8
- username: 'rails',
9
- password: ENV['CI_AZURE_PASS'],
10
- database: 'activerecord_unittest',
7
+ host: ENV["CI_AZURE_HOST"],
8
+ username: "rails",
9
+ password: ENV["CI_AZURE_PASS"],
10
+ database: "activerecord_unittest",
11
11
  azure: true,
12
- tds_version: '7.3'
12
+ tds_version: "7.3"
13
13
  )
14
14
 
15
15
  puts c.execute("SELECT 1 AS [one]").each
@@ -11,7 +11,7 @@ class CreateClientsAndChangeColumnNull < ActiveRecord::Migration[5.2]
11
11
  end
12
12
 
13
13
  change_column :clients, :name, :string, limit: 15
14
- change_column :clients, :code, :string, default: 'n/a'
14
+ change_column :clients, :code, :string, default: "n/a"
15
15
  change_column :clients, :value, :decimal, precision: 32, scale: 8
16
16
 
17
17
  change_column_null :clients, :name, false
@@ -1,13 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class TableWillNeverBeCreated < ActiveRecord::Migration
4
-
5
4
  def self.up
6
- create_table(:sqlserver_trans_table1) { }
7
- create_table(:sqlserver_trans_table2) { raise('HELL') }
5
+ create_table(:sqlserver_trans_table1) {}
6
+ create_table(:sqlserver_trans_table2) { raise("HELL") }
8
7
  end
9
8
 
10
9
  def self.down
11
10
  end
12
-
13
11
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class SSTestBooking < ActiveRecord::Base
4
- self.table_name = 'sst_bookings'
4
+ self.table_name = "sst_bookings"
5
5
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class SSTestCustomersView < ActiveRecord::Base
4
- self.table_name = 'sst_customers_view'
4
+ self.table_name = "sst_customers_view"
5
5
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class SSTestDollarTableName < ActiveRecord::Base
4
- self.table_name = 'sst_my$strange_table'
4
+ self.table_name = "sst_my$strange_table"
5
5
  end
@@ -1,8 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class SSTestEdgeSchema < ActiveRecord::Base
4
-
5
- self.table_name = 'sst_edge_schemas'
4
+ self.table_name = "sst_edge_schemas"
6
5
 
7
6
  def with_spaces
8
7
  read_attribute :'with spaces'
@@ -11,5 +10,4 @@ class SSTestEdgeSchema < ActiveRecord::Base
11
10
  def with_spaces=(value)
12
11
  write_attribute :'with spaces', value
13
12
  end
14
-
15
13
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class SSTestHasFk < ActiveRecord::Base
4
- self.table_name = 'sst_has_fks'
4
+ self.table_name = "sst_has_fks"
5
5
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class SSTestHasPk < ActiveRecord::Base
4
- self.table_name = 'sst_has_pks'
4
+ self.table_name = "sst_has_pks"
5
5
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class SSTestNaturalPkData < ActiveRecord::Base
4
- self.table_name = 'sst_natural_pk_data'
5
- self.primary_key = 'legacy_id'
4
+ self.table_name = "sst_natural_pk_data"
5
+ self.primary_key = "legacy_id"
6
6
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class SSTestNaturalPkIntData < ActiveRecord::Base
4
- self.table_name = 'sst_natural_pk_int_data'
4
+ self.table_name = "sst_natural_pk_int_data"
5
5
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class SSTestNoPkData < ActiveRecord::Base
4
- self.table_name = 'sst_no_pk_data'
4
+ self.table_name = "sst_no_pk_data"
5
5
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class SSTestObjectDefault < ActiveRecord::Base
4
- self.table_name = 'sst_defaultobjects'
4
+ self.table_name = "sst_defaultobjects"
5
5
  end
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class SSTestQuotedTable < ActiveRecord::Base
4
- self.table_name = '[sst_quoted-table]'
4
+ self.table_name = "[sst_quoted-table]"
5
5
  end
6
6
 
7
7
  class SSTestQuotedTableUser < ActiveRecord::Base
8
- self.table_name = '[dbo].[sst_quoted-table]'
8
+ self.table_name = "[dbo].[sst_quoted-table]"
9
9
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class SSTestQuotedView1 < ActiveRecord::Base
4
- self.table_name = 'sst_quoted-view1'
4
+ self.table_name = "sst_quoted-view1"
5
5
  end