Repository navigation
🛡️ Row security and SQLite migrations: schema changes that used to fail now run
This release has no new feature to learn. It fixes schema changes that stopped a pass or a migration partway, most of them around Postgres row policies and SQLite's limits on ALTER TABLE.
A row policy can read another table, or a column the same change adds
A policy on document that reads membership failed on Postgres when both tables were new, because the policy was created before the table it reads. Every migration strategy now creates the tables first and the policies last:
CREATE TABLE IF NOT EXISTS "document" (...);
CREATE TABLE IF NOT EXISTS "membership" (...);
ALTER TABLE "document" ENABLE ROW LEVEL SECURITY;
ALTER TABLE "document" FORCE ROW LEVEL SECURITY;
CREATE POLICY "rls_document_members" ON "document" FOR ALL
USING ("owner_id" IN (SELECT user_id FROM membership));The same order holds when a policy reads a column the same change adds or drops on an existing table: policies are dropped before the first table change and created after the last. connect(auto_migrate=True) and ferro.migrate() run such a pass in one transaction, so a failure leaves no table without its policy (#992, #1008).
One case is still open: a migration that ferro migrate new splits into an expand step and a contract step can place a policy on the wrong side of a column change it reads (#1009).
Two tables whose foreign keys point at each other can be created
Captain.crew_id references Crew and Crew.captain_id references Captain. Postgres could not create either table first. Ferro now creates both, then adds the key that points at the later table with ALTER TABLE ... ADD CONSTRAINT (#1000).
SQLite
- A declared length is no longer schema. SQLite does not enforce the length in
varchar(8), so two types that differ only in that length are the same column toferro migrate new,ferro migrate driftandferro.migrate(). Adding a longer enum label no longer rebuilds the table. The upgrade guide's After 0.28 section covers what this means for a table made by hand (#1002). - A destructive pass keeps a column SQLite cannot drop. A removed column that a foreign key or a table check still names is left in place with a warning, where the pass used to fail with a raw
OperationalError(#998, #1005). - The "cannot change in place" warnings name a fix that works. Each one now ends with the two ways to make the change: rebuild the table by hand, or adopt migrations at what the database holds and generate the change next. A type-change warning also prints the type name the column really has, where it could print an empty one (#1010).
offset()works withoutlimit(). It raised a syntax error on SQLite and now skips rows as it does on Postgres (#994).
Also in this release
- The report types you receive are public names.
RunReport,StatusReport,CheckReportand the types of their fields import fromferro.migrations;ModelConnection,EngineManagerandSubjectimport fromferro(#990). - A query error spells the row the way your lambda does (
sale.amount, nott.amount) and no longer cites ADR or issue numbers (#991). - A timeout too large to represent is a
ValueErrorthat names the setting and its bound, where it crashed with a Rust panic.ddl_lock_timeoutnow accepts at most 2147483647 ms (about 24.8 days), the longestlock_timeoutPostgres takes; a longer value inferro.tomlis refused when settings load (#1011).
v0.29.0 (2026-11-20)
Bug Fixes
-
A step that creates a new table with row security may be classed contract, which expand-only refuses (#1001) (#1006,
bd4a5d0) -
Auto_migrate: genuine cross-table FK cycles cannot CREATE on Postgres — defer cycle FKs to post-create ALTER (#304) (#1000,
553b4aa) -
No timeout value panics across the FFI (from_seconds, with_lock_timeout_seconds) (#611) (#1011,
4d86097) -
Offset() without limit() fails on SQLite with a syntax error (#756) (#994,
6eb8ce3) -
Query error messages hard-code lambda parameter t. and cite ADR numbers (#758) (#991,
5e9e345) -
RLS policy on a new table that reads a column the same pass adds to an existing table fails on Postgres (#995) (#1008,
c97c4eb) -
RLS policy that reads another table fails on Postgres: tables are created in foreign-key order only (#753) (#992,
eeed581) -
SQLite type-change warning prints an empty old type and the wrong expected type for an enum (#997) (#1010,
0b9d3f2) -
SQLite: a column named by a foreign key or a table check is refused at render time, not at execution (parity C2) (#610) (#998,
a76d109) -
SQLite: a hand-written check that names a column as a bare keyword keeps the column (#999) (#1005,
bc1f96f) -
SQLite: a storage change that differs only in an unenforced length is no change on every emitter (#614) (#1002,
5cfdf3b) -
Test_postgres_floor fails locally when FERRO_POSTGRES_URL uses postgres:// (#996) (#1012,
591bbb3)
Continuous Integration
Documentation
Features
- Export RunReport, StatusReport, CheckReport, ModelConnection, EngineManager, Subject and the types of their fields (#759) (#990,
37ac5cb)
Testing
-
Drop the redundant branch in the public-names test (#759) (#993,
2c929a0) -
Give the set_config revoking test a database of its own (#984) (#987,
b19a984)
Detailed Changes: v0.28.0...v0.29.0