Releases: rom-rb/rom-sql
Releases · rom-rb/rom-sql
v3.3.2
v3.3.1
Fixed
:pg_streaming
plugin no longer crashes when there's no sequel_pg and now you need to require the plugin explicitly (@solnic)
v3.3.0
3.3.0 2020-12-28
Added
Relation#full_text_search
that provides an API for PostgreSQL's Full Text Search (@ianks)
# Don't forget to activate the plugin
conf.plugin(:sql, relations: :pg_full_text_search)
posts.full_text_search([:title], 'tutorials', language: 'english')
# => [{ title: 'A Tutorial about SQL', ... }]
- Support for
:pg_streaming
extension (@ianks)
Fixed
v3.2.0
v3.1.0
Added
-
.nullify
that turns the result set of any relation into an empty set. Analogue ofActiveRecord#none
(@ianks + @flash-gordon)# Don't forget to activate the plugin conf.relation(:users) do use :nullify end users.nullify.count # => will always be 0 users.nullify.to_a # => will always be empty ([])
Fixed
- Make
Relation#wrap
respect association views (@ianks) - Primitive JSON-compatible values such as Integer and String are automatically coerced to correct JSONB values and back if you're using a recent Sequel version (>= 5.2.0) (@flash-gordon)
- Properly qualify relations when in
Relation#union
(@ianks) Relation#query
no longer removes order in the relation (@DNNX)
v3.0.1
v3.0.0
Added
- Join DSL so that you can use arbitrary conditions when joining relations (flash-gordon)
You also can use table aliases, however the setup is a bit hairy:
users.join(tasks) { |users:, tasks:| tasks[:user_id].is(users[:id]) & users[:name].is('John') }
# self-join "users" with itself using "authors" as an alias authors = users.as(:authors).qualified(:authors) result = users.join(authors) { |users: | users[:id].is(authors[:id]) }.select(:name)
- Support for
CASE
expression (wmaciejak + flash-gordon)# matching expression result users.select_append { id.case(1 => string('one'), else: string('something else')).as(:one_or_else) } # searching for `true` result users.select_append { string::case(id.is(1) => 'one', else: 'else').as(:one_or_else) }
- Relations can be accessed in DSLs with keyword arguments (flash-gordon)
users.join(posts).select_append { |posts: | posts[:title] }
- Support for
.exists
in the projection DSL (flash-gordon)users.select_append { |posts: | exists(posts.where(posts[:user_id] => id)).as(:has_posts) }
Relation#unfiltered
returns an unrestricted relation (removes restrictions fromWHERE
andHAVING
) (flash-gordon)- Support for
WITHIN GROUP
in the function DSL has been enhanced with block syntax (flash-gordon)
# previously available version
households.project { float::percentile_cont(0.5).within_group(income).as(:percentile) }
# using the new syntax
households.project { float::percentile_cont(0.5).within_group { income }.as(:percentile) }
- Support for migrator options ie
ROM::Configuration.new(:sql, migrator: { path: "my_migrations" })
(rawburt) Relation#pluck
works with multiple args too (timriley)
Changed
- [BREAKING] Updated to work with
dry-types 1.0.0
(flash-gordon) - [BREAKING]
Types::Int
is nowTypes::Integer
(GustavoCaso)
Fixed
- Using
Relation#inner_join
with has-many-through produces correct query (issue #279) (doriantaylor + solnic) - Aliased attributes are handled correctly in
Relation#where
(waiting-for-dev)
v2.5.0
v2.5.0 2018-06-08
Added
- Support for subqueries in
SELECT
andWHERE
🎉 (flash-gordon)tasks = relations[:tasks] users = relations[:users] user_tasks = tasks.where(tasks[:user_id].is(users[:id])) tasks_count = user_tasks.select { int::count(id) } users.select_append(tasks_count.as(:tasks_count))
2.4.0
Added
- Support for functions with
Any
return type ieselect { concat(:first_name, ' ', :last_name).as(:name) }
will setROM::Types::Any
as the type by default (GustavoCaso) - New
Relation#as_hash
method (GustavoCaso)
2.2.0
v2.2.0 2017-11-02
Added
- Relation registry is passed as an argument to DSL blocks (in
select
,where
,order
etc.), which enables syntax likeselect { |r| [id, r.tasks[:title]] }
(solnic) - Support for self-referenced many-to-many associations (solnic)
- PG's geometric types include meta data about db types (GustavoCaso)
Fixed
- Custom schema is used correctly in command results (solnic)
- Schemas no longer finalize PKs (this is done in core schema already) (solnic)