counter_culture 2.9.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +16 -12
- data/Appraisals +0 -3
- data/CHANGELOG.md +13 -0
- data/Gemfile +0 -3
- data/README.md +1 -1
- data/lib/counter_culture/counter.rb +7 -1
- data/lib/counter_culture/reconciler.rb +6 -1
- data/lib/counter_culture/version.rb +1 -1
- metadata +2 -5
- data/gemfiles/rails_4.2.gemfile +0 -11
- data/gemfiles/rails_5.0.gemfile +0 -10
- data/gemfiles/rails_5.1.gemfile +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6e21168dbc07960cbb457996e275fe225426b9e96cd4b78a7dcd65ac13a0e006
|
4
|
+
data.tar.gz: 655b861dbd102fd40c0be44fc9f12c5a3a8b21682a8951597c7b4d2bcde3ea5e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 42ae36d35f8ad486b25477a89e87477a40909fb08ffd627c6441c2c4ce17ef038c5f92f3514bd2cc993fd01996f3e49ab2470481f2ab778dc620c2aa7f65d59c
|
7
|
+
data.tar.gz: 48ad4871eb41b4a97e5f53f41a671e4fef455fa2c70d475002de69bda1db8b1e8cc4af91b0c251d6ac1a4fba961ba5ab3eb2e821f9e9c8735a577728f7270338
|
data/.travis.yml
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
dist: focal
|
1
2
|
language: ruby
|
2
3
|
cache:
|
3
4
|
directories:
|
@@ -9,34 +10,37 @@ branches:
|
|
9
10
|
only:
|
10
11
|
- master
|
11
12
|
addons:
|
12
|
-
postgresql:
|
13
|
+
postgresql: '12'
|
14
|
+
apt:
|
15
|
+
packages:
|
16
|
+
- postgresql-12
|
17
|
+
- postgresql-client-12
|
13
18
|
rvm:
|
14
|
-
- "2.5.9"
|
15
19
|
- "2.6.8"
|
16
20
|
- "2.7.4"
|
17
21
|
- "3.0.2"
|
18
22
|
gemfile:
|
19
|
-
- gemfiles/rails_4.2.gemfile
|
20
|
-
- gemfiles/rails_5.0.gemfile
|
21
|
-
- gemfiles/rails_5.1.gemfile
|
22
23
|
- gemfiles/rails_5.2.gemfile
|
23
24
|
- gemfiles/rails_6.0.gemfile
|
24
25
|
- gemfiles/rails_6.1.gemfile
|
25
26
|
matrix:
|
26
27
|
exclude:
|
27
|
-
- rvm: "3.0.
|
28
|
-
gemfile: gemfiles/rails_4.2.gemfile
|
29
|
-
- rvm: "3.0.1"
|
30
|
-
gemfile: gemfiles/rails_5.0.gemfile
|
31
|
-
- rvm: "3.0.1"
|
32
|
-
gemfile: gemfiles/rails_5.1.gemfile
|
33
|
-
- rvm: "3.0.1"
|
28
|
+
- rvm: "3.0.2"
|
34
29
|
gemfile: gemfiles/rails_5.2.gemfile
|
35
30
|
env:
|
31
|
+
global:
|
32
|
+
- PGUSER=postgres
|
33
|
+
- PGPORT=5432
|
34
|
+
- PGHOST=localhost
|
35
|
+
jobs:
|
36
36
|
- DB=postgresql
|
37
37
|
- DB=sqlite3
|
38
38
|
- DB=mysql2
|
39
39
|
before_install:
|
40
|
+
- sudo sed -i -e '/local.*peer/s/postgres/all/' -e 's/peer\|md5/trust/g' /etc/postgresql/*/main/pg_hba.conf
|
41
|
+
- sudo service postgresql restart
|
42
|
+
- sleep 1
|
43
|
+
- postgres --version
|
40
44
|
- if [ "$BUNDLE_GEMFILE" = "$PWD/gemfiles/rails_4.2.gemfile" ]; then gem install bundler -v '1.17.3'; else gem install bundler -v '> 2'; fi
|
41
45
|
install:
|
42
46
|
- if [ "$BUNDLE_GEMFILE" = "$PWD/gemfiles/rails_4.2.gemfile" ]; then bundle _1.17.3_ update; else bundle update; fi
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,16 @@
|
|
1
|
+
## 3.0.0 (October 26, 2021)
|
2
|
+
|
3
|
+
Breaking changes:
|
4
|
+
- Dropped support for Ruby < 2.6
|
5
|
+
- Dropped support for Rails < 5.2
|
6
|
+
|
7
|
+
Note that there are no specific breaking changes that would cause older
|
8
|
+
versions of Ruby or Rails to stop working, we have simply stopped testing
|
9
|
+
against them.
|
10
|
+
|
11
|
+
Improvements:
|
12
|
+
- Support PostgreSql's `money` type for use with a delta column (#333)
|
13
|
+
|
1
14
|
## 2.9.0 (August 27, 2021)
|
2
15
|
|
3
16
|
Improvements:
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# counter_culture [![Build Status](https://travis-ci.com/magnusvk/counter_culture.svg)](https://travis-ci.com/magnusvk/counter_culture)
|
1
|
+
# counter_culture [![Build Status](https://app.travis-ci.com/magnusvk/counter_culture.svg?branch=master)](https://app.travis-ci.com/magnusvk/counter_culture)
|
2
2
|
|
3
3
|
Turbo-charged counter caches for your Rails app. Huge improvements over the Rails standard counter caches:
|
4
4
|
|
@@ -69,10 +69,16 @@ module CounterCulture
|
|
69
69
|
"#{model.connection.quote_column_name(change_counter_column)}"
|
70
70
|
end
|
71
71
|
|
72
|
+
column_type = klass.type_for_attribute(change_counter_column).type
|
73
|
+
|
72
74
|
# we don't use Rails' update_counters because we support changing the timestamp
|
73
75
|
updates = []
|
74
76
|
# this updates the actual counter
|
75
|
-
|
77
|
+
if column_type == :money
|
78
|
+
updates << "#{quoted_column} = COALESCE(CAST(#{quoted_column} as NUMERIC), 0) #{operator} #{delta_magnitude}"
|
79
|
+
else
|
80
|
+
updates << "#{quoted_column} = COALESCE(#{quoted_column}, 0) #{operator} #{delta_magnitude}"
|
81
|
+
end
|
76
82
|
# and here we update the timestamp, if so desired
|
77
83
|
if touch
|
78
84
|
current_time = obj.send(:current_time_from_proper_timezone)
|
@@ -187,7 +187,12 @@ module CounterCulture
|
|
187
187
|
# if a delta column is provided use SUM, otherwise use COUNT
|
188
188
|
return @count_select if @count_select
|
189
189
|
if delta_column
|
190
|
-
|
190
|
+
# cast the column as NUMERIC if it is a PG money type
|
191
|
+
if model.type_for_attribute(delta_column).type == :money
|
192
|
+
@count_select = "SUM(COALESCE(CAST(#{self_table_name}.#{delta_column} as NUMERIC),0))"
|
193
|
+
else
|
194
|
+
@count_select = "SUM(COALESCE(#{self_table_name}.#{delta_column}, 0))"
|
195
|
+
end
|
191
196
|
else
|
192
197
|
@count_select = "COUNT(#{self_table_name}.#{model.primary_key})*#{delta_magnitude}"
|
193
198
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: counter_culture
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Magnus von Koeller
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-10-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -272,9 +272,6 @@ files:
|
|
272
272
|
- Rakefile
|
273
273
|
- circle.yml
|
274
274
|
- counter_culture.gemspec
|
275
|
-
- gemfiles/rails_4.2.gemfile
|
276
|
-
- gemfiles/rails_5.0.gemfile
|
277
|
-
- gemfiles/rails_5.1.gemfile
|
278
275
|
- gemfiles/rails_5.2.gemfile
|
279
276
|
- gemfiles/rails_6.0.gemfile
|
280
277
|
- gemfiles/rails_6.1.gemfile
|
data/gemfiles/rails_4.2.gemfile
DELETED
data/gemfiles/rails_5.0.gemfile
DELETED