What happened
The preview of #112 (pr-112.dev.architektow3d.pl) answered every profile page with a server error: column "r360_set_id" does not exist. The pull request ships migrations 0014–0016; the preview runs the pull request's image against the shared dev database (SPEC §8), which is on main's schema, and deploy/preview-up.sh starts the container without migrating — only the dev deployment migrates (deploy/remote-deploy.sh, #53). Every pull request that adds a column the page reads will preview as a server error. Found 09.09.2026.
Decision (Dawid, 09.09.2026)
A preview gets its own database, cloned from dev when the preview starts and dropped with the container. Not "the preview migrates the shared database": a pull request revised after its preview ran would leave a migration in dev's journal whose hash no longer matches the file, and the dev deployment after the merge would fail on it.
Shape
preview-up.sh: CREATE DATABASE platform_pr_<n> TEMPLATE platform_devski (the template clone needs no other connection to the source at that moment — retry briefly, or use pg_dump | psql if the instance is busy), then run /app/migrate.mjs from the pull request's image against the clone, then start the container with DATABASE_URL pointing at it. Everything else stays shared (bucket under S3_PREFIX=pr-<n>/, signing key).
preview-down.sh: DROP DATABASE platform_pr_<n> after the container is gone. Also on replace (a new push to the same pull request): drop and clone again, so the preview always reflects dev's data plus the pull request's migrations.
- Memory: the instance has 1.9 GB and no swap (
preview-up.sh header). A clone of dev is small today; the cap of two previews stays.
- The preview's own accounts and uploads die with it — say so in the CI summary line.
- SPEC §8: the "PR preview" row changes from "shared dev" to "a clone of dev at start, dropped with the preview". Note the limitation in
docs/dev-environment.md.
Verification
- Open a pull request with an expand-only migration: its preview serves the page that reads the new column; dev keeps serving on
main's schema.
- Close it: the database is gone (
\l on the instance).
deploy-config in CI keeps its checks on the preview scripts (import site), plus one that preview-up.sh names the clone.
Depends on: nothing. Sequenced after the R360 trial on dev.
What happened
The preview of #112 (
pr-112.dev.architektow3d.pl) answered every profile page with a server error:column "r360_set_id" does not exist. The pull request ships migrations 0014–0016; the preview runs the pull request's image against the shared dev database (SPEC §8), which is onmain's schema, anddeploy/preview-up.shstarts the container without migrating — only the dev deployment migrates (deploy/remote-deploy.sh, #53). Every pull request that adds a column the page reads will preview as a server error. Found 09.09.2026.Decision (Dawid, 09.09.2026)
A preview gets its own database, cloned from dev when the preview starts and dropped with the container. Not "the preview migrates the shared database": a pull request revised after its preview ran would leave a migration in dev's journal whose hash no longer matches the file, and the dev deployment after the merge would fail on it.
Shape
preview-up.sh:CREATE DATABASE platform_pr_<n> TEMPLATE platform_devski(the template clone needs no other connection to the source at that moment — retry briefly, or usepg_dump | psqlif the instance is busy), then run/app/migrate.mjsfrom the pull request's image against the clone, then start the container withDATABASE_URLpointing at it. Everything else stays shared (bucket underS3_PREFIX=pr-<n>/, signing key).preview-down.sh:DROP DATABASE platform_pr_<n>after the container is gone. Also on replace (a new push to the same pull request): drop and clone again, so the preview always reflects dev's data plus the pull request's migrations.preview-up.shheader). A clone of dev is small today; the cap of two previews stays.docs/dev-environment.md.Verification
main's schema.\lon the instance).deploy-configin CI keeps its checks on the preview scripts (import site), plus one thatpreview-up.shnames the clone.Depends on: nothing. Sequenced after the R360 trial on dev.