ALTER TABLE "trail_crumbs" ADD COLUMN "added_by" uuid;--> statement-breakpoint
-- existing rows predate cross-user adds: the adder is the crumb's author
UPDATE "trail_crumbs" tc SET "added_by" = c."author_id"
  FROM "crumbs" c WHERE c."id" = tc."crumb_id";--> statement-breakpoint
ALTER TABLE "trail_crumbs" ALTER COLUMN "added_by" SET NOT NULL;--> statement-breakpoint
ALTER TABLE "trail_crumbs" ADD CONSTRAINT "trail_crumbs_added_by_users_id_fk" FOREIGN KEY ("added_by") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;
