Skip to content

Commit 97b3262

Browse files
authored
Merge pull request #961 from yellowspot/rails-7
Start Rails 7.0 support
2 parents 712e549 + ad80b7c commit 97b3262

File tree

11 files changed

+25
-76
lines changed

11 files changed

+25
-76
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
strategy:
1414
fail-fast: false
1515
matrix:
16-
ruby: [2.5.9, 2.6.7, 2.7.3, 3.0.1]
16+
ruby: [2.7.3, 3.0.1]
1717

1818
steps:
1919
- name: Checkout code

CHANGELOG.md

Lines changed: 6 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,15 @@
1-
## v6.1.2.1
2-
3-
[Full changelog](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/compare/v6.1.2.0...v6.1.2.1)
4-
5-
#### Fixed
6-
7-
- [#943](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/943) Fix appname resolution when outside Rails context
8-
9-
## v6.1.2.0
10-
11-
[Full changelog](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/compare/v6.1.1.0...v6.1.2.0)
1+
## Unreleased
122

133
#### Fixed
144

15-
- [#940](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/940) Primary key violation should result in RecordNotUnique error
5+
...
166

177
#### Changed
188

19-
- [#941](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/941) No longer support configuring the application name by overriding the 'configure_application_name' method.
20-
21-
## v6.1.1.0
22-
23-
[Full changelog](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/compare/v6.1.0.0...v6.1.1.0)
24-
25-
#### Fixed
9+
...
2610

27-
- [#933](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/933) Conditionally apply SQL Server monkey patches to ActiveRecord so that it is safe to use this gem alongside other database adapters (e.g. PostgreSQL) in a multi-database Rails app
28-
- [#935](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/935) Fix schema cache generation
29-
(**breaking change**)
30-
- [#936](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/936) Fix deteministic fetch when table has a composite primary key
31-
- [#938](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/938) Fix date columns serialization for range values
32-
33-
## v6.1.0.0
34-
35-
- No changes
36-
37-
## v6.1.0.0.rc1
38-
39-
[Full changelog](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/compare/6-0-stable...v6.1.0.0.rc1)
40-
41-
#### Fixed
42-
43-
- [#872](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/872) Use native String#start_with
44-
- [#876](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/876) Use native String#end_with
45-
- [#873](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/873) Various fixes to get the tests running for Rails 6.1
46-
- [#874](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/874) Deduplicate schema cache structures
47-
- [#875](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/875) Handle default boolean column values when deduplicating
48-
- [#879](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/879) Added visit method for HomogeneousIn
49-
- [#880](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/880) Handle any default column class when deduplicating
50-
- [#861](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/861) Fix Rails 6.1 database config
51-
- [#890](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/890) Fix removal of invalid ordering from select statements
52-
- [#881](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/881) Dump column collation to schema.rb and allow collation changes using column_change
53-
- [#891](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/891) Add support for if_not_exists to indexes
54-
- [#892](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/892) Add support for if_exists on remove_column
55-
- [#883](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/885) Fix quoting of ActiveRecord::Relation::QueryAttribute and ActiveModel::Attributes
56-
- [#893](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/893) Add Active Record Marshal forward compatibility tests
57-
- [#903](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/903) Raise ActiveRecord::ConnectionNotEstablished on calls to execute with a disconnected connection
58-
59-
#### Changed
11+
#### Added
6012

61-
- [#917](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/917) Refactored to use new_client connection pattern
13+
...
6214

63-
Please check [6-0-stable](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/blob/6-0-stable/CHANGELOG.md) for previous changes.
15+
Please check [6-1-stable](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/blob/6-1-stable/CHANGELOG.md) for previous changes.

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ gem "bcrypt"
1010
gem "pg", ">= 0.18.0"
1111
gem "sqlite3", "~> 1.4"
1212
gem "tzinfo-data", platforms: [:mingw, :mswin, :x64_mingw, :jruby]
13+
gem "benchmark-ips"
1314

1415
if ENV["RAILS_SOURCE"]
1516
gemspec path: ENV["RAILS_SOURCE"]

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@
99

1010
The SQL Server adapter for ActiveRecord using SQL Server 2012 or higher.
1111

12-
Interested in older versions? We follow a rational versioning policy that tracks Rails. That means that our 6.x version of the adapter is only for the latest 6.x 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 7.x version of the adapter is only for the latest 7.x 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.
1313

1414
| Adapter Version | Rails Version | Support |
1515
| --------------- | ------------- | ------------------------------------------------------------------------------------------- |
16-
| `6.1.2.1` | `6.1.x` | [active](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/tree/main) |
16+
| `7.0.0.0` | `7.0.x` | [unreleased](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/tree/main) |
17+
| `6.1.2.1` | `6.1.x` | [active](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/tree/6-1-stable) |
1718
| `6.0.2` | `6.0.x` | [active](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/tree/6-0-stable) |
1819
| `5.2.1` | `5.2.x` | [active](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/tree/5-2-stable) |
1920
| `5.1.6` | `5.1.x` | [ended](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/tree/5-1-stable) |
@@ -66,7 +67,7 @@ ActiveRecord::Base.table_name_prefix = 'dbo.'
6667
It's also possible to create/change/drop a schema in the migration file as in the example below:
6768

6869
```ruby
69-
class CreateFooSchema < ActiveRecord::Migration[6.0]
70+
class CreateFooSchema < ActiveRecord::Migration[7.0]
7071
def up
7172
create_schema('foo')
7273

@@ -188,4 +189,3 @@ You can see an up-to-date list of contributors here: http://github.com/rails-sql
188189
## License
189190

190191
Copyright © 2008-2020. It is free software, and may be redistributed under the terms specified in the [MIT-LICENSE](MIT-LICENSE) file.
191-

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
6.1.2.1
1+
7.0.0.0-beta.1

activerecord-sqlserver-adapter.gemspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
77
spec.platform = Gem::Platform::RUBY
88
spec.version = version
99

10-
spec.required_ruby_version = ">= 2.5.0"
10+
spec.required_ruby_version = ">= 2.7.0"
1111

1212
spec.license = "MIT"
1313
spec.authors = ["Ken Collins", "Anna Carey", "Will Bond", "Murray Steele", "Shawn Balestracci", "Joe Rafaniello", "Tom Ward"]
@@ -27,6 +27,6 @@ Gem::Specification.new do |spec|
2727
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
2828
spec.require_paths = ["lib"]
2929

30-
spec.add_dependency "activerecord", "~> 6.1.0"
30+
spec.add_dependency "activerecord", "~> 7.0.0"
3131
spec.add_dependency "tiny_tds"
3232
end

appveyor.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ build: off
55
matrix:
66
fast_finish: true
77
allow_failures:
8-
- ruby_version: "25"
9-
- ruby_version: "26"
108
- ruby_version: "27"
119
- ruby_version: "27-x64"
10+
- ruby_version: "30"
11+
- ruby_version: "30-x64"
1212
services:
1313
- mssql2014
1414

@@ -38,9 +38,7 @@ environment:
3838
CI_AZURE_PASS:
3939
secure: cSQp8sk4urJYvq0utpsK+r7J+snJ2wpcdp8RdXJfB+w=
4040
matrix:
41-
- ruby_version: "25-x64"
42-
- ruby_version: "25"
43-
- ruby_version: "26-x64"
44-
- ruby_version: "26"
4541
- ruby_version: "27-x64"
4642
- ruby_version: "27"
43+
- ruby_version: "30-x64"
44+
- ruby_version: "30"

lib/active_record/connection_adapters/sqlserver/database_statements.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ def execute_procedure(proc_name, *variables)
168168
case @connection_options[:mode]
169169
when :dblib
170170
result = ensure_established_connection! { dblib_execute(sql) }
171-
options = { as: :hash, cache_rows: true, timezone: ActiveRecord::Base.default_timezone || :utc }
171+
options = { as: :hash, cache_rows: true, timezone: ActiveRecord.default_timezone || :utc }
172172
result.each(options) do |row|
173173
r = row.with_indifferent_access
174174
yield(r) if block_given?
@@ -441,7 +441,7 @@ def handle_to_names_and_values(handle, options = {})
441441

442442
def handle_to_names_and_values_dblib(handle, options = {})
443443
query_options = {}.tap do |qo|
444-
qo[:timezone] = ActiveRecord::Base.default_timezone || :utc
444+
qo[:timezone] = ActiveRecord.default_timezone || :utc
445445
qo[:as] = (options[:ar_result] || options[:fetch] == :rows) ? :array : :hash
446446
end
447447
results = handle.each(query_options)

lib/active_record/connection_adapters/sqlserver/quoting.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,7 @@ def column_name_with_order_matcher
109109

110110
private_constant :COLUMN_NAME, :COLUMN_NAME_WITH_ORDER
111111

112-
private
113-
114-
def _quote(value)
112+
def quote(value)
115113
case value
116114
when Type::Binary::Data
117115
"0x#{value.hex}"
@@ -124,7 +122,7 @@ def _quote(value)
124122
end
125123
end
126124

127-
def _type_cast(value)
125+
def type_cast(value)
128126
case value
129127
when ActiveRecord::Type::SQLServer::Data
130128
value.to_s

lib/active_record/connection_adapters/sqlserver/type/date.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def serialize(value)
1313
value = super
1414
return value unless value.acts_like?(:date)
1515

16-
date = super(value).to_s(:_sqlserver_dateformat)
16+
date = super(value).to_formatted_s(:_sqlserver_dateformat)
1717
Data.new date, self
1818
end
1919

0 commit comments

Comments
 (0)