feat(db): drop users.consentGiven/consentAt (ADR-0014 step 8)

Backfills consent_given=1 rows into user_consents as data:core before
dropping the legacy columns. auth.ts now writes user_consents on signup;
POST /consent writes user_consents; admin/user routes cleaned of the old
fields. Migration is idempotent — DROP COLUMN is wrapped in try/catch so
it no-ops on fresh DBs that never had the columns.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-05 11:50:27 +00:00
parent afb0e9b0cb
commit ed1705cb5d
15 changed files with 76 additions and 143 deletions

View File

@@ -23,8 +23,8 @@ const STALE_BASE = {
beforeAll(async () => {
await testDb.insert(users).values([
{ id: 'sub-user-1', email: 'sub1@test.com', role: 'user', consentGiven: true, consentAt: NOW, createdAt: NOW },
{ id: 'sub-user-2', email: 'sub2@test.com', role: 'user', consentGiven: true, consentAt: NOW, createdAt: NOW },
{ id: 'sub-user-1', email: 'sub1@test.com', role: 'user', createdAt: NOW },
{ id: 'sub-user-2', email: 'sub2@test.com', role: 'user', createdAt: NOW },
]);
});