Upgrading A PostgreSQL Jail

I had an older PostgreSQL 12 install using FreeBSD jails and ZFS. It was setup using iocage on FreeBSD 12.1, and I wanted to upgrade to FreeBSD 13.0 and PostgreSQL 14. I could have done a normal freebsd-update but that would end up wasting a bunch of space on top of the clone that iocage creates. Doing that is fine for minor updates but in this case it is better to delete the jail and recreate it using the new FreeBSD release and PostgreSQL version.

Simple Schema Migration With Go

In 2010 I wrote about a simple method for migrating schema with Python . Here’s the same kind of thing, but this time using Go. I’m using the SQLx extensions for database/sql and PostgreSQL as my database. The only requirement is an extra table named schema with a single version in it. This tracks which version of the schema update has been applied. This table is created in the first schema update below.