Skip to content

Latest commit

 

History

History
390 lines (302 loc) · 17.7 KB

CHANGELOG.md

File metadata and controls

390 lines (302 loc) · 17.7 KB

Ancestry Changelog

Doing our best at supporting SemVer with a nice looking Changelog.

Version HEAD Unreleased

  • Introduce orphan_strategy: :none #658
  • Introduce rebuild_counter_cache! to reset counter caches. #663 #668 (thx @RongRongTeng)
  • Documentation fixes #664 #667 (thx @motokikando, @onerinas)
  • Introduce build_cache_depth_sql!, a sql alternative to build_cache_depth #654
  • Drop ancestry_primary_key_format #649
  • When destroying orphans, going from leafs up to node #635 (thx @brendon)
  • Changed config setters to class readers #633 (thx @kshurov)
  • Split apply_orphan_strategy into multiple methods #632 #633

Notable features

Depth scopes now work without cache_depth. But please only use this in background jobs. If you need to do this in the ui, please use cache_depth.

build_cache_depth_sql! is quicker than build_cache_depth! (1 query instead of N+1 queries).

Deprecations

  • Option :depth_cache_column is going away. Please use a single key instead: cache_depth: :depth_cach_column_name. cache_depth: true still defaults to ancestry_depth.

Breaking Changes

  • Options are no longer set via class methods. Using has_ancestry is now the only way to enable these features. These are all not part of the public API.
    • These are now class level read only accessors
      • ancestry_base_class (introduced 1.1, removed by #633)
      • ancestry_column (introduced 1.2, removed by #633)
      • ancestry_delimiter (introduced 4.3.0, removed by #633)
      • depth_cache_column (introduced 4.3.0, removed by #654)
    • These no longer have any accessors
      • ancestry_format (introduced 4.3.0, removed by #654)
      • orphan_strategy (introduced 1.1, removed by #617)
      • ancestry_primary_key_format (introduced 4.3.0, removed by #649)
      • touch_ancestors (introduced 2.1, removed by TODO)
  • These are seen as internal and may go away:
    • apply_orphan_strategy Please use orphan_strategy: :none and a custom before_destory instead.

Version 4.3.3 2023-04-01

  • Fix: sort_by_ancesty with custom ancestry_column #656 (thx @mitsuru)

Version 4.3.2 2023-03-25

  • Fix: added back fields that were removed in #589 #647 (thx @rastamhadi)
    • path_ids_in_database

Version 4.3.1 2023-03-19

  • Fix: added back fields that were removed in #589 #637 (thx @znz)
    • ancestor_ids_in_database
    • parent_id_in_database

Version 4.3.0 2023-03-09

  • Fix: materialized_path2 strategy #597 (thx @kshnurov)
  • Fix: descendants ancestry is now updated in after_update callbacks #589 (thx @kshnurov)
  • Document updated grammar #594 (thx @omarr-gamal)
  • Documented update_strategy #588 (thx @victorfgs)
  • Fix: fixed has_parent? when non-default primary id #585 (thx @Zhong-z)
  • Documented column collation and testing #601 #607 (thx @kshnurov)
  • Added initializer with default_ancestry_format #612 #613
  • ruby 3.2 support #596 (thx @petergoldstein)
  • Reduce memory for sort_by_ancestry #415

Notable features

Default configuration values are provided for a few options: update_strategy, ancestry_format, and primary_key_format. These can be set in an initializer via Ancestry.default_{ancestry_format} = value

A new ancestry_format of :materialized_path2 formats the ancestry column with leading and trailing slashes. It shows promise to make the ancestry field more sql friendly.

Both of these are better documented in the readme.

Breaking changes

  • ancestry_primary_key_format is now specified or a single key not the whole regular expression. We used to accept /\A[0-9]+(/[0-9]+)* or '[0-9]', but now we only accept '[0-9]'.

Version 4.2.0 2022-06-09

  • added strategy: materialized_path2 #571
  • Added tree_view method #561 (thx @bizcho)
  • Fixed bug when errors would not undo callbacks #566 (thx @daniloisr)
  • ruby 3.0 support
  • rails 7.0 support (thx @chenillen, @petergoldstein)
  • Documentation fixes (thx @benkoshy, @mijoharas)

Version 4.1.0 2021-06-25

  • parent with an invalid id now returns nil (thx @vanboom)
  • root returns self if ancestry is invalid (thx @vanboom)
  • fix case where invalid object prevented ancestry updates (thx @d-m-u)
  • oracleenhanced uses nulls first for sorting (thx @lual)
  • fix counter cache and STI (thx @mattvague)

Version 4.0.0 2021-04-12

  • dropped support for rails 4.2 and 5.0 (thx @d-m-u)
  • better documentation counter cache option (thx @pustomytnyk)
  • clean up code (thx @amatsuda @d-m-u)
  • fixed rails 6.1 support (thx @cmr119 @d-staehler @danini-the-panini )
  • phasing out parent_id?, ancestors? and using has_parent? instead
  • fixed postgres order bug on rails 6.2 and higher (thx @smoyt)

Version 3.2.1 2020-09-23

  • fixed gemspec to include locales and pg (thx @HectorMF)

Version 3.2.0 2020-09-23

  • introduce i18n
  • pg sql optimization for ancestry changes (thx @suonlight and @geis)
  • pg sql optimization for sorting (thx @brendon and @d-m-u)
  • fix to humanise model name (thx @mkllnk)
  • able to convert to ancestry from a parent_id column with a different name
  • documentation fixes for better diagrams and grammar (thx @dtamais, @d-m-u, and @CamilleDrapier)

Version 3.1.0 2020-08-03

  • :primary_key_format method lets you change syntax. good for uuids.
  • changed code from being ancestry string to ancestry_ids focused. May break monkey patches.
  • Moved many methods from has_ancestry and InstanceMethods to MaterializedPath. May break monkey patches.
  • Removed tests for mysql driver. Starting with rails 4.1, it supports mysql2 driver.
  • Better documentation for relationships (thnx @dtamai and @d-m-u)
  • Fix creating children in after_* callbacks (thx @jstirk)

Version 3.0.7 2018-11-06

  • Fixed rails 5.1 change detection (thx @jrafanie)
  • Introduce counter cache (thx @hw676018683)

Version 3.0.6 2018-11-06

  • Fixed rails 4.1 version check (thx @myxoh)

Version 3.0.5 2018-11-06

Changed

  • Added indirect children support (thx @tilo)
  • Fixed test sorting for pg on mac osx

Fixes

  • Reduced memory footprint of parsing ancestry column (thx @NickLaMuro)

Version 3.0.4 2018-10-27

Fixes

  • Properly detects non-integer columns (thx @adam101)
  • Arrange no longer drops nodes due to missing parents (thx @trafium)

Version 3.0.3 2018-10-23

This branch (3.x) should still be compatible with rails 3 and 4. Rails 5.1 and 5.2 support were introduced in this version, but ongoing support has been moved to ancestry 4.0

Fixes

  • Reduce object allocation (thx @NickLaMuro)
  • Rails 5.1 fixes (thx @ctrombley)
  • Avoid redundant query to DB in subtree_of scope (thx @Slike9)
  • Syntax tweaks (thx @ekohl, @richardonrails)
  • Fixed reverse ordering
  • Dropped builds for ruby 1.9.3, 2.0, 2.1, and 2.2
  • Dropped builds for Rails 3.x and 4.x (will use Active Record or syntax)

Version 3.0.2 2018-04-24

Fixes

  • fixed order_by_ancestry bug
  • fixed order tests for postgres on mac (it uses a different collation)
  • fixed documentation (thx @besquared, @danfrenette, @eiwi1101, @isimluk, @mabusaad, @tilsammans)
  • added missing Ancestry::version
  • added Rails 5.2 support (thx @jjuliano)

Version 3.0.1 2017-07-05

Fixes

  • added gem metadata
  • fixed keep a changelog link (thx @mattbrictson)
  • added alias has_parent?
  • fixed bug where unscoping too much (thx @brendon)
  • fixed tests on mysql 5.7 and rails 3.2
  • Dropped 3.1 scope changes

Version 3.0.0 2017-05-18

Changed

  • Dropping Rails 3.0, and 3.1. Added Rails 5.1 support (thx @ledermann)
  • Dropping Rails 4.0, 4.1 for build reasons. Since 4.2 is supported, all 4.x should still work.

Fixes

  • Performance: Use pluck vs map for ids (thx @njakobsen and @culturecode)
  • Fixed acts_as_tree compatibility (thx @crazymykl)
  • Fixed loading ActiveRails prematurely (thx @vovimayhem)
  • Fixes exist (thx @ledermann)
  • Properly touches parents when different class for STI (thx @samtgarson)
  • Fixed issues with parent_id (only present on master) (thx @domcleal)

Version 2.2.2 2016-11-01

Changed

  • Use COALESCE only for sorting versions greater than 5.0
  • Fixed bug with explicit order clauses (introduced in 2.2.0)
  • No longer load schema on has_ancestry load (thx @ledermann)

Version 2.2.1 2016-10-25

Sorry for blip, local master got out of sync with upstream master. Missed 2 commits (which are feature adds)

Added

  • Use like (vs ilike) for rails 5.0 (performance enhancement)
  • Use COALESCE for sorting on pg, mysql, and sqlite vs CASE

Version 2.2.0 2016-10-25

Added

  • Predicates for scopes: e.g.: ancestor_of?, parent_of? (thx @neglectedvalue)
  • Scope path_of

Changed

  • arrange now accepts blocks (thx @mastfish)
  • Performance tuning arrange_node (thx @fryguy)
  • In orphan strategy, set ancestry to nil for no parents (thx @haslinger)
  • Only updates updated_at when a record is changed (thx @brocktimus)
  • No longer casts text primary key as an integer
  • Upgrading tests for ruby versions (thx @brocktimus, @fryguy, @yui-knk)
  • Fix non-default ancestry not getting used properly (thx @javiyu)

Version 2.1.0 2014-04-16

  • Added arrange_serializable (thx @krishandley, @chicagogrrl)
  • Add the :touch to update ancestors on save (thx @adammck)
  • Change conditions into arel (thx @mlitwiniuk)
  • Added children? & siblings? alias (thx @bigtunacan)
  • closure_tree compatibility (thx @gzigzigzeo)
  • Performance tweak (thx @mjc)
  • Improvements to organization (thx @xsuchy, @ryakh)

Version 2.0.0 2013-05-17

  • Removed rails 2 compatibility
  • Added table name to condition constructing methods (thx @aflatter)
  • Fix depth_cache not being updated when moving up to ancestors (thx @scottatron)
  • add alias :root? to existing is_root? (thx @divineforest)
  • Add block to sort_by_ancestry (thx @Iliya)
  • Add attribute query method for parent_id (thx @sj26)
  • Fixed and tested for rails 4 (thx @adammck, @Nihad, @Systho, @Philippe, e.a.)
  • Fixed overwriting ActiveRecord::Base.base_class (thx @Rozhnov)
  • New adopt strategy (thx unknown)
  • Many more improvements

Version 1.3.0 2012-05-04

  • Ancestry now ignores default scopes when moving or destroying nodes, ensuring tree consistency
  • Changed ActiveRecord dependency to 2.3.14

Version 1.2.5 2012-03-15

  • Fixed warnings: "parenthesize argument(s) for future version"
  • Fixed a bug in the restore_ancestry_integrity! method (thx Arthur Holstvoogd)

Version 1.2.4 2011-04-22

  • Prepended table names to column names in queries (thx @raelik)
  • Better check to see if acts_as_tree can be overloaded (thx @jims)
  • Performance inprovements (thx @kueda)

Version 1.2.3 2010-10-28

  • Fixed error with determining ActiveRecord version
  • Added option to specify :primary_key_format (thx @rolftimmermans)

Version 1.2.2 2010-10-24

  • Fixed all deprecation warnings for rails 3.0.X
  • Added :report option to check_ancestry_integrity!
  • Changed ActiveRecord dependency to 2.2.2
  • Tested and fixed for ruby 1.8.7 and 1.9.2
  • Changed usage of update_attributes to update_attribute to allow ancestry column protection

Version 1.2.0 2009-11-07

  • Removed some duplication in has_ancestry
  • Cleaned up plugin pattern according to http://yehudakatz.com/2009/11/12/better-ruby-idioms/
  • Moved parts of ancestry into seperate files
  • Made it possible to pass options into the arrange method
  • Renamed acts_as_tree to has_ancestry
  • Aliased has_ancestry as acts_as_tree if acts_as_tree is available
  • Added subtree_of scope
  • Updated ordered_by_ancestry scope to support Microsoft SQL Server
  • Added empty hash as parameter to exists? calls for older ActiveRecord versions

Version 1.1.4 2009-11-07

  • Thanks to a patch from tom taylor, Ancestry now works with different primary keys

Version 1.1.3 2009-11-01

  • Fixed a pretty bad bug where several operations took far too many queries

Version 1.1.2 2009-10-29

  • Added validation for depth cache column
  • Added STI support (reported broken)

Version 1.1.1 2009-10-28

  • Fixed some parentheses warnings that where reported
  • Fixed a reported issue with arrangement
  • Fixed issues with ancestors and path order on postgres
  • Added ordered_by_ancestry scope (needed to fix issues)

Version 1.1.0 2009-10-22

  • Depth caching (and cache rebuilding)
  • Depth method for nodes
  • Named scopes for selecting by depth
  • Relative depth options for tree navigation methods:
    • ancestors
    • path
    • descendants
    • descendant_ids
    • subtree
    • subtree_ids
  • Updated README
  • Easy migration from existing plugins/gems
  • acts_as_tree checks unknown options
  • acts_as_tree checks that options are hash
  • Added a bang (!) to the integrity functions
    • Since these functions should only be used from ./script/console and not from your application, this change is not considered as breaking backwards compatibility and the major version wasn't bumped.
  • Updated install script to point to documentation
  • Removed rails specific init
  • Removed uninstall script

Version 1.0.0 2009-10-16

  • Initial version
  • Tree building
  • Tree navigation
  • Integrity checking / restoration
  • Arrangement
  • Orphan strategies
  • Subtree movement
  • Named scopes
  • Validations