activerecord-sqlserver-adapter 7.2.5 → 7.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a0c48184b9fac12f23a4db11b01d1ed3d670fdd48f8c9705c690c830b622f11e
4
- data.tar.gz: 9e88d43c701da66870643b33684c9a2b2d58db063e419789d0b7faf6c5cf2e15
3
+ metadata.gz: c97e64045b3f48c88fb2bfaca1f2d6592f5e994fa2d97582847e7c159ea94256
4
+ data.tar.gz: 39c4c7fafd7a9cf6eb6dea39204cf51826532044bc8ae1477b2a844b9d85b4d8
5
5
  SHA512:
6
- metadata.gz: 40567edb70c619f8b9ae007c41b9b1c05157862df8bb275494b1158648c87cad3971bc1d4080431696c623d48c42356cf826349b3cce36a762d9e7d68a0d3102
7
- data.tar.gz: 162c65ce3cb0755f464798e0e55c651e72528f9e060c4dfd1d30ff8386fb54cbbe2f99c404f712a95c1567ec4892cc9833badcc73f8b4ce7469fdef8bdd2b039
6
+ metadata.gz: 317a59cbf7c2f55891b65a5d24a68b986f0b99a2610a630572c372344d0242b87de941eb81740497eda3ac0bde4bea44a638ea35f889ea9307cafc1d2cb8faf6
7
+ data.tar.gz: 5c20fa1cc28e1b27888e8759a1ae88bbffb638831696ef263765df3be50e491d4fab62c7bd5081c25da7a52dbf3e310885008b94f5608931e87af932038ffa4f
@@ -5,7 +5,7 @@ on: [push, pull_request]
5
5
  jobs:
6
6
  test:
7
7
  name: Run test suite
8
- runs-on: ubuntu-20.04 # TODO: Change back to 'ubuntu-latest' when https://github.com/microsoft/mssql-docker/issues/899 resolved.
8
+ runs-on: ubuntu-latest
9
9
 
10
10
  env:
11
11
  COMPOSE_FILE: docker-compose.ci.yml
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## v7.2.6
2
+
3
+ #### Fixed
4
+
5
+ - [#1333](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/1333) Enable identity insert on view's base table for fixtures.
6
+
1
7
  ## v7.2.5
2
8
 
3
9
  #### Fixed
data/VERSION CHANGED
@@ -1 +1 @@
1
- 7.2.5
1
+ 7.2.6
@@ -42,9 +42,6 @@ module ActiveRecord
42
42
  log(sql, name, binds, async: async) do |notification_payload|
43
43
  with_raw_connection do |conn|
44
44
  result = if id_insert_table_name = query_requires_identity_insert?(sql)
45
- # If the table name is a view, we need to get the base table name for enabling identity insert.
46
- id_insert_table_name = view_table_name(id_insert_table_name) if view_exists?(id_insert_table_name)
47
-
48
45
  with_identity_insert_enabled(id_insert_table_name, conn) do
49
46
  internal_exec_sql_query(sql, conn)
50
47
  end
@@ -194,11 +191,14 @@ module ActiveRecord
194
191
  end
195
192
 
196
193
  def with_identity_insert_enabled(table_name, conn)
197
- table_name = quote_table_name(table_name)
198
- set_identity_insert(table_name, conn, true)
194
+ # If the table name is a view, we need to get the base table name for enabling identity insert.
195
+ table_name = view_table_name(table_name) if view_exists?(table_name)
196
+ quoted_table_name = quote_table_name(table_name)
197
+
198
+ set_identity_insert(quoted_table_name, conn, true)
199
199
  yield
200
200
  ensure
201
- set_identity_insert(table_name, conn, false)
201
+ set_identity_insert(quoted_table_name, conn, false)
202
202
  end
203
203
 
204
204
  def use_database(database = nil)
@@ -48,11 +48,17 @@ class ViewTestSQLServer < ActiveRecord::TestCase
48
48
  end
49
49
  end
50
50
 
51
- describe 'identity insert' do
52
- it "identity insert works with views" do
53
- assert_difference("SSTestCustomersView.count", 1) do
51
+ describe "identity insert" do
52
+ it "creates table record through a view" do
53
+ assert_difference("SSTestCustomersView.count", 2) do
54
54
  SSTestCustomersView.create!(id: 5, name: "Bob")
55
+ SSTestCustomersView.create!(id: 6, name: "Tim")
55
56
  end
56
57
  end
58
+
59
+ it "creates table records through a view using fixtures" do
60
+ ActiveRecord::FixtureSet.create_fixtures(File.join(ARTest::SQLServer.test_root_sqlserver, "fixtures"), ["sst_customers_view"])
61
+ assert_equal SSTestCustomersView.all.count, 2
62
+ end
57
63
  end
58
64
  end
@@ -0,0 +1,6 @@
1
+ david:
2
+ name: "David"
3
+ balance: 2,004
4
+ aidan:
5
+ name: "Aidan"
6
+ balance: 10,191
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-sqlserver-adapter
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.2.5
4
+ version: 7.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ken Collins
@@ -15,7 +15,7 @@ authors:
15
15
  autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
- date: 2025-03-10 00:00:00.000000000 Z
18
+ date: 2025-05-20 00:00:00.000000000 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: activerecord
@@ -186,6 +186,7 @@ files:
186
186
  - test/config.yml
187
187
  - test/debug.rb
188
188
  - test/fixtures/1px.gif
189
+ - test/fixtures/sst_customers_view.yml
189
190
  - test/migrations/create_clients_and_change_column_collation.rb
190
191
  - test/migrations/create_clients_and_change_column_null.rb
191
192
  - test/migrations/transaction_table/1_table_will_never_be_created.rb
@@ -240,8 +241,8 @@ licenses:
240
241
  - MIT
241
242
  metadata:
242
243
  bug_tracker_uri: https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/issues
243
- changelog_uri: https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/blob/v7.2.5/CHANGELOG.md
244
- source_code_uri: https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/tree/v7.2.5
244
+ changelog_uri: https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/blob/v7.2.6/CHANGELOG.md
245
+ source_code_uri: https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/tree/v7.2.6
245
246
  post_install_message:
246
247
  rdoc_options: []
247
248
  require_paths:
@@ -305,6 +306,7 @@ test_files:
305
306
  - test/config.yml
306
307
  - test/debug.rb
307
308
  - test/fixtures/1px.gif
309
+ - test/fixtures/sst_customers_view.yml
308
310
  - test/migrations/create_clients_and_change_column_collation.rb
309
311
  - test/migrations/create_clients_and_change_column_null.rb
310
312
  - test/migrations/transaction_table/1_table_will_never_be_created.rb