activerecord-cached_at 7.0.0 → 7.1.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: 79e3b29684f0a17923d328876ac4cfa8e839a4f8ce8d5c11f8cb57961a737b1a
4
- data.tar.gz: 0a9a34b66da4bc0019b9cebaa5a35befb1a442711fe2660553d0362f9ac5936a
3
+ metadata.gz: a06a10c91336f7e319a46263bb7f3860c3c21e861c9e50c6263fc414a1e6cfbb
4
+ data.tar.gz: 7c1e74bb4eb06fa0a1bcc70f8eade6b87cf835b3f7d72da86192edd65b2bd2ed
5
5
  SHA512:
6
- metadata.gz: c5f8b1069214be9721b925c4e41fab372a04c0dadcea5bff50caffd1f87a00342453ea318ffc3f64851532c281530b7929f9d5d9cddf93f31786139a450a56aa
7
- data.tar.gz: cb5fe100c8103e71378fdfb78762e74723ca8822dbf8387148fcdf568371e918780eb95faa201b50f82b63d798039cf175b00c27e9b4e5ff81fb7e374a3f29f4
6
+ metadata.gz: 6a66a1cb25a04423178c5a2d5ca1e818f3681756c613b7fc0ad5356b7760db762ac64377c4ac2b14f5cbee7fe2562686e9801812e792495de0682b81fffa6f37
7
+ data.tar.gz: 234132056063c4e157890bbad45728b29f0ffd899a4170f53bc8c2563206cda5c7abc697da532fbfb738fc147d58e56ae15ca36584078a9775987b37fe991cba
@@ -2,22 +2,8 @@ module ActiveRecord
2
2
  module ConnectionAdapters #:nodoc:
3
3
 
4
4
  module SchemaStatements
5
- def add_timestamps(table_name, **options)
6
- options[:null] = false if options[:null].nil?
7
-
8
- if !options.key?(:precision) && supports_datetime_with_precision?
9
- options[:precision] = 6
10
- end
11
-
12
- add_column table_name, :created_at, :datetime, **options
13
- add_column table_name, :updated_at, :datetime, **options
14
- add_column table_name, :cached_at, :datetime, **options
15
- end
16
-
17
5
  def remove_timestamps(table_name, **options)
18
- remove_column table_name, :updated_at
19
- remove_column table_name, :created_at
20
- remove_column table_name, :cached_at
6
+ remove_columns table_name, :updated_at, :created_at, :cached_at
21
7
  end
22
8
 
23
9
  def add_timestamps_for_alter(table_name, **options)
@@ -33,12 +19,26 @@ module ActiveRecord
33
19
  add_column_for_alter(table_name, :cached_at, :datetime, **options)
34
20
  ]
35
21
  end
22
+ end
36
23
 
37
- def remove_timestamps_for_alter(table_name, **options)
38
- remove_columns_for_alter(table_name, :updated_at, :created_at, :cached_at)
39
- end
24
+ end
25
+ end
40
26
 
41
- end
42
27
 
28
+ ActiveSupport.on_load(:active_record_sqlite3adapter) do
29
+ class ActiveRecord::ConnectionAdapters::SQLite3Adapter
30
+ def add_timestamps(table_name, **options)
31
+ options[:null] = false if options[:null].nil?
32
+
33
+ if !options.key?(:precision)
34
+ options[:precision] = 6
35
+ end
36
+
37
+ alter_table(table_name) do |definition|
38
+ definition.column :created_at, :datetime, **options
39
+ definition.column :updated_at, :datetime, **options
40
+ definition.column :cached_at, :datetime, **options
41
+ end
42
+ end
43
43
  end
44
44
  end
@@ -62,7 +62,7 @@ module CachedAt
62
62
  timestamp = timestamp_keys.map { |attr| self[attr]&.to_time }.compact.max
63
63
  end
64
64
 
65
- timestamp.utc.to_s(:usec)
65
+ timestamp.utc.to_fs(:usec)
66
66
  end
67
67
 
68
68
  # TODO
@@ -1,3 +1,3 @@
1
1
  module CachedAt
2
- VERSION = '7.0.0'
2
+ VERSION = '7.1.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-cached_at
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.0.0
4
+ version: 7.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jon Bracy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-12-04 00:00:00.000000000 Z
11
+ date: 2023-12-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 7.0.0
19
+ version: 7.1.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 7.0.0
26
+ version: 7.1.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: pg
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: sqlite3
85
99
  requirement: !ruby/object:Gem::Requirement