activerecord-libsql 0.1.0 → 0.1.1

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: 316c6c859b6a4934167b45e7932bd292cefa21f877056fcfc04f17473718ab09
4
- data.tar.gz: cbb445d607e0461fd2d2a1178ccc288636f85a3cd130f0a0fcd37f554a975826
3
+ metadata.gz: 7bd70521b40c17e3e116bdb9d70dec71bfa97b2ffbc651555b3f2e9c284b90e2
4
+ data.tar.gz: 5b33ef7cae18df4ffbe9c0805af0b82b1a4291a842a9cdef34ffabe43eddb849
5
5
  SHA512:
6
- metadata.gz: c9ec7a78ee4f271406d0eccc9c044d0828cfddda975dcdcb01bfcf17952f26608749d7c1b37c3d486d2f461802ba621b79178479b103f00ad4c4ab8f22bdcab4
7
- data.tar.gz: 9394fa8177b7a26e2cdee7c12ff72a1fbe7d079c2836c6b86e4580ab88d2536162b8ab0344fdd3e901de8a33aa7cc2b529924d48025c82b562b803815955b121
6
+ metadata.gz: a743362f8761cd6f69d157bfc266e9874178a3def3592b19f0cdc3391e0ea4fedf7cb7dfd2fb9cf394fffff6408ab313e2044dc934e98c269c7804f8dbd719a4
7
+ data.tar.gz: f15229b17113d1defa3fda201eb34c50ba5bb89b535198fb2f246dfa9f26d64baa36518c28c696c69d3341532336488c94d619abe5d7b5e547c41bbbe52a8324
@@ -41,6 +41,18 @@ module ActiveRecord
41
41
  )
42
42
  private_constant :READ_QUERY
43
43
 
44
+ # AR 8.1 で Column.new のシグネチャが変わったため、ロード時に一度だけ決定する
45
+ # AR <= 8.0: Column.new(name, default, sql_type_metadata, null)
46
+ # AR >= 8.1: Column.new(name, cast_type, default, sql_type_metadata, null)
47
+ COLUMN_BUILDER =
48
+ if ActiveRecord::VERSION::MAJOR > 8 ||
49
+ (ActiveRecord::VERSION::MAJOR == 8 && ActiveRecord::VERSION::MINOR >= 1)
50
+ ->(name, cast_type, default, sql_type_md, null) { Column.new(name, cast_type, default, sql_type_md, null) }
51
+ else
52
+ ->(name, _cast_type, default, sql_type_md, null) { Column.new(name, default, sql_type_md, null) }
53
+ end
54
+ private_constant :COLUMN_BUILDER
55
+
44
56
  # -----------------------------------------------------------------------
45
57
  # Adapter 識別
46
58
  # -----------------------------------------------------------------------
@@ -208,14 +220,8 @@ module ActiveRecord
208
220
  sql_type = row['type'].to_s
209
221
  cast_type = type_map.lookup(sql_type) || Type::Value.new
210
222
  sql_type_md = fetch_type_metadata(sql_type)
211
- # AR 8.1: Column.new(name, cast_type, default, sql_type_metadata, null)
212
- Column.new(
213
- row['name'],
214
- cast_type,
215
- row['dflt_value'],
216
- sql_type_md,
217
- row['notnull'].to_i.zero?
218
- )
223
+ null = row['notnull'].to_i.zero?
224
+ COLUMN_BUILDER.call(row['name'], cast_type, row['dflt_value'], sql_type_md, null)
219
225
  end
220
226
  end
221
227
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module ActiveRecord
4
4
  module Libsql
5
- VERSION = '0.1.0'
5
+ VERSION = '0.1.1'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-libsql
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - aileron