Files
loki/drizzle/0002_project_states_composite_key.sql
T
g-butandClaude Sonnet 4.6 8a5e94e451 feat(settings): profile/account split, location model, connected accounts
- Split ProfileSettings into Profile (public identity) and Account (auth/security) tabs
- Add LocationSettings with two-tier model: homeCity/timezone/locale + currentCity/timezone/until for travelers
- Add AccountSettings with email display, password change, connected OAuth providers, danger zone
- New SettingsTabs with 7-tab horizontal nav (Profile · Account · Location · Agent · Projects · Team · Billing)
- New user_preferences DB table with getUserPreferences/upsertUserPreferences query functions
- New API routes: GET/PATCH /api/me/preferences, GET/DELETE /api/me/connected-accounts/[provider]
- Wire user's active city into weather API; active timezone into cron default
- beacon: replace "Waiting for Claude…" spinner with clean Standby screen (logo + text)
- beacon: fix grep pipeline crash in agent-hook-bridge.sh (|| true guards), fix token lookup
- beacon: fix _PROJECT_ROOT via agent-projects.conf, fix auto-start without zenity dialog

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-19 15:16:18 +02:00

16 lines
738 B
SQL

-- Multi-tenancy fix: project_states.project_key is currently a global PK, which
-- means two users naming a project the same thing overwrite each other's runtime
-- state. Switch to a composite PK on (user_id, project_key) so each tenant owns
-- its own keyspace.
-- Orphan rows have no owner — they can't be migrated safely. Runtime state is
-- ephemeral (re-pushed by the daemon every few seconds), so dropping them is OK.
DELETE FROM "project_states" WHERE "user_id" IS NULL;
ALTER TABLE "project_states" ALTER COLUMN "user_id" SET NOT NULL;
ALTER TABLE "project_states" DROP CONSTRAINT IF EXISTS "project_states_pkey";
ALTER TABLE "project_states"
ADD CONSTRAINT "project_states_pkey" PRIMARY KEY ("user_id", "project_key");