Skip to content

Releases: rom-rb/rom-sql

v3.3.2

06 Jan 08:25
v3.3.2
Compare
Choose a tag to compare

Fixed

  • Function qualification methods no longer lose options (issue #390 fixed via #391) (@solnic)

Compare v3.3.1...v3.3.2

v3.3.1

29 Dec 11:46
v3.3.1
Compare
Choose a tag to compare

Fixed

Compare v3.3.0...v3.3.1

v3.3.0

28 Dec 08:03
v3.3.0
9db6ed6
Compare
Choose a tag to compare

3.3.0 2020-12-28

Added

# 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

  • Relation#join no longer crashes when aliased relation is used with a block (issue #369) (@abrthel)
  • Attributes aliases are properly handled when constructing queries with SQL functions (issue #370 fixed via #373) (@abrthel)

Compare v3.2.0...v3.3.0

v3.2.0

11 Jan 08:49
v3.2.0
bde6843
Compare
Choose a tag to compare

3.2.0 2020-01-11

Fixed

Compare v3.1.0...v3.2.0

v3.1.0

16 Dec 07:26
v3.1.0
9c3d639
Compare
Choose a tag to compare

Added

  • .nullify that turns the result set of any relation into an empty set. Analogue of ActiveRecord#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)

Compare v3.0.1...v3.1.0

v3.0.1

05 May 05:56
v3.0.1
Compare
Choose a tag to compare

Fixed

  • Using joins with a relation object as the target and a block-based conditions produces correct query now (issue #331) (solnic)

Compare v3.0.0...v3.0.1

v3.0.0

28 Apr 10:05
v3.0.0
10f6210
Compare
Choose a tag to compare

Added

  • Join DSL so that you can use arbitrary conditions when joining relations (flash-gordon)
    users.join(tasks) { |users:, tasks:|
      tasks[:user_id].is(users[:id]) & users[:name].is('John')
    }
    You also can use table aliases, however the setup is a bit hairy:
    # 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 from WHERE and HAVING) (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 now Types::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)

Compare v2.5.0...v3.0.0

v2.5.0

08 Jun 20:36
v2.5.0
df787f6
Compare
Choose a tag to compare

v2.5.0 2018-06-08

Added

  • Support for subqueries in SELECT and WHERE 🎉 (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))

Compare v2.4.0...v2.5.0

2.4.0

18 Feb 13:30
Compare
Choose a tag to compare

Added

  • Support for functions with Any return type ie select { concat(:first_name, ' ', :last_name).as(:name) } will set ROM::Types::Any as the type by default (GustavoCaso)
  • New Relation#as_hash method (GustavoCaso)

Compare v2.3.0...v2.4.0

2.2.0

02 Nov 01:37
Compare
Choose a tag to compare

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 like select { |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)

Compare v2.1.0...v2.2.0