From da7f45438ce7c073798d240870acfcc567c57d54 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Wed, 8 Apr 2026 15:06:41 -0600 Subject: [PATCH] doc(sql-migrate): add PGOPTIONS multi-tenant schema docs to help text Document how to use PGOPTIONS="-c search_path=..." for multi-tenant PostgreSQL migrations. Each schema gets its own _migrations table, so tenants are migrated independently. --- cmd/sql-migrate/main.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cmd/sql-migrate/main.go b/cmd/sql-migrate/main.go index 3b3daad..7099c9f 100644 --- a/cmd/sql-migrate/main.go +++ b/cmd/sql-migrate/main.go @@ -131,6 +131,14 @@ NOTES The 'create' generates an up/down pair of files using the current date and the number 1000. If either file exists, the number is incremented by 1000 and tried again. + +NOTE: POSTGRES SCHEMAS + Set PGOPTIONS to target a specific PostgreSQL schema: + + PGOPTIONS="-c search_path=tenant123" sql-migrate up | sh + + Each schema gets its own _migrations table, so tenants are migrated + independently. PGOPTIONS is supported by psql and all libpq clients. ` var (