Skip to content

Add db:create and db:drop, columnAliasPrefix, a custom paginator page name, and fixes for migrations, transactions and schema:generate

Latest

Choose a tag to compare

@github-actions github-actions released this 19 Nov 06:56
Immutable release. Only release title and notes can be modified.

22.5.0 (2026-11-19)

Features

  • node ace db:create and node ace db:drop create and drop the database of a connection. (#1183)
  • A model can set static columnAliasPrefix to use in place of the table name in the aliases of its columns. Set it when a real column of the model has the name of the alias of another column, for example url and semafor_url on the table semafor. (#1214, closes #1191)
  • paginate() accepts the name of the page query string parameter as its third argument, for example paginate(page, 20, 'p'). (#1162)
  • Each make:* command accepts --force to overwrite an existing file. make:model gives the flag to the files that it makes with the model. (75178c1)
  • Adapter.db is protected, and SeedsRunner is exported, to extend Lucid, for example for multi-tenancy. (#1171)

Bug fixes

  • The migration runner takes and releases its advisory lock on one database session, and runs each migration on that session. Before, two runners could apply the same migration when the session of the lock ended. (#1215, closes #1153)
  • schema:generate names the class of a table in another schema after its schema when two tables have the same name, for example AppOrderSchema for app.orders. When a class name still collides, it fails, names the tables and writes no file. tables of the schema rules accepts <schema>.<table>. (#1216, closes #1195)
  • schema:generate sets columnName when the property name does not give back the column name, for example player1_id. (b23d814, closes #1173)
  • db.transaction({ isolationLevel }) runs a manual transaction at that isolation level. Before, the option was ignored. Under repeatable read or serializable, your code can now get serialization failures to retry. (#1203, closes #1202)
  • Preloads inside a transaction run their queries one after the other, so PostgreSQL no longer gives the query queue deprecation warning. (#1200, closes #1199)
  • A row with a null local key has no related rows in a preload. Before, it made the preload of the whole collection fail. (#1189, closes #1188)
  • update(values, returning) with an object resolves the column names and the raw values. (#1201)
  • toKnex() and toSQL() of a relationship subquery keep its constraints. (#1208, closes #1207 and #1209)
  • $columns is no longer a key of ModelAttributes, so fill(), merge() and create() do not accept it. (#1176, closes #1175)
  • The alias of --transformer of make:model is -t. Before, -c was the alias of --controller and of --transformer, so -c made a transformer. (#1180)

Performance

  • A preload matches the related rows to their parents in one pass. A preload of 2,000 users with 22,000 pivot rows went from 4.2 s to 0.1 s. (#1187, closes #1185)

What's Changed

  • feat: expose Adapter db attribute and export SeedsRunner by @nedois in #1171
  • fix: exclude $columns from ModelAttributes inferred type by @ad-momo in #1176
  • feat(paginator): add custom page name by @FlorianV85 in #1162
  • fix: change alias for transformer flag from 'c' to 't' by @McSneaky in #1180
  • feat: add db:create and db:drop commands by @batosai in #1183
  • fix: treat a null local key as no related rows across all relation types by @evoactivity in #1189
  • fix: prevent where clause loss for toKnex and toSQL by @dunhamjared in #1208
  • fix: forward isolation level options to manual transactions by @KevinBlakeLopez in #1203
  • fix: resolve keys and raw values when updating an object with returning columns by @suguid in #1201

New Contributors

Full Changelog: v22.4.2...v22.5.0