CREATE TABLE "community_prices" ( "id" serial PRIMARY KEY NOT NULL, "global_item_id" integer NOT NULL, "user_id" integer NOT NULL, "market" text NOT NULL, "currency" text NOT NULL, "price_cents" integer NOT NULL, "price_date" timestamp, "source_type" text NOT NULL, "created_at" timestamp DEFAULT now() NOT NULL, CONSTRAINT "community_prices_global_item_id_user_id_source_type_unique" UNIQUE("global_item_id","user_id","source_type") ); --> statement-breakpoint CREATE TABLE "market_prices" ( "id" serial PRIMARY KEY NOT NULL, "global_item_id" integer NOT NULL, "market" text NOT NULL, "currency" text NOT NULL, "price_cents" integer NOT NULL, "source" text, "created_at" timestamp DEFAULT now() NOT NULL, CONSTRAINT "market_prices_global_item_id_market_currency_unique" UNIQUE("global_item_id","market","currency") ); --> statement-breakpoint ALTER TABLE "items" ADD COLUMN "price_currency" text DEFAULT 'EUR';--> statement-breakpoint ALTER TABLE "thread_candidates" ADD COLUMN "found_price_cents" integer;--> statement-breakpoint ALTER TABLE "thread_candidates" ADD COLUMN "found_price_currency" text;--> statement-breakpoint ALTER TABLE "thread_candidates" ADD COLUMN "found_price_date" timestamp;--> statement-breakpoint ALTER TABLE "community_prices" ADD CONSTRAINT "community_prices_global_item_id_global_items_id_fk" FOREIGN KEY ("global_item_id") REFERENCES "public"."global_items"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint ALTER TABLE "community_prices" ADD CONSTRAINT "community_prices_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint ALTER TABLE "market_prices" ADD CONSTRAINT "market_prices_global_item_id_global_items_id_fk" FOREIGN KEY ("global_item_id") REFERENCES "public"."global_items"("id") ON DELETE cascade ON UPDATE no action;