-- Adds `Source.key` (`key String @unique`) — the catalog of implemented -- recipe sources is now kept in sync with the adapter registry -- (recipe-source-registry.ts) by key, same "stable English camelCase uid" -- convention as Diet/Unit/TechStep, rather than hand-maintained. `sources` -- has never been seeded (no rows exist pre-launch), so a plain NOT NULL -- column with no backfill is safe. -- -- Adds `Recipe.external_id` — the item's identifier on `source`, `null` -- for a manually-authored recipe. `@@unique([sourceId, externalId])` -- prevents importing the same source recipe twice; Postgres treats each -- NULL as distinct, so manually-authored recipes (both columns null) never -- collide with each other or with one another here. -- AlterTable ALTER TABLE "sources" ADD COLUMN "key" TEXT NOT NULL; -- CreateIndex CREATE UNIQUE INDEX "sources_key_key" ON "sources"("key"); -- AlterTable ALTER TABLE "recipe" ADD COLUMN "external_id" TEXT; -- CreateIndex CREATE UNIQUE INDEX "recipe_source_id_external_id_key" ON "recipe"("source_id", "external_id");