Repository navigation
0.46.1
What changed
Migrate accepts the tenant role itself (<snake>_app) as APP_DATABASE_URL's login, for platforms that provision the login under that name, and pnpm kit:release no longer refuses a version file that already carries the release's version.
scripts/release.mjs: a version file already at the release version is stamped as it is; a file with no version field is still an error (tests/kit-only/release-stamp.test.ts).apps/web/scripts/db-roles.ts: anAPP_DATABASE_URLuser equal toAPP_ROLEmakes that role LOGIN NOINHERIT with the URL's password, grants itSYSTEM_ROLEand CONNECT, and changes nothing else about it; the owner,SYSTEM_ROLEand a non-identifier are still refused; the separate login is unchanged (docs/TENANT-ISOLATION.md§ 3).apps/web/scripts/db-roles.tspost-check: the app login, either shape, must not inheritSYSTEM_ROLE's privileges (a grantWITH INHERIT TRUEfails migrate).apps/web/src/db/client.tsruntimeDatabaseUrl: for a login that ISAPP_ROLE, adds-c statement_timeout=0 -c idle_in_transaction_session_timeout=0 -c lock_timeout=0before the URL's ownoptions, so the tenant role's per-role timeouts do not govern system-role sessions.apps/web/tests/api/db-roles.test.ts: the tenant role as the login (log in, RLS binds, system-role path, rerun and password change, refusals).
How to apply
- Take the
scripts/release.mjshunk as it is. - Take the
apps/web/scripts/db-roles.tshunks as they are:appLoginOfrefuses only the owner,SYSTEM_ROLEand a non-identifier and returnsisAppRole; the role phase skips creating the login and grants onlySYSTEM_ROLEwhenisAppRole;postCheckaddsinherits_system. - Take the
runtimeDatabaseUrlhunk inapps/web/src/db/client.tsas it is (it importsAPP_ROLEfrom./schema/rls). - Take the new
describeblocks and the reworked refusal test inapps/web/tests/api/db-roles.test.ts. - Take the
docs/TENANT-ISOLATION.md§ 3,docs/DEPLOY.md§ Two database logins,docs/RLS.md,docs/CONCEPTS.mdandapps/web/src/db/CLAUDE.mdhunks, keeping the copy's role names. - Nothing to do in a deployment that uses a separate login: migrate behaves as before.
Conflicts to expect
apps/web/scripts/db-roles.ts→ a copy that editedappLoginOfor the login statements → keep the copy's edits and re-apply theisAppRolebranches.
Verify
pnpm test kit-only apps/web/tests/kit-only/release-stamp.test.tspasses.pnpm test api apps/web/tests/api/db-roles.test.ts apps/web/tests/api/rls-enforcement.test.tspasses.