From 57462e69dff9a32b80f4042dd4ac4a98c4435f4c Mon Sep 17 00:00:00 2001 From: Jannis Braun <151788261+TheZwiss@users.noreply.github.com> Date: Sun, 26 Apr 2026 21:07:08 +0200 Subject: [PATCH] docs(schema): comment CHECK invariant on peer_approval_requests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit drizzle's snapshot does not encode SQL-level CHECK constraints. Without this comment, a future migration that recreates the table for unrelated reasons would silently drop the (direction='inbound' → hmac_secret NOT NULL) invariant. --- packages/server/src/db/schema.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/server/src/db/schema.ts b/packages/server/src/db/schema.ts index 5f877c4d..08448e40 100644 --- a/packages/server/src/db/schema.ts +++ b/packages/server/src/db/schema.ts @@ -377,6 +377,11 @@ export const federationPeers = sqliteTable('federation_peers', { approvalToken: text('approval_token'), }); +// SQL-level CHECK constraint enforces (direction='inbound' → hmac_secret NOT NULL). +// See packages/server/drizzle/0003_brave_inhumans.sql. drizzle-kit cannot represent +// CHECK constraints in its snapshot, so any future migration that recreates this +// table MUST re-add the CHECK clause by hand. The snapshot WILL silently drop it +// otherwise. export const peerApprovalRequests = sqliteTable('peer_approval_requests', { id: text('id').primaryKey(), origin: text('origin').notNull(),