Migrate an in-process Postgres from committed migrations #367

Closed
opened 2026-10-11 16:25:58 +00:00 by root · 6 comments
root commented 2026-10-11 16:25:58 +00:00 (Migrated from gitlab.core-project.space)

Imported from GitHub amaurycoudr/chess-project#367, opened by @amaurycoudr on 2026-10-11 16:25 UTC.


Parent

#354

What to build

Stories 7, 8, 9 and 18 of #354. Bring Drizzle into the API at the exact release candidate ADR 0031 pins (drizzle-orm and drizzle-kit at the same RC; drizzle-kit a dev dependency; node-postgres as the production driver). Add an empty schema and one baseline migration with no table, generated by drizzle-kit and committed, so the whole path runs end to end.

Add the API's framework-free database module in its shared folder. From a database URL it builds the Drizzle handle, checks the database answers, migrates from the committed migrations, and closes the pool. Its integration tests run on an in-process Postgres (PGlite) built per test file with the real migrations, a test-only dependency pinned exactly. A test in the gate fails when the schema has a change that no committed migration captures.

Write the ADR the spec calls for: API tests run on an in-process Postgres (PGlite) with the real migrations; dev, CI and every stack run real Postgres. Add its row to the ADR index. Nothing boots on the database yet. See #354, Migrations, API wiring and Local dev, tests and CI.

Seam: the API's database module (connect and migrate), integration tests against an in-process Postgres.

Acceptance criteria

  • An empty in-process database reaches the latest migration, and the migration table lists every committed migration.
  • Migrating an already-migrated database changes nothing.
  • A schema change with no generated migration fails pnpm test, and the committed baseline passes it.
  • Checking a database that does not answer is refused with a message naming the database URL setting.
  • drizzle-orm and drizzle-kit sit at the same exact RC with no caret; PGlite is a pinned dev dependency.
  • The ADR exists, is accepted with the owner, and has its row in the ADR index; the index lint passes.
  • The gate is green, with no Docker needed by pnpm test or the pre-commit hook.
  • The ADR is this ticket's first commit, before any code it governs
> _Imported from GitHub [amaurycoudr/chess-project#367](https://github.com/amaurycoudr/chess-project/issues/367), opened by [@amaurycoudr](https://github.com/amaurycoudr) on 2026-10-11 16:25 UTC._ <!-- github-issue:367 --> --- ## Parent #354 ## What to build Stories 7, 8, 9 and 18 of #354. Bring Drizzle into the API at the exact release candidate ADR 0031 pins (`drizzle-orm` and `drizzle-kit` at the same RC; `drizzle-kit` a dev dependency; `node-postgres` as the production driver). Add an empty schema and one baseline migration with no table, generated by `drizzle-kit` and committed, so the whole path runs end to end. Add the API's framework-free database module in its shared folder. From a database URL it builds the Drizzle handle, checks the database answers, migrates from the committed migrations, and closes the pool. Its integration tests run on an in-process Postgres (PGlite) built per test file with the real migrations, a test-only dependency pinned exactly. A test in the gate fails when the schema has a change that no committed migration captures. Write the ADR the spec calls for: API tests run on an in-process Postgres (PGlite) with the real migrations; dev, CI and every stack run real Postgres. Add its row to the ADR index. Nothing boots on the database yet. See #354, *Migrations*, *API wiring* and *Local dev, tests and CI*. Seam: the API's database module (connect and migrate), integration tests against an in-process Postgres. ## Acceptance criteria - [ ] An empty in-process database reaches the latest migration, and the migration table lists every committed migration. - [ ] Migrating an already-migrated database changes nothing. - [ ] A schema change with no generated migration fails `pnpm test`, and the committed baseline passes it. - [ ] Checking a database that does not answer is refused with a message naming the database URL setting. - [ ] `drizzle-orm` and `drizzle-kit` sit at the same exact RC with no caret; PGlite is a pinned dev dependency. - [ ] The ADR exists, is accepted with the owner, and has its row in the ADR index; the index lint passes. - [ ] The gate is green, with no Docker needed by `pnpm test` or the pre-commit hook. - [ ] The ADR is this ticket's first commit, before any code it governs
root commented 2026-10-11 16:25:58 +00:00 (Migrated from gitlab.core-project.space)

GitHub issue relations, imported as "related" links (GitLab CE has no sub-issues or blocking links).

  • Parent (sub-issue of): #354
  • Blocking: #368
> _GitHub issue relations, imported as "related" links (GitLab CE has no sub-issues or blocking links)._ <!-- github-relations --> - Parent (sub-issue of): #354 - Blocking: #368
root commented 2026-10-13 08:39:43 +00:00 (Migrated from gitlab.core-project.space)

mentioned in issue #368

mentioned in issue #368
root commented 2026-10-13 08:41:20 +00:00 (Migrated from gitlab.core-project.space)

mentioned in issue #354

mentioned in issue #354
root commented 2026-10-13 08:42:24 +00:00 (Migrated from gitlab.core-project.space)

marked this issue as related to #354

marked this issue as related to #354
root commented 2026-10-13 08:42:32 +00:00 (Migrated from gitlab.core-project.space)

marked this issue as related to #368

marked this issue as related to #368
root commented 2026-10-13 10:17:36 +00:00 (Migrated from gitlab.core-project.space)

mentioned in merge request !506

mentioned in merge request !506
root (Migrated from gitlab.core-project.space) closed this issue 2026-10-13 14:10:08 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
amaurycoudr/chess-project#367
No description provided.