chore(local-db): drop the Clerk columns
What & why
users.clerk_id and organizations.clerk_org_id are Clerk leftovers. Clerk hasn't been the auth provider since January, and nothing reads or writes either column — verified by exact column name across the repo, not by a fuzzy search.
clerk_id was notNull().unique(), which makes it more than dead weight: any future insert into the local users table would have had to invent a value for a provider we don't use. Same shape as the BLOB_READ_WRITE_TOKEN tripwire — a required thing with nothing behind it.
Scope
The tables stay. organizations is live (host-service-coordinator.ts:1205 selects organizations.name), so this drops two columns and their indexes, not the tables.
DROP INDEX `organizations_clerk_org_id_unique`;
DROP INDEX `organizations_clerk_org_id_idx`;
ALTER TABLE `organizations` DROP COLUMN `clerk_org_id`;
DROP INDEX `users_clerk_id_unique`;
DROP INDEX `users_clerk_id_idx`;
ALTER TABLE `users` DROP COLUMN `clerk_id`;
Generated by drizzle-kit generate, not hand-written. It drops each index before its column, which SQLite requires.
How I tested it
bun run typecheckandbun run lint— both pass.- Confirmed no code references
clerk_id/clerk_org_idoutside the schema and migration history. - Confirmed desktop applies local-db migrations on start (
apps/desktop/src/main/lib/local-db/index.ts:99), so this reaches existing installs on next launch rather than only new ones. packages/local-dbhas no test suite to run.
Not exercised against a populated local database — the migration is index-drops plus column-drops on tables nothing writes, and SQLite has supported DROP COLUMN since 3.35.
Deliberately not included
Same file, same era, but Electric-sync leftovers rather than Clerk ones — each deserves its own decision:
organizationMembershas zero references anywhere.- The
userstable itself is imported by nothing; onlyorganizationsandsettingsare.
Checklist
- PR title follows conventional commits (
type(scope): subject) -
bun run lintandbun run typecheckpass (CI fails on lint warnings too) - "Allow edits from maintainers" is checked on fork PRs
https://claude.ai/code/session_01QAQLVm3xTUXsJhpPQo3Nuf
Summary by cubic
Removes the leftover Clerk columns from the local database so future inserts into the users table no longer need a value for a provider we don't use.
- Drops
users.clerk_idandorganizations.clerk_org_idalong with their indexes; the tables remain. - The migration applies to existing installs on their next launch.
- Generated with
drizzle-kit, following SQLite's requirement to drop indexes before columns.
Summary by CodeRabbit
- Refactor
- Removed legacy third-party identity fields from user and organization records.
- User and organization records now rely on their primary identifiers, while retaining existing email and slug uniqueness.
- Updated local database migrations and schema metadata to reflect the changes.