activerecord-sqlserver-adapter 7.0.4.0 → 7.0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 41b4642838dbc7178a170c4b002937e5481bf0c7154446d43cff2dae7800a938
4
- data.tar.gz: fa20040c55e79a8417ec58c414b5ad6617acaa2fe808c5b48fc44c6e3187c5d7
3
+ metadata.gz: 817f19cbeb123346a8b663abe75e79a93af2b318189d4e4ff0b1a74414ccfd65
4
+ data.tar.gz: e9e323ec3d0174bd241ab6c841fbc7b3d204c1019c79cb7eefe47cff72b31da4
5
5
  SHA512:
6
- metadata.gz: b7786aeaaf3f90af8a69208e76901c1263e20ef1c4f410948319108531e128ff2d5247838efb10cbcda0fe6b035d1b130576647824e027a668b0fc3df1988305
7
- data.tar.gz: 3d9db5b28f4b8b8468b71049b14b7000e25c7aa7afcac55f6fec0ec234f0e4cdf76c4158069328da464ad0a718f45ee9b45b2b6f19f00fc058b7d4ab87071308
6
+ metadata.gz: ace03652a84e2943c84cf9fb2fa303fb5c26e9969f4d6375f09a8ddc5cb8a6bf84ac7609d39f9c97c3ffeaba8ef9b0b60f34c3483e576983977b87aa576cd7d4
7
+ data.tar.gz: e8802d4c5c5d936f6b9dbcd53323785830756b1d605d550cc302e0ca3b3862819e12ccc4b87a5a4982f70561b1a58a16422ed776cfd7dabd842aa355895253b1
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## v7.0.5.0
2
+
3
+ #### Fixed
4
+
5
+ - [#1113](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/1113) Fix issue with default view value not being found because of case sensitivity
6
+ - [#1126](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/1113) Fix view issue with default column value not found
7
+
1
8
  ## v7.0.4.0
2
9
 
3
10
  #### Changed
data/VERSION CHANGED
@@ -1 +1 @@
1
- 7.0.4.0
1
+ 7.0.5.0
@@ -388,7 +388,7 @@ module ActiveRecord
388
388
 
389
389
  if view_exists
390
390
  results = sp_executesql %{
391
- SELECT c.COLUMN_NAME AS [name], c.COLUMN_DEFAULT AS [default]
391
+ SELECT LOWER(c.COLUMN_NAME) AS [name], c.COLUMN_DEFAULT AS [default]
392
392
  FROM #{database}.INFORMATION_SCHEMA.COLUMNS c
393
393
  WHERE c.TABLE_NAME = #{quote(view_tblnm)}
394
394
  }.squish, "SCHEMA", []
@@ -426,7 +426,7 @@ module ActiveRecord
426
426
  ci[:default_function] = begin
427
427
  default = ci[:default_value]
428
428
  if default.nil? && view_exists
429
- view_column = views_real_column_name(table_name, ci[:name])
429
+ view_column = views_real_column_name(table_name, ci[:name]).downcase
430
430
  default = default_functions[view_column] if view_column.present?
431
431
  end
432
432
  case default
@@ -620,7 +620,7 @@ module ActiveRecord
620
620
  view_definition = view_information(table_name)[:VIEW_DEFINITION]
621
621
  return column_name unless view_definition
622
622
 
623
- match_data = view_definition.match(/([\w-]*)\s+as\s+#{column_name}/im)
623
+ match_data = view_definition.match(/CREATE\s+VIEW.*AS\s+SELECT.*\W([\w-]*)\s+AS\s+#{column_name}/im)
624
624
  match_data ? match_data[1] : column_name
625
625
  end
626
626
 
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "cases/helper_sqlserver"
4
+
5
+ class ViewTestSQLServer < ActiveRecord::TestCase
6
+ let(:connection) { ActiveRecord::Base.connection }
7
+
8
+ describe 'view with default values' do
9
+ before do
10
+ connection.drop_table :view_casing_table rescue nil
11
+ connection.create_table :view_casing_table, force: true do |t|
12
+ t.boolean :Default_Falsey, null: false, default: false
13
+ t.boolean :Default_Truthy, null: false, default: true
14
+ t.string :default_string, null: false, default: "abc"
15
+ end
16
+
17
+ connection.execute("DROP VIEW IF EXISTS view_casing_table_view;")
18
+ connection.execute <<-SQL
19
+ CREATE VIEW view_casing_table_view AS
20
+ SELECT id AS id,
21
+ default_falsey AS falsey,
22
+ default_truthy AS truthy,
23
+ default_string AS s
24
+ FROM view_casing_table
25
+ SQL
26
+ end
27
+
28
+ it "default values are correct when column casing used in tables and views are different" do
29
+ klass = Class.new(ActiveRecord::Base) do
30
+ self.table_name = "view_casing_table_view"
31
+ end
32
+
33
+ obj = klass.new
34
+ assert_equal false, obj.falsey
35
+ assert_equal true, obj.truthy
36
+ assert_equal "abc", obj.s
37
+ assert_equal 0, klass.count
38
+
39
+ obj.save!
40
+ assert_equal false, obj.falsey
41
+ assert_equal true, obj.truthy
42
+ assert_equal "abc", obj.s
43
+ assert_equal 1, klass.count
44
+ end
45
+ end
46
+ end
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.0.4.0
4
+ version: 7.0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ken Collins
@@ -12,10 +12,10 @@ authors:
12
12
  - Joe Rafaniello
13
13
  - Tom Ward
14
14
  - Aidan Haran
15
- autorequire:
15
+ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
- date: 2023-09-19 00:00:00.000000000 Z
18
+ date: 2023-11-06 00:00:00.000000000 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: activerecord
@@ -177,6 +177,7 @@ files:
177
177
  - test/cases/trigger_test_sqlserver.rb
178
178
  - test/cases/utils_test_sqlserver.rb
179
179
  - test/cases/uuid_test_sqlserver.rb
180
+ - test/cases/view_test_sqlserver.rb
180
181
  - test/config.yml
181
182
  - test/debug.rb
182
183
  - test/fixtures/1px.gif
@@ -230,9 +231,9 @@ licenses:
230
231
  - MIT
231
232
  metadata:
232
233
  bug_tracker_uri: https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/issues
233
- changelog_uri: https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/blob/v7.0.4.0/CHANGELOG.md
234
- source_code_uri: https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/tree/v7.0.4.0
235
- post_install_message:
234
+ changelog_uri: https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/blob/v7.0.5.0/CHANGELOG.md
235
+ source_code_uri: https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/tree/v7.0.5.0
236
+ post_install_message:
236
237
  rdoc_options: []
237
238
  require_paths:
238
239
  - lib
@@ -247,8 +248,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
247
248
  - !ruby/object:Gem::Version
248
249
  version: '0'
249
250
  requirements: []
250
- rubygems_version: 3.4.10
251
- signing_key:
251
+ rubygems_version: 3.4.7
252
+ signing_key:
252
253
  specification_version: 4
253
254
  summary: ActiveRecord SQL Server Adapter.
254
255
  test_files:
@@ -291,6 +292,7 @@ test_files:
291
292
  - test/cases/trigger_test_sqlserver.rb
292
293
  - test/cases/utils_test_sqlserver.rb
293
294
  - test/cases/uuid_test_sqlserver.rb
295
+ - test/cases/view_test_sqlserver.rb
294
296
  - test/config.yml
295
297
  - test/debug.rb
296
298
  - test/fixtures/1px.gif