Bugfixes:
- Use ActiveRecord version, not Rails version, to make it possible to use
counter_culture_fix_counts
without Rails - Tests no longer require Rails, making sure we do not introduce this regression again
Bugfixes:
- Fix compatibility with
mobility
gem by skipping attributes that don't exist in the database but show up insaved_changes
(#401)
New features:
- Prefer using
with_connection
where possible (#398)
New features:
- Combine multiple updates into a single SQL per target row (#393)
Improvements:
- Don't perform a query if the
delta_magnitude
is zero (#394)
Bugfixes:
- Correct polymorphic table name alias reference in join clauses (#388)
Bugfixes:
- Assign attributes to the duped model on a lower level when determining whether a model has changed to avoid invoking unrelated callbacks (#386)
Bugfixes:
- Fix touching for counted models without
updated_at
(#383)
Improvements:
- Allow passing context to
counter_culture_fix_counts
(#375)
Improvements:
- Ability to skip counter culture updates in a block (#371)
Bugfixes:
- Read primary key on polymorphic associations if it's explicitly set (#370)
Improvements:
- Allow reading from replica in
counter_culture_fix_counts
(#330) - Test against Ruby 3.1 (#357)
Bugfixes:
- Don't decrement counter cache when calling
.destroy
on an already-destroyed model (#351) - Don't immediately call
Proc
passed tocolumn_names
to avoid startup issue (#352)
Bugfixes:
- Fix
counter_culture_fix_counts
when passing it symbols for column names (#341)
Improvements:
- Allow specifiying
polymorphic_classes
to avoid a potentially expensiveDISTINCT
query when callingcounter_culture_fix_counts
(#336)
Bugfixes:
- Fix primary key name for enumerable relations (#337)
Improvements:
- Allow specifiying a
Proc
tocolumn_names
to avoid loading a scope on startup (#335)
Breaking changes:
- Dropped support for Ruby < 2.6
- Dropped support for Rails < 5.2
Note that there are no specific breaking changes that would cause older versions of Ruby or Rails to stop working, we have simply stopped testing against them.
Improvements:
- Support PostgreSql's
money
type for use with a delta column (#333)
Improvements:
- Allow
execute_after_commit
to be aProc
for dynamic control (#326)
Improvements:
- New
execute_after_commit
option (#309)
Improvements:
- New
column_name
option forcounter_culture_fix_counts
(#300)
Improvements:
- Remove superfluous dependency to after_commit_action gem (#297)
Bugfixes:
- Address Ruby 2.7.0 deprecation warning (#292)
Improvements:
- Use []= method instead of attribute writer method internally to avoid conflicts with read-only attributes (#287)
- More detailed logging when performing reconciliation (#288)
Bugfixes:
- Fix migration generation in Rails 6+ (#281)
Bugfixes:
- Fix
counter_culture_fix_counts
with Rails 4.2
Changes:
- Dropped support for Ruby 2.3 and 2.4
Improvements:
- Allow specifying
start
andfinish
options tocounter_culture_fix_counts
(#279)
Improvements:
- Allow using scopes in
column_names
(#272)
Bugfixes:
- Test and fix behavior in Rails 6.0.0 release (#268)
Improvements:
- Start testing against MySQL and PostgreSQL as well as sqlite3 (#257)
Bugfixes:
- Fix edge cases in MySQL (#257)
Bugfixes:
- Don't fail reconciliation in PostgreSQL if the Rails-level primary key is not a DB primary key (#254)
Improvements:
- Improve logging when
verbose
is set (#256)
Improvements:
- Add
where
option tocounter_culture_fix_counts
(#250) - Add
verbose
option tocounter_culture_fix_counts
(#251)
Changes:
- Dropped support for Ruby 2.2
- Dropped support for Rails 3.2, 4.0 and 4.1
Improvements:
- Avoid instantiating model class during
counter_culture
call (#246)
Bugfixes:
- Don't update running total on soft-deleted records (#244)
Bugfixes:
- Properly handle
destroy
andreally_destroy
when using Paranoia (#239)
Bugfixes:
- Don't double-decrement when discarding and then hard-destroying a record (#237)
Bugfixes:
- Fix behavior with Models that are part of a module (ex:
Users::Admin
) (#234)
Bugfixes:
- Properly set timestamps of PaperTrail versions (#224, #225, #226)
Breaking changes:
- execute_after_commit was removed
- Removed workaround for incorrect counts when triggering updates from an
after_create
hook. Your options if this applies to you:- continue using counter_culture 1.12.0
- upgrade to Rails 5.1.5 which fixes the underlying issue in Rails
- avoid triggering further updates on the same model in
after_create
; simply set the attribute inbefore_create
instead
Bugfixes:
- Multiple updates in one transaction will now be processed correctly (#222)
Improvements:
- Adds support for the Discard soft-delete gem (#220)
Bugfixes:
- Fix
with_papertrail
behavior while still addressing the deprecation warning, and actually recording the correct counts (#218, see airblade/paper_trail#1076)
Improvements:
- Added the ability to update timestamps while fixing count by passing
touch: true
tocounter_culture_fix_counts
(#212)
Bugfixes:
- When using paranoia, call increment / decrement only once when calling destroy or restore on the same model multiple times
Improvements:
- Address deprecation warning when enabling paper_trail touch in paper_trail version 9.0
- Address
Arel
deprecation warnings in Rails 5.2
Changes:
- Test against Ruby 2.2 through 2.5, Rails 3.2 through 5.2
- Don't test Rails 3.2 through 4.1 against Ruby 2.4 or 2.5 as those versions of Rails will not work with those versions of Ruby
- Avoid various deprecation warnings being triggered in the test
Bugfixes:
- Address an edge-case test regression caused by Rails 5.1.5 that was causing counts to be off when saving changes from an
after_create
callback
Improvements:
- Switch generated migration files to use new hash syntax
- Support for Rails 5 migration file format for generated migrations
Bugfixes:
- Actually use
batch_size
parameter incounter_culture_fix_counts
(#200)
Improvements:
- Use ActiveRecord version, not Rails version, in
Reconciler
, making it possible to usecounter_culture_fix_counts
without Rails
Improvements:
- Quote all table names to work correctly with PostgreSQL schemata
- Use ActiveRecord version, not Rails version, to make things work for projects that use ActiveRecord but not Rails
Improvements:
- Support for creating
paper_trail
versions when counters change
Bugfixes:
- Restore compatibility with older Rails versions
Bugfixes:
- Fix
counter_culture_fix_counts
for a multi-level relation where an intermediate link ishas_one
, rather thanbelongs_to
Improvements:
- Keeps counts updated correctly when using the paranoia gem and restoring soft-deleted records
Bugfixes:
- Support for
nil
values in polymorphic relationships
New features:
- Support for counter caches on one-level polymorphic relationships
Improvements:
- Avoid Rails 5.1 deprecation warnings
Bugfixes:
- Removed requirement for Rails 5 added by mistake (in fact, this gem supports and tests Rails versions as far back as Rails 3.2 now)
Removed features:
- Removed support for
has_one
; this did not work properly. If you need this, consider adding thecounter_culture
call on the model with thebelongs_to
instead.
New features:
- Add support for custom timestamp column with
touch
option
Bugfixes:
- Don't blow up if the
column_names
hash contains anil
column name
Improvements:
- Support for
has_one
associations
Breaking changes:
- By default, counter_culture will now update counts inside the same transaction that triggered it. In older versions, counter cache updates happened outside of that transaction. To preserve the old behavior, use the new
execute_after_commit
option.
Improvements:
- When running
fix_counts
on a table, wrap each batch in a transaction because that is faster on large tables.
Bugfixes:
- Use
ActiveSupport.on_load
for better Rails 5 compatibility (see rails/rails#23589)
Improvements:
Improvments:
- Major refactor of the code that reduces ActiveRecord method pollution. Documented API is unchanged, but behind the scenes a lot has changed.
- Ability to configure batch size of
counter_culture_fix_size
Bugfixes:
- Fixes an issue when using a default scope that adds a join in conjunction with counter_culture
Bugfixes:
- Fixes an issue with STI classes and inheritance
Improvements:
- Restores compatibility with Rails 3.2 (fixes #100)
Bugfixes:
- Avoid issue with has_and_belongs_to_many and transactions by using new after_commit_action version (fixes #88)
Bugfixes:
- Correctly use custom relation primary keys (fixes #93)
Bugfixes:
- Fix fixing counts with multi-level STI models
Bugfixes:
- fixes development and test dependencies
Bugfixes:
- re-add after_commit_action as a dependency, that had gone missing in 0.1.26
Bugfixes:
- makes fix_counts work correctly with self-referential tables
Bugfixes:
- makes fix_counts work correctly with custom primary keys
Bugfixes:
- correctly uses custom primary keys when incrementing / decrementing counts
Bugfixes:
- fixes problems fixing conditional counter caches with batching
Improvements:
- support for single-table inheritance in counter_culture_fix_counts
Bugfixes:
- makes the migration generator compatible with Rails 4.1
Bugfixes:
- counter_culture_fix counts now supports float values, where it forced integer values previously
Bugfixes:
- Use correct date / time formatting for touch option (fixes a problem with MySQL databases)
Bugfixes:
- Correctly fix counter caches, even when there are no dependent records
Bugfixes:
- Avoid Rails 4 deprecation warning
Features:
- Added support for touch option that updates timestamps when updating counter caches
Features:
- Added a simple migration generator to simplify adding counter cache columns
Improvements:
- delta_column now supports float values
Bugfixes:
- Prevent running out of memory when running counter_culture_fix_counts in large tables