rodauth-rails 1.6.1 → 1.6.2

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: 5ff93d3c4aca14c931fdf919c2eae17371105b3c4ca6cf584d699892cb705c7b
4
- data.tar.gz: 6bb909fe804de850bd1db16c4b0c0099f8755e1f17e874ab8973cfb1563cc88e
3
+ metadata.gz: f29cbaceb49208cac659dd31cbfcb874bf0df2c3b6b0133680f75904ab07a578
4
+ data.tar.gz: 2c9c7ed9e5d91428f15058274c0896298402e93d22a94c90c7d127e33699a1a7
5
5
  SHA512:
6
- metadata.gz: d49446ff0285df582268de3c4dc03eef155d3dea86a3887442412ed7a84469bb4af99781e0771c98edc895ea5c5b614ab549a3042c472108a24567676592fe2e
7
- data.tar.gz: c40379f9ec9c15152018fb7e6b0be8cf880ff4b59726615ccb3954ee7bfe529122258fc1f838e4b67581b8cfeff285ff2ad60dcfbb06fc0773eefa3c3ab9ba54
6
+ metadata.gz: 546070f740b95f26d8f29b632672339215383737e9b6497c64d613c3c07929052477022a4e70051254d267a037c7b794448674aa99927d26edb4322cf274f778
7
+ data.tar.gz: 638ecc60b072197c490180a8241ed5af02ed3d6114f3cf5aa2e621ced9296e175d6d5b579543e43d23283164d3193551eb68efd54b2ef3b68cb79f49462397d8
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 1.6.2 (2022-09-19)
2
+
3
+ * Use matching precision for current timestamp default values in Active Record 7.0+ migrations on MySQL (@janko)
4
+
1
5
  ## 1.6.1 (2022-09-19)
2
6
 
3
7
  * Fix argument error when calling `RodauthMailer` in default configuration (@janko)
@@ -110,9 +110,19 @@ module Rodauth
110
110
 
111
111
  def current_timestamp
112
112
  if ActiveRecord.version >= Gem::Version.new("5.0")
113
- %(-> { "CURRENT_TIMESTAMP" })
113
+ %(-> { "#{current_timestamp_literal}" })
114
114
  else
115
- %(OpenStruct.new(quoted_id: "CURRENT_TIMESTAMP"))
115
+ %(OpenStruct.new(quoted_id: "#{current_timestamp_literal}"))
116
+ end
117
+ end
118
+
119
+ # Active Record 7+ sets default precision to 6 for timestamp columns,
120
+ # so we need to ensure we match this when setting the default value.
121
+ def current_timestamp_literal
122
+ if ActiveRecord.version >= Gem::Version.new("7.0") && activerecord_adapter == "mysql2" && ActiveRecord::Base.connection.supports_datetime_with_precision?
123
+ "CURRENT_TIMESTAMP(6)"
124
+ else
125
+ "CURRENT_TIMESTAMP"
116
126
  end
117
127
  end
118
128
  else # Sequel
@@ -1,5 +1,5 @@
1
1
  module Rodauth
2
2
  module Rails
3
- VERSION = "1.6.1"
3
+ VERSION = "1.6.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rodauth-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.1
4
+ version: 1.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Janko Marohnić