Skip to content

Releases: rom-rb/rom-sql

2.1.0

23 Oct 21:09
Compare
Choose a tag to compare

v2.1.0 2017-10-23

Added

  • Support for PG's range types (v-kolesnikov)
  • Support for PG's ltree (GustavoCaso + solnic)
  • Support for the FILTER clause (flash-gordon)

Fixed

  • Schema inference works with primary keys that have custom types (ie an enum PK column) (v-kolesnikov)
  • Ruby warnings are gone (solnic)

Compare v2.0.0...v2.1.0

2.0.0

23 Oct 21:09
Compare
Choose a tag to compare

v2.0.0 2017-10-18

Added

  • Support for schema plugins (flash-gordon)

  • Support for auto migrations (flash-gordon)

  • Add DLS for describing table indexes (flash-gordon)

      schema do
        indexes do
          index :name, name: :unique_name, unique: true
          index :props, type: :gin
          index :name, name: :long_names_only, predicate: 'length(name) > 10'
          index :user_id, :title, name: :composite_idx
        end
      end
  • Support for composite indexes in the auto-restrictions plugin (flash-gordon)

  • SQL::Gateway#call calls a SQL function (flash-gordon)

      gateway.(:upper, 'foo') # => "FOO"
      gateway.(:pg_advisory_xact_lock, 1234) # => nil
  • SQL::Gateway#run executes a SQL string, e.g. a DDL statement (flash-gordon)

      gateway.run('set session IntervalStyle to default')
  • SQL::Relation#exists joins a relation with the EXISTS operator (flash-gordon)

      users.exists(posts) # => users with posts
  • Support for processing a relation in batches (flash-gordon)

      users.each_batch(size: 100) do |rel|
        rel.
          command(:update).
          call(name: users[:first_name].concat(users[:last_name])
      end
  • SQL::Relation#import inserts data from another relation using the INSERT ... AS SELECT syntax which is often far more effective than row-by-row processing and an ordinary multi-insert. Relations defined on another gateway are also supported, and in this case, the implementation falls back to the multi-insert strategy (flash-gordon)

      users.import(authors.select { first_name.concat(last_name).as(:name) })
  • Support for tinytext, text, mediumtext, and `longtext data types in MySQL (panthomakos)

  • The new pg_explain plugin for getting query plans on PostgreSQL (flash-gordon)

      users.by_pk(1).explain(format: :json, analyze: true)
  • Support for window function calls

      employees.select { [dep_no, salary, int::avg(salary).over(partition: dep_no, order: id).as(:avg_salary)] }
  • Function result can be negated, also ROM::SQL::Function#not was added (flash-gordon)

       users.where { !lower(name).is('John') }
       users.where { lower(name).not('John') }

Changed

  • [BREAKING] based on rom 4.0 now (flash-gordon + solnic)
  • [BREAKING] Associates command plugin requires associations now (solnic)
  • [BREAKING] Command#transaction is gone in favor of Relation#transaction (solnic)
  • [BREAKING] PG::JSONArray, PG::JSONBArray, PG::JSONHash, and PG::JSONBHash types were dropped, use PG::JSON and PG::JSONB instead (flash-gordon)
  • [BREAKING] The pg_hstore extension now doesn't get loaded automatically, use the :extension option to load it on config initialization (flash-gordon)
  • ManyToOne no longer uses a join (solnic)
  • AutoCombine and AutoWrap plugins were removed as this functionality is provided by core API (solnic)
  • Foreign keys are indexed by default (flash-gordon)
  • Schemas are qualified by default (solnic)
  • PG::JSON, PG::JSONB, and PG::Array now all have read types so that they return plain Hash/Array values instead of Sequel's wrappers (flash-gordon)

Fixed

  • Self-ref associations work correctly with custom FKs (solnic)
  • Aliased associations with custom FKs work correctly (solnic)
  • Defining a custom dataset block no longer prevents default views like by_pk to be defined (solnic)
  • Relation#group uses canonical schema now (solnic)

Compare v1.3.3...v2.0.0

v1.3.5

14 Oct 09:00
v1.3.5
f23c086
Compare
Choose a tag to compare

Changed

  • Added compatibility with dry-types 0.11 (flash-gordon)

Compare v1.3.4..v1.3.5

v1.3.3

30 May 09:42
v1.3.3
40c9a88
Compare
Choose a tag to compare

Added

  • Relation#lock, row-level locking using the SELECT FOR UPDATE clause (flash-gordon)

  • get and get_text methods for the PG::JSON type (flash-gordon)

  • Support for converting data type with CAST using the function DSL (flash-gordon)

      users.select { string::cast(id, 'varchar').as(:id_str) }
  • Support forEXISTS (v-kolesnikov)

      subquery = tasks.where(tasks[:user_id].qualified => users[:id].qualified)
      users.where { exists(subquery) }

Fixed

  • Fixed a regression introduced in v1.3.2 caused by doing way more work processing the default dataset (flash-gordon)

Compare v1.3.2...v1.3.3

v1.3.2

13 May 10:29
v1.3.2
15019a4
Compare
Choose a tag to compare

Added

  • Support for filtering with a SQL function in the WHERE clause. Be sure you're using it wisely and don't call it on large datasets ;) (flash-gordon)
  • Void type for calling functions without returning value (flash-gordon)
  • Support for PG::Array transformations and queries (flash-gordon)

Fixed

  • A bunch of warnings from Sequel 4.46

Compare v1.3.1...v1.3.2

v1.3.1

05 May 22:04
v1.3.1
8da7eb7
Compare
Choose a tag to compare

Changed

  • [internal] Compatibility with dry-core v0.3.0 (flash-gordon)

Compare v1.3.0...v1.3.1

v1.3.0

05 May 22:04
Compare
Choose a tag to compare

Added

  • New Relation#exist? predicate checks if the relation has at least one tuple (flash-gordon)
  • Support for JSONB transformations and queries using native DSL (flash-gordon)
  • Add ROM::SQL::Attribute#not for negated boolean equality expressions (AMHOL)
  • Add ROM::SQL::Attribute#! for negated attribute's sql expressions (solnic)
  • Inferrer gets limit constraints for string data types and stores them in type's meta (v-kolesnikov)

Fixed

  • Fixed usage of PostgreSQL's commands with a composite relation (flash-gordon)
  • Translation of true/false/nil equality checks to is/is not SQL statements in ROM::SQL::Attribute#is (AMHOL)
  • associates command plugin coerces parent collections to hashes correctly (aarek+solnic)
  • by_pk works correctly even when PK is not projected (solnic)

Changed

  • Global private interface SQL::Gateway.instance has been deprecated. Now if you run migrations
    with ROM you should set up a ROM config in the db:setup task with something similar to

      namespace :db
        task :setup do
          ROM::SQL::RakeSupport.env = ROM::Configuration.new(:sql, ENV['DATABASE_URL'])
        end
      end

Compare v1.2.2...v1.3.0

v1.2.2

25 Mar 11:37
26d46c8
Compare
Choose a tag to compare

Changed

  • Updated dry-initializer (flash-gordon)

Compare v1.2.1...v1.2.2

v1.2.1

09 Mar 12:09
e020b85
Compare
Choose a tag to compare

Fixed

  • Allow for joining by a RelationProxy instance from rom-repository (davydovanton)

Compare v1.2.0...v1.2.1

v1.2.0

07 Mar 10:33
Compare
Choose a tag to compare

Added

  • Support for configuring multiple associations for a command (solnic)
  • Support for passing parent tuple(s) as parent option in Command#with_association (solnic)
  • Support for join using assocation name (flash-gordon)

Compare v1.1.2...v1.2.0