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.
- checksums.yaml +4 -4
- data/.editorconfig +9 -0
- data/.github/issue_template.md +23 -0
- data/.travis.yml +6 -8
- data/CHANGELOG.md +22 -32
- data/{Dockerfile → Dockerfile.ci} +1 -1
- data/Gemfile +42 -41
- data/README.md +9 -30
- data/RUNNING_UNIT_TESTS.md +3 -0
- data/Rakefile +2 -0
- data/VERSION +1 -1
- data/activerecord-sqlserver-adapter.gemspec +25 -14
- data/appveyor.yml +24 -17
- data/docker-compose.ci.yml +7 -5
- data/guides/RELEASING.md +11 -0
- data/lib/active_record/connection_adapters/sqlserver/core_ext/active_record.rb +2 -0
- data/lib/active_record/connection_adapters/sqlserver/core_ext/attribute_methods.rb +2 -0
- data/lib/active_record/connection_adapters/sqlserver/core_ext/calculations.rb +2 -0
- data/lib/active_record/connection_adapters/sqlserver/core_ext/explain.rb +3 -1
- data/lib/active_record/connection_adapters/sqlserver/core_ext/explain_subscriber.rb +2 -0
- data/lib/active_record/connection_adapters/sqlserver/core_ext/finder_methods.rb +6 -4
- data/lib/active_record/connection_adapters/sqlserver/core_ext/preloader.rb +36 -0
- data/lib/active_record/connection_adapters/sqlserver/core_ext/query_methods.rb +4 -1
- data/lib/active_record/connection_adapters/sqlserver/database_limits.rb +9 -0
- data/lib/active_record/connection_adapters/sqlserver/database_statements.rb +55 -14
- data/lib/active_record/connection_adapters/sqlserver/database_tasks.rb +2 -0
- data/lib/active_record/connection_adapters/sqlserver/errors.rb +2 -0
- data/lib/active_record/connection_adapters/sqlserver/quoting.rb +38 -0
- data/lib/active_record/connection_adapters/sqlserver/schema_creation.rb +16 -3
- data/lib/active_record/connection_adapters/sqlserver/schema_dumper.rb +2 -0
- data/lib/active_record/connection_adapters/sqlserver/schema_statements.rb +93 -70
- data/lib/active_record/connection_adapters/sqlserver/showplan.rb +2 -0
- data/lib/active_record/connection_adapters/sqlserver/showplan/printer_table.rb +2 -0
- data/lib/active_record/connection_adapters/sqlserver/showplan/printer_xml.rb +2 -0
- data/lib/active_record/connection_adapters/sqlserver/sql_type_metadata.rb +2 -0
- data/lib/active_record/connection_adapters/sqlserver/table_definition.rb +42 -40
- data/lib/active_record/connection_adapters/sqlserver/transaction.rb +3 -1
- data/lib/active_record/connection_adapters/sqlserver/type.rb +2 -0
- data/lib/active_record/connection_adapters/sqlserver/type/big_integer.rb +3 -1
- data/lib/active_record/connection_adapters/sqlserver/type/binary.rb +5 -2
- data/lib/active_record/connection_adapters/sqlserver/type/boolean.rb +3 -1
- data/lib/active_record/connection_adapters/sqlserver/type/char.rb +5 -2
- data/lib/active_record/connection_adapters/sqlserver/type/data.rb +2 -0
- data/lib/active_record/connection_adapters/sqlserver/type/date.rb +3 -1
- data/lib/active_record/connection_adapters/sqlserver/type/datetime.rb +7 -6
- data/lib/active_record/connection_adapters/sqlserver/type/datetime2.rb +2 -0
- data/lib/active_record/connection_adapters/sqlserver/type/datetimeoffset.rb +2 -0
- data/lib/active_record/connection_adapters/sqlserver/type/decimal.rb +5 -2
- data/lib/active_record/connection_adapters/sqlserver/type/float.rb +3 -1
- data/lib/active_record/connection_adapters/sqlserver/type/integer.rb +3 -1
- data/lib/active_record/connection_adapters/sqlserver/type/json.rb +2 -0
- data/lib/active_record/connection_adapters/sqlserver/type/money.rb +4 -2
- data/lib/active_record/connection_adapters/sqlserver/type/real.rb +3 -1
- data/lib/active_record/connection_adapters/sqlserver/type/small_integer.rb +3 -1
- data/lib/active_record/connection_adapters/sqlserver/type/small_money.rb +4 -2
- data/lib/active_record/connection_adapters/sqlserver/type/smalldatetime.rb +3 -1
- data/lib/active_record/connection_adapters/sqlserver/type/string.rb +2 -0
- data/lib/active_record/connection_adapters/sqlserver/type/text.rb +3 -1
- data/lib/active_record/connection_adapters/sqlserver/type/time.rb +5 -4
- data/lib/active_record/connection_adapters/sqlserver/type/time_value_fractional.rb +2 -0
- data/lib/active_record/connection_adapters/sqlserver/type/timestamp.rb +3 -1
- data/lib/active_record/connection_adapters/sqlserver/type/tiny_integer.rb +3 -1
- data/lib/active_record/connection_adapters/sqlserver/type/unicode_char.rb +5 -2
- data/lib/active_record/connection_adapters/sqlserver/type/unicode_string.rb +2 -0
- data/lib/active_record/connection_adapters/sqlserver/type/unicode_text.rb +3 -1
- data/lib/active_record/connection_adapters/sqlserver/type/unicode_varchar.rb +6 -3
- data/lib/active_record/connection_adapters/sqlserver/type/unicode_varchar_max.rb +4 -2
- data/lib/active_record/connection_adapters/sqlserver/type/uuid.rb +3 -1
- data/lib/active_record/connection_adapters/sqlserver/type/varbinary.rb +6 -3
- data/lib/active_record/connection_adapters/sqlserver/type/varbinary_max.rb +4 -2
- data/lib/active_record/connection_adapters/sqlserver/type/varchar.rb +6 -3
- data/lib/active_record/connection_adapters/sqlserver/type/varchar_max.rb +4 -2
- data/lib/active_record/connection_adapters/sqlserver/utils.rb +2 -0
- data/lib/active_record/connection_adapters/sqlserver/version.rb +2 -0
- data/lib/active_record/connection_adapters/sqlserver_adapter.rb +44 -10
- data/lib/active_record/connection_adapters/sqlserver_column.rb +9 -3
- data/lib/active_record/sqlserver_base.rb +8 -0
- data/lib/active_record/tasks/sqlserver_database_tasks.rb +2 -0
- data/lib/activerecord-sqlserver-adapter.rb +2 -0
- data/lib/arel/visitors/sqlserver.rb +40 -10
- data/lib/arel_sqlserver.rb +2 -0
- data/test/appveyor/dbsetup.ps1 +4 -4
- data/test/cases/adapter_test_sqlserver.rb +65 -1
- data/test/cases/change_column_null_test_sqlserver.rb +2 -0
- data/test/cases/coerced_tests.rb +644 -187
- data/test/cases/column_test_sqlserver.rb +2 -1
- data/test/cases/connection_test_sqlserver.rb +2 -0
- data/test/cases/execute_procedure_test_sqlserver.rb +2 -0
- data/test/cases/fetch_test_sqlserver.rb +2 -0
- data/test/cases/fully_qualified_identifier_test_sqlserver.rb +4 -2
- data/test/cases/helper_sqlserver.rb +2 -0
- data/test/cases/in_clause_test_sqlserver.rb +36 -0
- data/test/cases/index_test_sqlserver.rb +2 -0
- data/test/cases/json_test_sqlserver.rb +2 -0
- data/test/cases/migration_test_sqlserver.rb +4 -2
- data/test/cases/order_test_sqlserver.rb +2 -0
- data/test/cases/pessimistic_locking_test_sqlserver.rb +2 -0
- data/test/cases/rake_test_sqlserver.rb +2 -0
- data/test/cases/schema_dumper_test_sqlserver.rb +3 -1
- data/test/cases/schema_test_sqlserver.rb +2 -0
- data/test/cases/scratchpad_test_sqlserver.rb +2 -0
- data/test/cases/showplan_test_sqlserver.rb +4 -2
- data/test/cases/specific_schema_test_sqlserver.rb +2 -0
- data/test/cases/transaction_test_sqlserver.rb +2 -1
- data/test/cases/trigger_test_sqlserver.rb +2 -1
- data/test/cases/utils_test_sqlserver.rb +2 -0
- data/test/cases/uuid_test_sqlserver.rb +2 -1
- data/test/debug.rb +2 -0
- data/test/migrations/create_clients_and_change_column_null.rb +2 -0
- data/test/migrations/transaction_table/1_table_will_never_be_created.rb +2 -0
- data/test/models/sqlserver/booking.rb +2 -0
- data/test/models/sqlserver/customers_view.rb +2 -0
- data/test/models/sqlserver/datatype.rb +2 -0
- data/test/models/sqlserver/datatype_migration.rb +2 -0
- data/test/models/sqlserver/dollar_table_name.rb +2 -0
- data/test/models/sqlserver/edge_schema.rb +2 -0
- data/test/models/sqlserver/fk_has_fk.rb +2 -0
- data/test/models/sqlserver/fk_has_pk.rb +2 -0
- data/test/models/sqlserver/natural_pk_data.rb +2 -0
- data/test/models/sqlserver/natural_pk_int_data.rb +2 -0
- data/test/models/sqlserver/no_pk_data.rb +2 -0
- data/test/models/sqlserver/object_default.rb +2 -0
- data/test/models/sqlserver/quoted_table.rb +2 -0
- data/test/models/sqlserver/quoted_view_1.rb +2 -0
- data/test/models/sqlserver/quoted_view_2.rb +2 -0
- data/test/models/sqlserver/sst_memory.rb +2 -0
- data/test/models/sqlserver/string_default.rb +2 -0
- data/test/models/sqlserver/string_defaults_big_view.rb +2 -0
- data/test/models/sqlserver/string_defaults_view.rb +2 -0
- data/test/models/sqlserver/tinyint_pk.rb +2 -0
- data/test/models/sqlserver/trigger.rb +2 -0
- data/test/models/sqlserver/trigger_history.rb +2 -0
- data/test/models/sqlserver/upper.rb +2 -0
- data/test/models/sqlserver/uppered.rb +2 -0
- data/test/models/sqlserver/uuid.rb +2 -0
- data/test/schema/sqlserver_specific_schema.rb +2 -0
- data/test/support/coerceable_test_sqlserver.rb +14 -5
- data/test/support/connection_reflection.rb +2 -0
- data/test/support/core_ext/query_cache.rb +3 -0
- data/test/support/load_schema_sqlserver.rb +2 -0
- data/test/support/minitest_sqlserver.rb +2 -0
- data/test/support/paths_sqlserver.rb +2 -0
- data/test/support/rake_helpers.rb +1 -0
- data/test/support/sql_counter_sqlserver.rb +3 -0
- data/test/support/test_in_memory_oltp.rb +2 -0
- metadata +18 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e38e0db2e61f2a8afd9e9068d13927a6bf2f326b765fe60acf2251740dc1fd2c
|
4
|
+
data.tar.gz: 5775ca711d927153804e9f6e7bce85af0c55a312268e49b7cb70aec1b9c153ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d94c57956ff87d407273cdd9fc2c1277be9238ef4c46631b3a1489875a9d1e719d7350afa5c6a7df1b7cce914c7e434ea00605c6269c1a27e881b0abf7c8fa12
|
7
|
+
data.tar.gz: cbacfa3df2a3005463c3d39686914fa7f2b5d517a06f177287f20f703d0b195ffdc1037b94cee70458c9fcaada7f45b8c84abc8e81cd78aff7a9ff6e3535eb19
|
data/.editorconfig
ADDED
@@ -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
|
+
|
data/.travis.yml
CHANGED
@@ -15,11 +15,9 @@ script:
|
|
15
15
|
- docker-compose run ci
|
16
16
|
matrix:
|
17
17
|
include:
|
18
|
-
- name: 2.
|
19
|
-
env: TARGET_VERSION=2.
|
20
|
-
- name: 2.
|
21
|
-
env: TARGET_VERSION=2.
|
22
|
-
- name: 2.
|
23
|
-
env: TARGET_VERSION=2.
|
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
|
data/CHANGELOG.md
CHANGED
@@ -1,40 +1,30 @@
|
|
1
|
-
##
|
1
|
+
## v6.0.0.rc1
|
2
2
|
|
3
3
|
#### Fixed
|
4
4
|
|
5
|
-
- #
|
6
|
-
- #
|
7
|
-
- #
|
8
|
-
- #
|
9
|
-
- #
|
10
|
-
- #
|
11
|
-
- #
|
12
|
-
- #
|
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
|
-
- #
|
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-
|
30
|
+
Please check [5-2-stable](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/blob/5-2-stable/CHANGELOG.md) for previous changes.
|
data/Gemfile
CHANGED
@@ -1,62 +1,63 @@
|
|
1
|
-
|
2
|
-
source 'https://rubygems.org'
|
3
|
-
gemspec
|
1
|
+
# frozen_string_literal: true
|
4
2
|
|
5
|
-
|
6
|
-
gem 'bcrypt'
|
7
|
-
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
|
3
|
+
source "https://rubygems.org"
|
8
4
|
|
9
|
-
|
10
|
-
|
11
|
-
|
5
|
+
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
6
|
+
|
7
|
+
gemspec
|
12
8
|
|
13
|
-
|
14
|
-
|
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
|
17
|
-
version = ENV[
|
18
|
-
require
|
19
|
-
require
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
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).
|
29
|
-
a, b, c = data[
|
30
|
-
!data[
|
31
|
-
end
|
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
|
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[
|
45
|
-
gem
|
46
|
-
elsif ENV[
|
47
|
-
gem
|
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
|
49
|
+
gem "tiny_tds"
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
53
|
group :development do
|
54
|
-
gem
|
55
|
-
gem
|
56
|
-
gem
|
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
|
61
|
-
gem
|
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
|
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.
|
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
|
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
|
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
|
83
|
+
Account.execute_procedure(:update_totals, 'admin', nil, true
|
84
84
|
# Or with named parameters.
|
85
|
-
Account.execute_procedure
|
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
|
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-
|
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
|
|
data/RUNNING_UNIT_TESTS.md
CHANGED
@@ -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
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
6.0.0.rc1
|
@@ -1,21 +1,32 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
|
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 =
|
7
|
-
spec.version = ActiveRecord::ConnectionAdapters::SQLServer::Version::VERSION
|
6
|
+
spec.name = "activerecord-sqlserver-adapter"
|
8
7
|
spec.platform = Gem::Platform::RUBY
|
9
|
-
spec.
|
10
|
-
|
11
|
-
spec.
|
12
|
-
|
13
|
-
spec.
|
14
|
-
spec.
|
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 = [
|
19
|
-
|
20
|
-
spec.add_dependency
|
28
|
+
spec.require_paths = ["lib"]
|
29
|
+
|
30
|
+
spec.add_dependency "activerecord", "~> 6.0.0"
|
31
|
+
spec.add_dependency "tiny_tds"
|
21
32
|
end
|
data/appveyor.yml
CHANGED
@@ -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.
|
6
|
-
|
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
|
-
|
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
|
-
|
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: "
|
37
|
-
- ruby_version: "
|
38
|
-
- ruby_version: "
|
39
|
-
- ruby_version: "
|
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"
|