Summary#
Adds the V002 database migration that creates all 12 Wave 2 tables, forming the schema foundation every other Wave 2 ticket builds on.
- Account & Identity:
accounts,handles,did_documents,signing_keys - Device & Provisioning:
devices,claim_codes - Sessions & Tokens:
sessions,refresh_tokens - OAuth:
oauth_clients,oauth_authorization_codes,oauth_tokens,oauth_par_requests
All FK relationships are wired. WITHOUT ROWID applied to handles,
did_documents, oauth_clients, and oauth_par_requests (PK-only access
paths). All timestamps are TEXT (ISO-8601), consistent with V001.
Indexes#
| Index | Type |
|---|---|
idx_accounts_email |
UNIQUE |
idx_claim_codes_did |
INDEX |
idx_refresh_tokens_did |
INDEX |
idx_oauth_tokens_did |
INDEX |
Tests#
9 new tests covering:
- All 12 tables verified to exist via
PRAGMA table_info - Idempotency (second
run_migrationscall is a no-op) UNIQUEconstraint onaccounts.email- FK enforcement with
PRAGMA foreign_keys = ON EXPLAIN QUERY PLANconfirms all 4 indexes are used by the query planner
Notes#
Existing row-count assertions in the V001 test suite updated to use
MIGRATIONS.len() so they stay correct as future migrations are added.