2.0.0
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#callcalls a SQL function (flash-gordon)gateway.(:upper, 'foo') # => "FOO" gateway.(:pg_advisory_xact_lock, 1234) # => nil
-
SQL::Gateway#runexecutes a SQL string, e.g. a DDL statement (flash-gordon)gateway.run('set session IntervalStyle to default')
-
SQL::Relation#existsjoins a relation with theEXISTSoperator (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#importinserts data from another relation using theINSERT ... AS SELECTsyntax 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_explainplugin 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#notwas 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]
Associatescommand plugin requires associations now (solnic) - [BREAKING]
Command#transactionis gone in favor ofRelation#transaction(solnic) - [BREAKING]
PG::JSONArray,PG::JSONBArray,PG::JSONHash, andPG::JSONBHashtypes were dropped, usePG::JSONandPG::JSONBinstead (flash-gordon) - [BREAKING] The
pg_hstoreextension now doesn't get loaded automatically, use the:extensionoption to load it on config initialization (flash-gordon) ManyToOneno longer uses a join (solnic)AutoCombineandAutoWrapplugins 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, andPG::Arraynow 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_pkto be defined (solnic) Relation#groupuses canonical schema now (solnic)