CREATE TABLE "inventory_decay_profiles" ( "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, "name" varchar(64) NOT NULL, "description" text, "half_life_days" double precision DEFAULT 7 NOT NULL, "stale_after_days" integer DEFAULT 30 NOT NULL, "active" boolean DEFAULT true NOT NULL, "created_at" timestamp with time zone DEFAULT now() NOT NULL, "updated_at" timestamp with time zone DEFAULT now() NOT NULL, CONSTRAINT "inventory_decay_profiles_name_unique" UNIQUE("name") ); --> statement-breakpoint CREATE TABLE "inventory_item_decay_profile" ( "inventory_item_id" uuid PRIMARY KEY NOT NULL, "decay_profile_id" uuid NOT NULL ); --> statement-breakpoint ALTER TABLE "inventory_item_decay_profile" ADD CONSTRAINT "inventory_item_decay_profile_inventory_item_id_inventory_items_id_fk" FOREIGN KEY ("inventory_item_id") REFERENCES "public"."inventory_items"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint ALTER TABLE "inventory_item_decay_profile" ADD CONSTRAINT "inventory_item_decay_profile_decay_profile_id_inventory_decay_profiles_id_fk" FOREIGN KEY ("decay_profile_id") REFERENCES "public"."inventory_decay_profiles"("id") ON DELETE restrict ON UPDATE no action;