From 798aa22690c29311fe18ec937aac061f0903335c Mon Sep 17 00:00:00 2001 From: Jannis Braun <151788261+TheZwiss@users.noreply.github.com> Date: Fri, 24 Apr 2026 23:38:47 +0200 Subject: [PATCH] docs(systems): rewrite database.md migration workflow section after migration squash MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Line 4 pointed at a stale `runMigrations()` name and omitted the drizzle-kit generate step entirely. Replace with a description of the real workflow: `pnpm db:generate` produces SQL from `schema.ts`, `initDatabase()` runs `drizzle.migrate()` + `ensureDefaults()` on startup. Note the 2026-04-24 baseline squash for future readers. Delete the "Migration flags (internal)" line — those flags belonged to pre-drizzle data-fix migrations deleted wholesale in 3acaea2 (2026-04-09) and are historical trivia with no present referent. Refs backlog #31 Phase 2. --- docs/systems/database.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/docs/systems/database.md b/docs/systems/database.md index c560265d..29e880de 100644 --- a/docs/systems/database.md +++ b/docs/systems/database.md @@ -1,7 +1,7 @@ # Database Schema Reference Source of truth: `packages/server/src/db/schema.ts` (Drizzle ORM) -Migrations: `packages/server/src/db/migrate.ts` (runs on startup via `runMigrations()`) +Migrations: drizzle-kit generates SQL from `schema.ts` (`pnpm db:generate` from `packages/server/`). On startup, `initDatabase()` runs `drizzle.migrate()` against `packages/server/drizzle/`, then `ensureDefaults()` (settings row, Snowflake worker ID, first-admin promotion). Migration history was squashed to a single baseline on 2026-04-24 (backlog #31 Phase 2). Engine: SQLite via `better-sqlite3` IDs: Snowflake text, permissions: bigint decimal strings @@ -344,8 +344,6 @@ PK: (spaceId, userId, restrictionType) | autoAcceptPeering | integer NOT NULL | 1 | When 0, `peer/accept` rejects unsolicited requests with 403 | | updatedAt | integer NOT NULL | | | -Migration flags (internal): `voice_bit_migrated`, `profile_attachments_cleaned`, `thumbnails_backfilled`, `media_dimensions_backfilled`, `legacy_dm_sync_done` - --- ## Federation Tables