Skip to content

feat(schema): add rotation.lml_identity_id + library_identity enum value (BS#1380 PR 1/5)#1417

Merged
jakebromberg merged 1 commit into
mainfrom
feature/bs-1380-1-schema
Jun 14, 2026
Merged

feat(schema): add rotation.lml_identity_id + library_identity enum value (BS#1380 PR 1/5)#1417
jakebromberg merged 1 commit into
mainfrom
feature/bs-1380-1-schema

Conversation

@jakebromberg

Copy link
Copy Markdown
Member

First in a 5-PR chain implementing #1380. See the issue's Suggested approach section for the full sequence.

Summary

  • ALTER TABLE rotation ADD COLUMN lml_identity_id integer NULL — stable LML release-identity handle (points at entity.release_identity.id per LML#526). FK semantics live on LML's side; PG-level FK is not enforceable across the network.
  • ALTER TYPE discogs_release_id_source_enum ADD VALUE 'library_identity' AFTER 'discogs_direct_backfill' — new dj-site-side writer that doesn't fit any of the three existing values. Without it, the NOT NULL DEFAULT 'tubafrenzy_paste' would mislabel every dj-site row, corrupting the provenance invariant.

Migration is DDL-only with no row UPDATE and no new index. Seqscan-fine at the ~hundreds-of-active-rows scale, matching jobs/rotation-release-id-backfill/query.ts.

What's NOT in this PR

What Chained PR
shared/lml-client resolveIdentity wrapper PR 2
jobs/rotation-etl drift-prevention CASE PR 3
apps/backend addToRotation + pickAddRotationFields allowlist PR 4
jobs/rotation-lml-identity-backfill cron + Closes #1380 PR 5

Test plan

  • lint:migrations (93 entries, 1 historical-allowlisted warning)
  • @wxyc/database typecheck
  • CI migrate-dryrun (will fire because shared/database/src/migrations/** changed)

The schema is additive and nullable; existing readers keep working through the transition. Subsequent PRs in the chain consume the column.

Refs #1380

…lue (BS#1380 PR 1/5)

Adds the schema surface for the BS#1380 cross-cache-identity work; the
runtime + ETL + backfill writers land in chained PRs (2-5).

Migration 0094 (DDL-only, no index, no row UPDATE):
- ALTER TABLE rotation ADD COLUMN lml_identity_id integer NULL
  (stable LML release-identity handle; points at entity.release_identity.id
  per LML#526. FK semantics live on LML's side; PG-level FK is not
  enforceable across the network. Seqscan-fine at the ~hundreds-of-active-
  rows scale, matching jobs/rotation-release-id-backfill/query.ts.)
- ALTER TYPE discogs_release_id_source_enum
  ADD VALUE 'library_identity' AFTER 'discogs_direct_backfill'
  (new dj-site-side writer that doesn't fit any of the three existing
  tubafrenzy/operator-side values. Without this, the NOT NULL DEFAULT
  'tubafrenzy_paste' would mislabel every dj-site row.)

Schema doc comment at schema.ts:494-528 updated to document the fourth
enum value alongside the existing three.

No runtime code in this PR. The next PRs in the chain land the writers
+ tests:
- PR 2: shared/lml-client `resolveIdentity` wrapper
- PR 3: jobs/rotation-etl drift-prevention CASE
- PR 4: apps/backend addToRotation + pickAddRotationFields allowlist
- PR 5: jobs/rotation-lml-identity-backfill cron + Closes #1380

Refs #1380
@github-actions

Copy link
Copy Markdown

Schema constraint shape report

data-shape report errored (exit 0): node:internal/modules/runmain:107 triggerUncaughtException( ^ Error ERRMODULENOTFOUND: Cannot find package 'postgres' imported from /home/runner/work/Backend-Service/Backend-Service/scripts/schema-shape-report.mjs Did you mean to import "postgres/cjs/src/index.js"? at Object.getPackageJ; manual check required

@jakebromberg

Copy link
Copy Markdown
Member Author

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

@jakebromberg jakebromberg merged commit d39a0bb into main Jun 14, 2026
6 checks passed
@jakebromberg jakebromberg deleted the feature/bs-1380-1-schema branch June 14, 2026 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant