Notes/ForgeSchema

ForgeSchema Builds Indexes Online and Plans Drops by Name

ForgeSchema 0.3.0 went out on 18 October, a few hours after the second alpha. It’s the first release without an alpha label, and the first one CI published by itself once the tests passed on PostgreSQL 16.10 and 17.6.

plan --online builds new indexes and unique constraints on existing tables with CREATE INDEX CONCURRENTLY, so writes keep going on a big table. If a build fails, usually over duplicates, you fix the data and run the same plan again, and it finishes where it stopped. Check constraints made of simple comparisons, like total >= 0 or status IN ('active', 'closed'), now go through inspect, plan, apply and verify.

Drops and type conversions are allowed at last, but only for what a change file names. Plans that delete data say so up front, and conversions that would lose data quietly or depend on the session’s time zone stay blocked. A rename can reuse a dropped column’s name in the same plan, which makes the add, backfill, swap way of changing a column’s type work. The release post has the details.

The studio’s review before release caught a deadlock between an online build and a waiting apply, a lock timeout that could cancel builds, two kinds of drop that would fail in PostgreSQL, and some lossy conversions. All fixed first. Binaries are on the GitHub release.