- Deprecated Ruby 3.0 support
- New minimum Ruby version is 3.1
- Deprecated Rails 6.0 support
- New minimum Rails version is 6.1
- Implement Rails 7.1 CTE join compatibility
- #91 Help address SystemStackError for infinite loops caused by CTE construction (garrettblehm)
- #104 Allow for Rails 7.2 to be used with this gem (Paul-Bob)
- Allow for Rails 7.1 to be used with this gem
- Added Rails 7.1 CTE argument pattern support
- #94 Prevent queries from prematurely executing while using
union
methods (jlebray)
- #70 Removed ar_outer_joins dependency due to native outer joins support in Rails 5.1 (Benjamin Fleischer)
- #87 Added the ability to specify
MATERIALIZED
orNOT MATERIALIZED
for a CTE (Garrett Blehm).with
chain methods:#materialized/1
and#not_materialized/1
- Note: Requires PG12+
- Implementation of ActiveSupport autoloader
- Query methods and patches will now only be loaded once ActiveRecord has been fully loaded.
- This should aid people that are having a hard time getting some query methods such as the
union
to load and work properly.
- #83 Prevent quoting of CTE names with parentheses in them (yasirazgar)
- Dropped Rails 5.1 support.
- Dropped Ruby 2.4 support.
- Dropped Postgres 9.6 support.
- Arel for ActiveRecord 6.1+
contains
will no longer accept INET (ip address column types), useinet_contains
instead.- ActiveRecord
contains
should remain unaffected as it never accepted INET column types.
- ActiveRecord
- #73 #77 Fix union and window query merging
- #74 Fix visitor conflict in Arel 6.1+ and support their native implementation of
contains
andoverlap
functionality
- #68 Defer extending Either onto ActiveRecord until ActiveRecord is loaded (cgunther)
- #47 Added Rails 7.0 support (mbell697)
- #60 Fix potential accidental association loading during query building
- #56 Fix Either joins with has_many through association
- #52 Fixed (Rails 6.1)
warning: already initialized constant Arel::Nodes::Contains
- #47 Added Rails 6.1 support (gigorok)
- Rails 5.0.x Has been fully deprecated.
- Ruby 2.3.x Has been fully deprecated.
- JSON methods option:
cast_as_array
has been officially deprecated. Please usecast_with: :array
instead. - Redesigned CTE's structure. CTE tables are now held in their relations WithCTE class.
- Redesigned CTE structure method
.with
&.with!
only acceptsHash/Keyword
andWithCTE
instance arguments.- Dev Note: In an effort to trying to maintain as many ways of accepting CTE's in various forms (Array's, Strings, Hashes, etc..) was becoming overwhelming to maintain and wasn't realistic to continue this path. And since you can't have duplicate CTE's with the same name, a Hash makes perfect sense.
- Fixed
.with
CTE recursive flag not transferring when merging subqueries. - Fixed (Rails 6.x)
.with
Subqueries that contain CTE's of their own, are now piped to the parent like other methods. - Fixed (Rails 6.x) No partition by arguments for window functions are provided.
- Fixed Rails 6.1
Arel::Node
missing error. - Fixed duplicate where constraints when using
where.any_of
/where.none_of
- Fixed Ruby 2.7 warning:
Using the last argument as keyword parameters is deprecated
Performance tweaks:
- #33 Reduce object creations when using the ruby shorthand
&method()
.
Bug fix:
- Prevent STI models from appending where clauses to
select_row_to_json(b)
method scopes
- Add Postgres Window Functions to ActiveRecord querying level.
- introduces two new methods that are used in conjunction:
.define_window
&.select_window
- introduces two new methods that are used in conjunction:
Defines one or many windows that will be place at the bottom of your query.
This will also require you to define a partition via .parition_by(:column)/2
.
partition_by/2
arguments:- column name being partitioned
order_by
Processes how the window should be orders
Example:
User.define_window(:w).partition_by(:name, order_by: :join_date)
Arguments:
- Window Function Name
- Function's arguments *optional*
over:
- The window name given when constructing
.define_window
- The window name given when constructing
as:
*optional*- Alias name to give the final result
Overall Examples:
User.define_window(:w).partition_by(:name).select_window(:row_number, over: :w, as: :r_id)
User.define_window(:w).partition_by(:name).select_window(:first_value, :id, over: :w, as: :first_id)
- Introduce
.foster_select
a helper for select statements that can handle aliasing and provides casting options for many common aggregate functions. Supports any aggregate that does not require multiple arguments (COUNT
,AVG
,MAX
,ARRAY_AGG
, etc..): Aggregate Functions- Supports Aggregate
DISTINCT
andORDER BY
inner expressions.
- Supports Aggregate
- Reduced the code foot-print for declaring new Arel functions
- Introduce new
Arel::Nodes::AggregateFunctionName
for dealing with inline-ingORDER BY
(will be expanded to handleFILTER
next) - Code cleanup and some minor performance tweaks
- Argument-less scoped blocks (inner-block argument is now optional)
cast_with:
- Supported options:
true
(array),:array
,:array_agg
,distinct
, and:to_jsonb
- Supported options:
order_by:
: Accepts ActiveRecord like options for ordering responses from an array or aggregated array
- #26 Support for class namespace for
inet_contains
@znakaska - #27 Fixed
TO_JSONB
class name typo that would cause an exception
- In order to keep options standardized,
.select_row_to_json
will be droppingcast_to_array
in favor of thecast_with
option; Furthermore, the defaulttrue
forcast_with
option will be deprecated as well in favor of more verbose:array
option
- ActiveRecord/Rails 6.0 support
- Allow for any pg gem version below v2.0
- Increased the required PG gem version range to accept
1.1.x
Add support for Postgres Union types and refactor Arel building process into a single module
.union
(UNION).union_all
(UNION ALL)- or
.union.all
- or
union_except
(EXCEPT)- or
.union.except
- or
.union_intersect
(INTERSECT)- or
.union.intersect
- or
union_as
(From clause alias name) (defaults to calling class table name)- or
.union.as
- or
order_union
(ORDER BY)- or
.union.order
- or
.reorder_union
(overrides previously set.order_union
)- or
union.reorder
- or
.select_row_to_json
(ROW_TO_JSON).json_build_object
(JSON_BUILD_OBJECT).jsonb_build_object
(JSONB_BUILD_OBJECT).json_build_literal
(JSON_BUILD_OBJECT) (static hash / array implementation).jsonb_build_literal
(JSONB_BUILD_OBJECT) (static hash / array implementation)
Add support for Postgres Common Table Expression (CTE) methods.
.with/1
.with.recursive/1
Reduced Gem file allocation. We only care about stuff in the lib directory.
Relaxed PG gem requirement for allowing version 1 to be used.
Released non-marked beta version.
Added inet_contains_or_contained_within/1
method
Renamed inet functions to hopefully give a clearer understanding to what these methods are used for.
Added support for Postgres Inet functions. View the readme for more details on the following:
#inet_contained_within/1
#inet_contained_within_or_equals/1
#inet_contains_or_equals/1
#inet_contains/1
The following will be dropped upon v1.0 release. In favor of their prefixed counterparts.
#contained_within/1
#contained_within_or_equals/1
#contains_or_equals/1
Added support for Rails 5.0.x
The proposed changes to this could cause unintended behavior in existing Rails 5.0.x applications. This is due to the overwrite needed to be done on its internal Predicate builder. Rails projects above 5.0.x should not experience any unforeseen issues since they contain the necessary structure required.
Use with caution. And always make sure you have good tests to verify everything in your application.
- Use Arel's
or
for grouping queries when using#any_of
or#none_of
- Added Plural aliases for
.either_join
:.either_joins
and.either_order
:.either_orders
- Fixed ActiveRecord QueryMethod constant load error.
Changed how where clause is required. This is to hopefully future proof the next minior update to ActiveRecord.
Added ActiveRecord Where Chain Functionality
- .where.any_of
- .where.none_of
Major thanks to Olivier El Mekki author of ActiveRecord AnyOf
Added ActiveRecord Where Chain Functionality:
- .where.overlap
- .where.contained_within
- .where.contained_within_or_equals
- .where.contains_or_equals
- .where.any/1
- .where.all/1
Major thanks to Dan McClain author of Postgres Ext
Added ActiveRecord Base Extensions
- .either_order/2
- .either_join/2