generatesaas 3.31.0 → 3.32.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -525,7 +525,7 @@ Config files are the most commonly customized.
525
525
 
526
526
  1. Merge the upstream schema change into `packages/database/src/db/*.ts` (user review first, as above).
527
527
  2. Run `pnpm --filter @repo/database generate`. Drizzle diffs the project's own latest snapshot against the merged schema and writes a fresh migration carrying a current timestamp, the next `idx`, a correct `prevId`, and a snapshot that describes the project's real schema.
528
- 3. Open the upstream `.sql` under `.generatesaas/staging/packages/database/drizzle/` and copy any hand-written statements into the generated file: seeds, backfills, data migrations, `ON CONFLICT` guards. `generate` infers structure only, so those are lost otherwise.
528
+ 3. Open the upstream `.sql` under `.generatesaas/staging/packages/database/drizzle/` and carry over any hand-written statements - seeds, backfills, data copies, `ON CONFLICT` guards - which `generate` cannot infer. Put them in a migration of their own, never in the generated file: run `pnpm --filter @repo/database generate --custom --name <what-it-does>`, which writes an empty `.sql` with its own journal entry after the generated one, and paste them there. The generated file then stays pure `generate` output that the next diff can trust. Only a statement that must run in the middle of the structure change - a backfill before the `NOT NULL` it satisfies - stays inside the generated file, at that point.
529
529
  4. Run `pnpm --filter @repo/database migrate`.
530
530
 
531
531
  **Why the upstream file cannot just be added.** Drizzle applies a migration only when its journal `when` value is greater than the `created_at` of the last migration already applied to the database. A project that generated its own migration after the upstream one was authored sits above that mark, so a copied-in upstream file is **skipped silently and permanently**: no error, no warning, no log line, and `migrate` still exits 0. The table or column it was supposed to create never exists, and the miss surfaces later as runtime failures on whatever code path needs it. Taking the upstream `_journal.json` and snapshots instead of the project's own is the second half of the same trap: the final snapshot then knows nothing about the project's own tables, so the next `generate` re-emits `CREATE TABLE` for tables that already exist.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "generatesaas",
3
- "version": "3.31.0",
3
+ "version": "3.32.0",
4
4
  "type": "module",
5
5
  "description": "CLI for scaffolding and managing GenerateSaaS projects",
6
6
  "license": "UNLICENSED",