SuperScript

Blog

Sqitch Templates

Sqitch has a template mechanism that follows the same design pattern as its migration files. This makes it easy to manage templates with Sqitch itself. My project directory now contains a templates/ subdirectory. This is just another Sqitch project top_dir, but for templates. The…

Variables in Sqitch

Sqitch supports variables in the config file like this: [target "foo"] engine = pg uri = your-connection-string-here registry = sqitch_db_foo [target.foo.variables] database = foo This makes a variable called database available in the deployment script.…

PostgreSQL Types by Reference

When writing a function to work with a specific table structure, you may have to match the argument types with table columns. If a table column changes its name, you may or may not need to rework the function to apply a similar change. If the table column changes its type, you al…

Exit Codes in psql

In PostgreSQL certain commands are forbidden in transactions or functions, and lack IF NOT EXISTS variants. Examples include CREATE DATABASE and CREATE ROLE. How can one create a database idempotently? The psql documentation says this about exit codes: psql returns 0 to the shel…

Second Brain

Someone recently told me about Building a Second Brain. The book presents a “CODE” approach: Capture, Organize, Distill, Express. It reads like an update to Getting Things Done with an emphasis on more digital tooling. But the available tools are improving fast! The development o…