Repository navigation
Description
Part of the API v2 program epic #135. Durable architecture: docs/architecture/api-contract.md (PR #880). Runs in parallel with the API phases; everything below ships in or before the bridge except the reset itself.
Grouped deliverables:
- Dead-table drops —
plex_sync_*×4,user_playback_sessions,content_id_migration_map: PR chore(db): drop dead plex_sync, user_playback_sessions, and content_id_migration_map tables [schema-hygiene 1/4] #879. - Integrity — the 14 missing
user_idforeign keys (partitionedpolicy_decisions*may stay exempt), leading indexes for the 46 unindexed FK columns (prioritizeauth_sessions.user_id,downloads.media_file_id,library_collection_items.media_item_id),users.role/users.enabledNOT NULL. - Standardization — 36 serial-style tables to
GENERATED AS IDENTITY; 14varchar(n)columns in notifications/push totext; consistency renames (oauth_session,oauth_completion,playback_history_admin). - Bigint widenings —
users.id,media_files.id,media_folders.id: table rewrites; separate PR with an explicit maintenance-window release note. - Bridge-timing — drop
user_settings+user_setting_migration_rejectsafter the Go settings backfill; bridge is the last release with the one-way SQLite→Postgres userdb import. - 1.0 reset — migration squash to one baseline + guard (empty or bridge-tip only), seed-data fidelity audit (~53 seeding migrations incl. backfill-completion flags), CI parity gate comparing normalized schema and seed data; the parity gate must exist before the baseline PR opens (Phase 6).
Blocked on maintainer decisions (do not implement until recorded on #135): which library-restriction layers survive (per-user library_ids, access-group list, per-profile allow list, profile-scoped setting), and whether the per-user policy override columns on users remain a documented override chain or fold into access groups.
Migration discipline is absolute per AGENTS.md gotchas: make migrate-create only, no goose fix, no paired up/down files, no renumbering, no encrypted server_settings renames.
AI disclosure: drafted by Claude Code (claude-fable-5) orchestrating the #135 program.
Activity
Quick104 commentedon Sep 1, 2026
Status: item 1 (dead-table drops) is PR #879; item 2 (integrity — 17 user FKs, 57 FK leading indexes, role/enabled NOT NULL) is PR #889, stacked on #879. Item 3 (standardization) starting next on a branch stacked on #889.
Noted during the integrity audit for a later decision:
jellycompat_playback_sessions.user_idandoauth_session.linking_user_idhold Silo user ids astext(the latter parsed with strconv.Atoi in internal/auth/oauth_handler.go), so they cannot carry FKs without a column retype — candidate for the standardization group or a follow-up, needs its own review.Posted by the #135 orchestration session (claude-fable-5 via Claude Code).
Quick104 commentedon Sep 1, 2026
Decision record (schema PR 3, #893): the table renames ship as a single-transaction rename without compatibility views or an expand/contract release pair. Rationale on the PR: mixed-version API replicas during a shape-changing migration are unsupported under the documented maintenance-window posture; the rename fails closed on old replicas; carrying views into the squashed 1.0 baseline works against this workstream. If the maintainer wants expand/contract for renames specifically, the restructure is Go-side dual-name support one release ahead of the rename.
Also fixed on #889 (5bad725): the planstore DB-gated test fixture now supplies a role, since
users.roleis NOT NULL with no default after the integrity migration.Next in this workstream: PR 4 (bigint widenings of users.id / media_files.id / media_folders.id) is in progress on
schema/hygiene-bigint-ids, stacked on #893.Posted by the #135 orchestration session (claude-fable-5 via Claude Code).
Quick104 commentedon Sep 1, 2026
Item 4 (bigint widenings of
users.id,media_files.id,media_folders.id) is PR #898, stacked on #893. Parents only, per the plan; the migration header carries the full list ofintegerchild columns with rewrite cost, plus fourint4advisory-lock sites, for the maintainer to schedule as a separate child sweep. The PR body has the maintenance-window release note (three tables rewritten, ACCESS EXCLUSIVE on every referencing relation, raiseSILO_MIGRATE_TIMEOUTon large libraries).The pre-bridge hygiene stack is now complete:
main← #879 ← #889 ← #893 ← #898. Remaining in this workstream: the bridge-timing drop ofuser_settings/user_setting_migration_rejects(Phase 5), the 1.0 reset with parity gate (Phase 6), and the two design decisions above, which stay blocked on the maintainer.Posted by the #135 orchestration session (claude-fable-5 via Claude Code).
Quick104 commentedon Sep 2, 2026
Follow-up filed: #906 — adopt sqlc for the static-query repositories once item 6 (the 1.0 baseline + parity gate) is on
main. Deliberately sequenced after this workstream and outside the API v2 program; reasoning is in the issue.