activerecord-sqlserver-adapter 5.2.1 → 6.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (146) hide show
  1. checksums.yaml +4 -4
  2. data/.editorconfig +9 -0
  3. data/.github/issue_template.md +23 -0
  4. data/.travis.yml +6 -8
  5. data/CHANGELOG.md +22 -32
  6. data/{Dockerfile → Dockerfile.ci} +1 -1
  7. data/Gemfile +42 -41
  8. data/README.md +9 -30
  9. data/RUNNING_UNIT_TESTS.md +3 -0
  10. data/Rakefile +2 -0
  11. data/VERSION +1 -1
  12. data/activerecord-sqlserver-adapter.gemspec +25 -14
  13. data/appveyor.yml +24 -17
  14. data/docker-compose.ci.yml +7 -5
  15. data/guides/RELEASING.md +11 -0
  16. data/lib/active_record/connection_adapters/sqlserver/core_ext/active_record.rb +2 -0
  17. data/lib/active_record/connection_adapters/sqlserver/core_ext/attribute_methods.rb +2 -0
  18. data/lib/active_record/connection_adapters/sqlserver/core_ext/calculations.rb +2 -0
  19. data/lib/active_record/connection_adapters/sqlserver/core_ext/explain.rb +3 -1
  20. data/lib/active_record/connection_adapters/sqlserver/core_ext/explain_subscriber.rb +2 -0
  21. data/lib/active_record/connection_adapters/sqlserver/core_ext/finder_methods.rb +6 -4
  22. data/lib/active_record/connection_adapters/sqlserver/core_ext/preloader.rb +36 -0
  23. data/lib/active_record/connection_adapters/sqlserver/core_ext/query_methods.rb +4 -1
  24. data/lib/active_record/connection_adapters/sqlserver/database_limits.rb +9 -0
  25. data/lib/active_record/connection_adapters/sqlserver/database_statements.rb +55 -14
  26. data/lib/active_record/connection_adapters/sqlserver/database_tasks.rb +2 -0
  27. data/lib/active_record/connection_adapters/sqlserver/errors.rb +2 -0
  28. data/lib/active_record/connection_adapters/sqlserver/quoting.rb +38 -0
  29. data/lib/active_record/connection_adapters/sqlserver/schema_creation.rb +16 -3
  30. data/lib/active_record/connection_adapters/sqlserver/schema_dumper.rb +2 -0
  31. data/lib/active_record/connection_adapters/sqlserver/schema_statements.rb +93 -70
  32. data/lib/active_record/connection_adapters/sqlserver/showplan.rb +2 -0
  33. data/lib/active_record/connection_adapters/sqlserver/showplan/printer_table.rb +2 -0
  34. data/lib/active_record/connection_adapters/sqlserver/showplan/printer_xml.rb +2 -0
  35. data/lib/active_record/connection_adapters/sqlserver/sql_type_metadata.rb +2 -0
  36. data/lib/active_record/connection_adapters/sqlserver/table_definition.rb +42 -40
  37. data/lib/active_record/connection_adapters/sqlserver/transaction.rb +3 -1
  38. data/lib/active_record/connection_adapters/sqlserver/type.rb +2 -0
  39. data/lib/active_record/connection_adapters/sqlserver/type/big_integer.rb +3 -1
  40. data/lib/active_record/connection_adapters/sqlserver/type/binary.rb +5 -2
  41. data/lib/active_record/connection_adapters/sqlserver/type/boolean.rb +3 -1
  42. data/lib/active_record/connection_adapters/sqlserver/type/char.rb +5 -2
  43. data/lib/active_record/connection_adapters/sqlserver/type/data.rb +2 -0
  44. data/lib/active_record/connection_adapters/sqlserver/type/date.rb +3 -1
  45. data/lib/active_record/connection_adapters/sqlserver/type/datetime.rb +7 -6
  46. data/lib/active_record/connection_adapters/sqlserver/type/datetime2.rb +2 -0
  47. data/lib/active_record/connection_adapters/sqlserver/type/datetimeoffset.rb +2 -0
  48. data/lib/active_record/connection_adapters/sqlserver/type/decimal.rb +5 -2
  49. data/lib/active_record/connection_adapters/sqlserver/type/float.rb +3 -1
  50. data/lib/active_record/connection_adapters/sqlserver/type/integer.rb +3 -1
  51. data/lib/active_record/connection_adapters/sqlserver/type/json.rb +2 -0
  52. data/lib/active_record/connection_adapters/sqlserver/type/money.rb +4 -2
  53. data/lib/active_record/connection_adapters/sqlserver/type/real.rb +3 -1
  54. data/lib/active_record/connection_adapters/sqlserver/type/small_integer.rb +3 -1
  55. data/lib/active_record/connection_adapters/sqlserver/type/small_money.rb +4 -2
  56. data/lib/active_record/connection_adapters/sqlserver/type/smalldatetime.rb +3 -1
  57. data/lib/active_record/connection_adapters/sqlserver/type/string.rb +2 -0
  58. data/lib/active_record/connection_adapters/sqlserver/type/text.rb +3 -1
  59. data/lib/active_record/connection_adapters/sqlserver/type/time.rb +5 -4
  60. data/lib/active_record/connection_adapters/sqlserver/type/time_value_fractional.rb +2 -0
  61. data/lib/active_record/connection_adapters/sqlserver/type/timestamp.rb +3 -1
  62. data/lib/active_record/connection_adapters/sqlserver/type/tiny_integer.rb +3 -1
  63. data/lib/active_record/connection_adapters/sqlserver/type/unicode_char.rb +5 -2
  64. data/lib/active_record/connection_adapters/sqlserver/type/unicode_string.rb +2 -0
  65. data/lib/active_record/connection_adapters/sqlserver/type/unicode_text.rb +3 -1
  66. data/lib/active_record/connection_adapters/sqlserver/type/unicode_varchar.rb +6 -3
  67. data/lib/active_record/connection_adapters/sqlserver/type/unicode_varchar_max.rb +4 -2
  68. data/lib/active_record/connection_adapters/sqlserver/type/uuid.rb +3 -1
  69. data/lib/active_record/connection_adapters/sqlserver/type/varbinary.rb +6 -3
  70. data/lib/active_record/connection_adapters/sqlserver/type/varbinary_max.rb +4 -2
  71. data/lib/active_record/connection_adapters/sqlserver/type/varchar.rb +6 -3
  72. data/lib/active_record/connection_adapters/sqlserver/type/varchar_max.rb +4 -2
  73. data/lib/active_record/connection_adapters/sqlserver/utils.rb +2 -0
  74. data/lib/active_record/connection_adapters/sqlserver/version.rb +2 -0
  75. data/lib/active_record/connection_adapters/sqlserver_adapter.rb +44 -10
  76. data/lib/active_record/connection_adapters/sqlserver_column.rb +9 -3
  77. data/lib/active_record/sqlserver_base.rb +8 -0
  78. data/lib/active_record/tasks/sqlserver_database_tasks.rb +2 -0
  79. data/lib/activerecord-sqlserver-adapter.rb +2 -0
  80. data/lib/arel/visitors/sqlserver.rb +40 -10
  81. data/lib/arel_sqlserver.rb +2 -0
  82. data/test/appveyor/dbsetup.ps1 +4 -4
  83. data/test/cases/adapter_test_sqlserver.rb +65 -1
  84. data/test/cases/change_column_null_test_sqlserver.rb +2 -0
  85. data/test/cases/coerced_tests.rb +644 -187
  86. data/test/cases/column_test_sqlserver.rb +2 -1
  87. data/test/cases/connection_test_sqlserver.rb +2 -0
  88. data/test/cases/execute_procedure_test_sqlserver.rb +2 -0
  89. data/test/cases/fetch_test_sqlserver.rb +2 -0
  90. data/test/cases/fully_qualified_identifier_test_sqlserver.rb +4 -2
  91. data/test/cases/helper_sqlserver.rb +2 -0
  92. data/test/cases/in_clause_test_sqlserver.rb +36 -0
  93. data/test/cases/index_test_sqlserver.rb +2 -0
  94. data/test/cases/json_test_sqlserver.rb +2 -0
  95. data/test/cases/migration_test_sqlserver.rb +4 -2
  96. data/test/cases/order_test_sqlserver.rb +2 -0
  97. data/test/cases/pessimistic_locking_test_sqlserver.rb +2 -0
  98. data/test/cases/rake_test_sqlserver.rb +2 -0
  99. data/test/cases/schema_dumper_test_sqlserver.rb +3 -1
  100. data/test/cases/schema_test_sqlserver.rb +2 -0
  101. data/test/cases/scratchpad_test_sqlserver.rb +2 -0
  102. data/test/cases/showplan_test_sqlserver.rb +4 -2
  103. data/test/cases/specific_schema_test_sqlserver.rb +2 -0
  104. data/test/cases/transaction_test_sqlserver.rb +2 -1
  105. data/test/cases/trigger_test_sqlserver.rb +2 -1
  106. data/test/cases/utils_test_sqlserver.rb +2 -0
  107. data/test/cases/uuid_test_sqlserver.rb +2 -1
  108. data/test/debug.rb +2 -0
  109. data/test/migrations/create_clients_and_change_column_null.rb +2 -0
  110. data/test/migrations/transaction_table/1_table_will_never_be_created.rb +2 -0
  111. data/test/models/sqlserver/booking.rb +2 -0
  112. data/test/models/sqlserver/customers_view.rb +2 -0
  113. data/test/models/sqlserver/datatype.rb +2 -0
  114. data/test/models/sqlserver/datatype_migration.rb +2 -0
  115. data/test/models/sqlserver/dollar_table_name.rb +2 -0
  116. data/test/models/sqlserver/edge_schema.rb +2 -0
  117. data/test/models/sqlserver/fk_has_fk.rb +2 -0
  118. data/test/models/sqlserver/fk_has_pk.rb +2 -0
  119. data/test/models/sqlserver/natural_pk_data.rb +2 -0
  120. data/test/models/sqlserver/natural_pk_int_data.rb +2 -0
  121. data/test/models/sqlserver/no_pk_data.rb +2 -0
  122. data/test/models/sqlserver/object_default.rb +2 -0
  123. data/test/models/sqlserver/quoted_table.rb +2 -0
  124. data/test/models/sqlserver/quoted_view_1.rb +2 -0
  125. data/test/models/sqlserver/quoted_view_2.rb +2 -0
  126. data/test/models/sqlserver/sst_memory.rb +2 -0
  127. data/test/models/sqlserver/string_default.rb +2 -0
  128. data/test/models/sqlserver/string_defaults_big_view.rb +2 -0
  129. data/test/models/sqlserver/string_defaults_view.rb +2 -0
  130. data/test/models/sqlserver/tinyint_pk.rb +2 -0
  131. data/test/models/sqlserver/trigger.rb +2 -0
  132. data/test/models/sqlserver/trigger_history.rb +2 -0
  133. data/test/models/sqlserver/upper.rb +2 -0
  134. data/test/models/sqlserver/uppered.rb +2 -0
  135. data/test/models/sqlserver/uuid.rb +2 -0
  136. data/test/schema/sqlserver_specific_schema.rb +2 -0
  137. data/test/support/coerceable_test_sqlserver.rb +14 -5
  138. data/test/support/connection_reflection.rb +2 -0
  139. data/test/support/core_ext/query_cache.rb +3 -0
  140. data/test/support/load_schema_sqlserver.rb +2 -0
  141. data/test/support/minitest_sqlserver.rb +2 -0
  142. data/test/support/paths_sqlserver.rb +2 -0
  143. data/test/support/rake_helpers.rb +1 -0
  144. data/test/support/sql_counter_sqlserver.rb +3 -0
  145. data/test/support/test_in_memory_oltp.rb +2 -0
  146. metadata +18 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5c31b843cb8193ccc2c2777a80e658c3b7675c3ea5387f78f3b4b1316b96dd00
4
- data.tar.gz: ab77e8f296d0eb35877a34f5a0d31fa1da51f69e09bb852db6b97ced8c133f04
3
+ metadata.gz: e38e0db2e61f2a8afd9e9068d13927a6bf2f326b765fe60acf2251740dc1fd2c
4
+ data.tar.gz: 5775ca711d927153804e9f6e7bce85af0c55a312268e49b7cb70aec1b9c153ca
5
5
  SHA512:
6
- metadata.gz: 11d4df1451f076a4877e09698a9696355f16d2b958ef0fb19f353217211c0871645736c40ab2300bfba7f6e7fcac994b918de927dfef40db66cca2500dd43b5a
7
- data.tar.gz: cecaad6271fb78bb6ace828f7e16bd67007c0ae5e55f6759c49c710f5cb02dbe361f9a06bf9159599b36cf1c6325c0e631670cf30dca519447145d0bee62823e
6
+ metadata.gz: d94c57956ff87d407273cdd9fc2c1277be9238ef4c46631b3a1489875a9d1e719d7350afa5c6a7df1b7cce914c7e434ea00605c6269c1a27e881b0abf7c8fa12
7
+ data.tar.gz: cbacfa3df2a3005463c3d39686914fa7f2b5d517a06f177287f20f703d0b195ffdc1037b94cee70458c9fcaada7f45b8c84abc8e81cd78aff7a9ff6e3535eb19
@@ -0,0 +1,9 @@
1
+ root = true
2
+
3
+ [*]
4
+ indent_style = space
5
+ indent_size = 2
6
+ end_of_line = lf
7
+ charset = utf-8
8
+ trim_trailing_whitespace = true
9
+ insert_final_newline = true
@@ -0,0 +1,23 @@
1
+ ## Issue
2
+ <!-- Give a brief summary of the issue. -->
3
+
4
+ ## Expected behavior
5
+ <!-- Tell us what should happen -->
6
+
7
+ ## Actual behavior
8
+ <!-- Tell us what happens instead -->
9
+
10
+ ## How to reproduce
11
+ <!-- See https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/wiki/How-to-report-a-bug -->
12
+
13
+ ## Details
14
+
15
+ - **Rails version**: `x.x.x`
16
+ - **SQL Server adapter version**: `x.x.x`
17
+ - **TinyTDS version**: `x.x.x`
18
+ - **FreeTDS details**:
19
+
20
+ ```
21
+ run `tsql -C` and paste here the output.
22
+ ```
23
+
@@ -15,11 +15,9 @@ script:
15
15
  - docker-compose run ci
16
16
  matrix:
17
17
  include:
18
- - name: 2.3.8
19
- env: TARGET_VERSION=2.3.8
20
- - name: 2.4.6
21
- env: TARGET_VERSION=2.4.6
22
- - name: 2.5.5
23
- env: TARGET_VERSION=2.5.5
24
- - name: 2.6.3
25
- env: TARGET_VERSION=2.6.3
18
+ - name: 2.5.8
19
+ env: TARGET_VERSION=2.5.8
20
+ - name: 2.6.6
21
+ env: TARGET_VERSION=2.6.6
22
+ - name: 2.7.1
23
+ env: TARGET_VERSION=2.7.1
@@ -1,40 +1,30 @@
1
- ## v5.2.1
1
+ ## v6.0.0.rc1
2
2
 
3
3
  #### Fixed
4
4
 
5
- - #691 Fix constraints bug
6
- - #700 SET SINGLE_USER before dropping the database
7
- - #733 Calculate should not remove ordering for MSSQL
8
- - #735 Order by selected items when using distinct exists
9
- - #737 Use default precision for 'time' column type
10
- - #744 Adapter does not use prepared statement cache
11
- - #743 Set default time precision when registering time type
12
- - #745 Quoted table names containing square brackets need to be regex escaped
13
-
14
- ## v5.2.0
15
-
16
- #### Fixed
17
-
18
- - #686 sql_for_insert set table name in case when pk is not nil
19
-
20
- ## v5.2.0.rc2
21
-
22
- #### Fixed
23
-
24
- - #681 change_column_null should not clear other column attributes. Fixes #582.
25
- - #684 Fix explain with array conditions. Fixes #673.
26
-
27
- ## v5.2.0.rc1
28
-
29
- #### Fixed
30
-
31
- - #638 Don't disable referential integrity for the same table twice.
32
- - #646 Make String equality check work for Type::Data values. Fixes #645.
33
- - #671 Fix tinyint columns schema migration. Fixes #670.
5
+ - [#690](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/690) Rails 6 support
6
+ - [#805](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/805) Rails 6: Fix database tasks tests for SQL Server
7
+ - [#807](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/807) Rails 6: Skip binary fixtures test on Windows
8
+ - [#809](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/809) Rails 6: Coerce reaper test using fork
9
+ - [#810](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/810) Rails 6: Fix randomly failing tests due to schema load
10
+ - [#812](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/812) Rails 6: Coerce ReloadModelsTest test on Windows
11
+ - [#818](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/818) Handle false return by TinyTDS if connection fails and fixed CI
12
+ - [#819](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/819) Fix Ruby 2.7 kwargs warnings
13
+ - [#825](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/825) Adjust error message when connection is dead
34
14
 
35
15
  #### Changed
36
16
 
37
- - #642 Added with (nolock) hint to information_schema.views.
17
+ - [#716](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/716) Translate the connection timed out error
18
+ - [#763](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/763) Refactor columns introspection query to make it faster
19
+ - [#783](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/783) Update test matrix
20
+ - [#820](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/820) Enable frozen strings for tests
21
+ - [#821](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/821) Enable frozen strings - part 1
22
+ - [#822](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/822) Enable frozen strings - part 2
23
+ - [#823](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/823) Enable frozen strings - final
24
+ - [#824](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/824) Tidy up Gemfile
25
+
26
+ #### Added
38
27
 
28
+ - [#726](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/726) How to Develop ActiveRecord SQL Server Adapter with Pre-Installed MS SQL
39
29
 
40
- Please check [5-1-stable](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/blob/5-1-stable/CHANGELOG.md) for previous changes.
30
+ Please check [5-2-stable](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/blob/5-2-stable/CHANGELOG.md) for previous changes.
@@ -1,6 +1,6 @@
1
1
  ARG TARGET_VERSION=2.6.3
2
2
 
3
- FROM wpolicarpo/activerecord-sqlserver-adapter:${TARGET_VERSION}
3
+ FROM railssqlserver/activerecord-sqlserver-adapter:${TARGET_VERSION}
4
4
 
5
5
  ENV WORKDIR /activerecord-sqlserver-adapter
6
6
 
data/Gemfile CHANGED
@@ -1,62 +1,63 @@
1
- require 'openssl'
2
- source 'https://rubygems.org'
3
- gemspec
1
+ # frozen_string_literal: true
4
2
 
5
- gem 'sqlite3', '~> 1.3.6'
6
- gem 'bcrypt'
7
- gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
3
+ source "https://rubygems.org"
8
4
 
9
- if RbConfig::CONFIG["host_os"] =~ /darwin/
10
- gem 'terminal-notifier-guard'
11
- end
5
+ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
6
+
7
+ gemspec
12
8
 
13
- if ENV['RAILS_SOURCE']
14
- gemspec path: ENV['RAILS_SOURCE']
9
+ gem "bcrypt"
10
+ gem "pg", ">= 0.18.0"
11
+ gem "sqlite3", "~> 1.4"
12
+ gem "tzinfo-data", platforms: [:mingw, :mswin, :x64_mingw, :jruby]
13
+
14
+ if ENV["RAILS_SOURCE"]
15
+ gemspec path: ENV["RAILS_SOURCE"]
15
16
  else
16
- # Need to get rails source beacause the gem doesn't include tests
17
- version = ENV['RAILS_VERSION'] || begin
18
- require 'net/http'
19
- require 'yaml'
20
- spec = eval(File.read('activerecord-sqlserver-adapter.gemspec'))
21
- ver = spec.dependencies.detect{ |d|d.name == 'activerecord' }.requirement.requirements.first.last.version
22
- major, minor, tiny, pre = ver.split('.')
23
- if !pre
24
- uri = URI.parse "https://rubygems.org/api/v1/versions/activerecord.yaml"
17
+ # Need to get rails source because the gem doesn't include tests
18
+ version = ENV["RAILS_VERSION"] || begin
19
+ require "openssl"
20
+ require "net/http"
21
+ require "yaml"
22
+
23
+ spec = eval(File.read("activerecord-sqlserver-adapter.gemspec"))
24
+ ver = spec.dependencies.detect{ |d|d.name == "activerecord" }.requirement.requirements.first.last.version
25
+ major, minor, tiny, pre = ver.split(".")
26
+
27
+ if pre
28
+ ver
29
+ else
30
+ uri = URI.parse("https://rubygems.org/api/v1/versions/activerecord.yaml")
25
31
  http = Net::HTTP.new(uri.host, uri.port)
26
32
  http.use_ssl = true
27
33
  http.verify_mode = OpenSSL::SSL::VERIFY_NONE
28
- YAML.load(http.request(Net::HTTP::Get.new(uri.request_uri)).body).select do |data|
29
- a, b, c = data['number'].split('.')
30
- !data['prerelease'] && major == a && (minor.nil? || minor == b)
31
- end.first['number']
32
- else
33
- ver
34
+ YAML.load(http.request(Net::HTTP::Get.new(uri.request_uri)).body).find do |data|
35
+ a, b, c = data["number"].split(".")
36
+ !data["prerelease"] && major == a && (minor.nil? || minor == b)
37
+ end["number"]
34
38
  end
35
39
  end
36
- gem 'rails', git: "git://github.com/rails/rails.git", tag: "v#{version}"
37
- end
38
-
39
- if ENV['AREL']
40
- gem 'arel', path: ENV['AREL']
40
+ gem "rails", github: "rails/rails", tag: "v#{version}"
41
41
  end
42
42
 
43
43
  group :tinytds do
44
- if ENV['TINYTDS_SOURCE']
45
- gem 'tiny_tds', path: ENV['TINYTDS_SOURCE']
46
- elsif ENV['TINYTDS_VERSION']
47
- gem 'tiny_tds', ENV['TINYTDS_VERSION']
44
+ if ENV["TINYTDS_SOURCE"]
45
+ gem "tiny_tds", path: ENV["TINYTDS_SOURCE"]
46
+ elsif ENV["TINYTDS_VERSION"]
47
+ gem "tiny_tds", ENV["TINYTDS_VERSION"]
48
48
  else
49
- gem 'tiny_tds'
49
+ gem "tiny_tds"
50
50
  end
51
51
  end
52
52
 
53
53
  group :development do
54
- gem 'byebug'
55
- gem 'mocha'
56
- gem 'minitest-spec-rails'
54
+ gem "pry-byebug", platform: [:mri, :mingw, :x64_mingw]
55
+ gem "mocha"
56
+ gem "minitest-spec-rails"
57
57
  end
58
58
 
59
59
  group :guard do
60
- gem 'guard'
61
- gem 'guard-minitest'
60
+ gem "guard"
61
+ gem "guard-minitest"
62
+ gem "terminal-notifier-guard" if RbConfig::CONFIG["host_os"] =~ /darwin/
62
63
  end
data/README.md CHANGED
@@ -7,17 +7,17 @@
7
7
 
8
8
  ## About The Adapter
9
9
 
10
- The SQL Server adapter for ActiveRecord v5.2 using SQL Server 2012 or higher.
10
+ The SQL Server adapter for ActiveRecord v6.0 using SQL Server 2012 or higher.
11
11
 
12
- Interested in older versions? We follow a rational versioning policy that tracks Rails. That means that our 5.1.x version of the adapter is only for the latest 5.1 version of Rails. If you need the adapter for SQL Server 2008 or 2005, you are still in the right spot. Just install the latest 3.2.x to 4.1.x version of the adapter that matches your Rails version. We also have stable branches for each major/minor release of ActiveRecord.
12
+ Interested in older versions? We follow a rational versioning policy that tracks Rails. That means that our 5.2.x version of the adapter is only for the latest 5.2 version of Rails. If you need the adapter for SQL Server 2008 or 2005, you are still in the right spot. Just install the latest 3.2.x to 4.1.x version of the adapter that matches your Rails version. We also have stable branches for each major/minor release of ActiveRecord.
13
13
 
14
14
  #### Native Data Type Support
15
15
 
16
16
  We support every data type supported by FreeTDS. All simplified Rails types in migrations will coorespond to a matching SQL Server national (unicode) data type. Always check the `initialize_native_database_types` [(here)](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/blob/master/lib/active_record/connection_adapters/sqlserver/schema_statements.rb) for an updated list.
17
17
 
18
- The following types (date, datetime2, datetimeoffset, time) all require TDS version 7.3 with TinyTDS. We recommend using FreeTDS 1.0 or higher which default to using `TDSVER` to "7.3". The adapter also sets TinyTDS's `tds_version` to this as well if non is specified.
18
+ The following types (`date`, `datetime2`, `datetimeoffset`, `time`) all require TDS version `7.3` with TinyTDS. We recommend using FreeTDS 1.0 or higher which default to using `TDSVER` to `7.3`. The adapter also sets TinyTDS's `tds_version` to this as well if non is specified.
19
19
 
20
- The Rails v5 adapter supports ActiveRecord's `datetime_with_precision` setting. This means that passing `:precision` to a datetime column is supported. Using a pecision with the `:datetime` type will signal the adapter to use the `datetime2` type under the hood.
20
+ The Rails v5 adapter supports ActiveRecord's `datetime_with_precision` setting. This means that passing `:precision` to a datetime column is supported. Using a precision with the `:datetime` type will signal the adapter to use the `datetime2` type under the hood.
21
21
 
22
22
 
23
23
  #### Identity Inserts with Triggers
@@ -80,9 +80,9 @@ end
80
80
  Every class that sub classes ActiveRecord::Base will now have an execute_procedure class method to use. This method takes the name of the stored procedure which can be a string or symbol and any number of variables to pass to the procedure. Arguments will automatically be quoted per the connection's standards as normal. For example:
81
81
 
82
82
  ```ruby
83
- Account.execute_procedure :update_totals, 'admin', nil, true
83
+ Account.execute_procedure(:update_totals, 'admin', nil, true
84
84
  # Or with named parameters.
85
- Account.execute_procedure :update_totals, named: 'params'
85
+ Account.execute_procedure(:update_totals, named: 'params')
86
86
  ```
87
87
 
88
88
  #### Explain Support (SHOWPLAN)
@@ -119,7 +119,7 @@ ActiveRecord::ConnectionAdapters::SQLServerAdapter.showplan_option = 'SHOWPLAN_X
119
119
 
120
120
  ## Installation
121
121
 
122
- The adapter has no strict gem dependencies outside of ActiveRecord. You will have to pick a connection mode, the default is dblib which uses the TinyTDS gem. Just bundle the gem and the adapter will use it.
122
+ The adapter has no strict gem dependencies outside of `ActiveRecord`. You will have to pick a connection mode, the default is dblib which uses the `TinyTDS` gem. Just bundle the gem and the adapter will use it.
123
123
 
124
124
  ```ruby
125
125
  gem 'tiny_tds'
@@ -139,30 +139,9 @@ If you would like to contribute a feature or bugfix, thanks! To make sure your f
139
139
 
140
140
  Many many people have contributed. If you do not see your name here and it should be let us know. Also, many thanks go out to those that have pledged financial contributions.
141
141
 
142
-
143
- ## Contributors
144
-
145
- Up-to-date list of contributors: http://github.com/rails-sqlserver/activerecord-sqlserver-adapter/contributors
146
-
147
- * metaskills (Ken Collins)
148
- * Annaswims (Annaswims)
149
- * wbond (Will Bond)
150
- * Thirdshift (Garrett Hart)
151
- * h-lame (Murray Steele)
152
- * vegantech
153
- * cjheath (Clifford Heath)
154
- * fryguy (Jason Frey)
155
- * jrafanie (Joe Rafaniello)
156
- * nerdrew (Andrew Ryan)
157
- * snowblink (Jonathan Lim)
158
- * koppen (Jakob Skjerning)
159
- * ebryn (Erik Bryn)
160
- * adzap (Adam Meehan)
161
- * neomindryan (Ryan Findley)
162
- * jeremydurham (Jeremy Durham)
163
-
142
+ You can see an up-to-date list of contributors here: http://github.com/rails-sqlserver/activerecord-sqlserver-adapter/contributors
164
143
 
165
144
  ## License
166
145
 
167
- Copyright © 2008-2017. It is free software, and may be redistributed under the terms specified in the MIT-LICENSE file.
146
+ Copyright © 2008-2020. It is free software, and may be redistributed under the terms specified in the [MIT-LICENSE](MIT-LICENSE) file.
168
147
 
@@ -3,6 +3,9 @@
3
3
 
4
4
  This process is much easier than it has been before!
5
5
 
6
+ ## MS SQL SERVER
7
+
8
+ If you don't have easy access to MS SQL Server, you can set up a Vagrant/VirtualBox virtual machine with MS SQL Server. [Here's how](/https://github.com/rails-sqlserver/activerecord-sqlserver-adapter-dev-box).
6
9
 
7
10
  ## TL;DR
8
11
 
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler/gem_tasks'
2
4
  require 'rake/testtask'
3
5
  require_relative 'test/support/paths_sqlserver'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 5.2.1
1
+ 6.0.0.rc1
@@ -1,21 +1,32 @@
1
- # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path("../lib", __FILE__)
3
- require "active_record/connection_adapters/sqlserver/version"
1
+ # frozen_string_literal: true
2
+
3
+ version = File.read(File.expand_path("VERSION", __dir__)).strip
4
4
 
5
5
  Gem::Specification.new do |spec|
6
- spec.name = 'activerecord-sqlserver-adapter'
7
- spec.version = ActiveRecord::ConnectionAdapters::SQLServer::Version::VERSION
6
+ spec.name = "activerecord-sqlserver-adapter"
8
7
  spec.platform = Gem::Platform::RUBY
9
- spec.license = 'MIT'
10
- spec.authors = ['Ken Collins', 'Anna Carey', 'Will Bond', 'Murray Steele', 'Shawn Balestracci', 'Joe Rafaniello', 'Tom Ward']
11
- spec.email = ['ken@metaskills.net', 'will@wbond.net']
12
- spec.homepage = 'http://github.com/rails-sqlserver/activerecord-sqlserver-adapter'
13
- spec.summary = 'ActiveRecord SQL Server Adapter.'
14
- spec.description = 'ActiveRecord SQL Server Adapter. SQL Server 2012 and upward.'
8
+ spec.version = version
9
+
10
+ spec.required_ruby_version = ">= 2.5.0"
11
+
12
+ spec.license = "MIT"
13
+ spec.authors = ["Ken Collins", "Anna Carey", "Will Bond", "Murray Steele", "Shawn Balestracci", "Joe Rafaniello", "Tom Ward"]
14
+ spec.email = ["ken@metaskills.net", "will@wbond.net"]
15
+ spec.homepage = "http://github.com/rails-sqlserver/activerecord-sqlserver-adapter"
16
+ spec.summary = "ActiveRecord SQL Server Adapter."
17
+ spec.description = "ActiveRecord SQL Server Adapter. SQL Server 2012 and upward."
18
+
19
+ spec.metadata = {
20
+ "bug_tracker_uri" => "https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/issues",
21
+ "changelog_uri" => "https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/blob/v#{version}/CHANGELOG.md",
22
+ "source_code_uri" => "https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/tree/v#{version}",
23
+ }
24
+
15
25
  spec.files = `git ls-files -z`.split("\x0")
16
26
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
27
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
- spec.require_paths = ['lib']
19
- spec.add_dependency 'activerecord', '~> 5.2.0'
20
- spec.add_dependency 'tiny_tds'
28
+ spec.require_paths = ["lib"]
29
+
30
+ spec.add_dependency "activerecord", "~> 6.0.0"
31
+ spec.add_dependency "tiny_tds"
21
32
  end
@@ -1,12 +1,23 @@
1
+ image: Visual Studio 2017
2
+ skip_tags: true
3
+ clone_depth: 5
4
+ build: off
5
+ matrix:
6
+ fast_finish: true
7
+ allow_failures:
8
+ - ruby_version: "25"
9
+ - ruby_version: "26"
10
+ - ruby_version: "27"
11
+ - ruby_version: "27-x64"
12
+ services:
13
+ - mssql2014
14
+
1
15
  init:
2
16
  - SET PATH=C:\Ruby%ruby_version%\bin;%PATH%
3
17
  - SET PATH=C:\MinGW\msys\1.0\bin;%PATH%
4
18
  - SET RAKEOPT=-rdevkit
5
- - SET TINYTDS_VERSION=2.1.0
6
- clone_depth: 5
7
- skip_tags: true
8
- matrix:
9
- fast_finish: true
19
+ - SET TINYTDS_VERSION=2.1.3.pre
20
+
10
21
  install:
11
22
  - ps: Update-AppveyorBuild -Version "$(Get-Content $env:appveyor_build_folder\VERSION).$env:appveyor_build_number"
12
23
  - ruby --version
@@ -14,26 +25,22 @@ install:
14
25
  - bundle install
15
26
  - gem uninstall bcrypt
16
27
  - gem install bcrypt --platform=ruby
17
- build: off
28
+
18
29
  test_script:
19
30
  - powershell -File "%APPVEYOR_BUILD_FOLDER%\test\appveyor\dbsetup.ps1"
20
31
  - timeout /t 4 /nobreak > NUL
21
- - ps: Start-Service 'MSSQL$SQL2014'
22
- - timeout /t 4 /nobreak > NUL
23
32
  - sqlcmd -S ".\SQL2014" -U sa -P Password12! -i %APPVEYOR_BUILD_FOLDER%\test\appveyor\dbsetup.sql
24
33
  - bundle exec rake test ACTIVERECORD_UNITTEST_DATASERVER="localhost\SQL2014"
25
- - ps: Stop-Service 'MSSQL$SQL2014'
26
- - ps: Start-Service 'MSSQL$SQL2012SP1'
27
- - timeout /t 4 /nobreak > NUL
28
- - sqlcmd -S ".\SQL2012SP1" -U sa -P Password12! -i %APPVEYOR_BUILD_FOLDER%\test\appveyor\dbsetup.sql
29
- - bundle exec rake test ACTIVERECORD_UNITTEST_DATASERVER="localhost\SQL2012SP1"
34
+
30
35
  environment:
31
36
  CI_AZURE_HOST:
32
37
  secure: VChrioaIWkf9iuuaSs4cryiA4honrADgZqNC0++begg=
33
38
  CI_AZURE_PASS:
34
39
  secure: cSQp8sk4urJYvq0utpsK+r7J+snJ2wpcdp8RdXJfB+w=
35
40
  matrix:
36
- - ruby_version: "23-x64"
37
- - ruby_version: "23"
38
- - ruby_version: "22-x64"
39
- - ruby_version: "22"
41
+ - ruby_version: "25-x64"
42
+ - ruby_version: "25"
43
+ - ruby_version: "26-x64"
44
+ - ruby_version: "26"
45
+ - ruby_version: "27-x64"
46
+ - ruby_version: "27"