Files
pokemon-inventory/database/migrations/0017_pricing_refresh_jobs.sql
T
fragginwagon 409d2cd0ca
Quality / test (push) Canceled after 0s
feat: persist pricing refresh jobs
2026-09-09 11:53:14 -04:00

16 lines
789 B
SQL

CREATE TABLE "pricing_refresh_jobs" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"seller_id" uuid NOT NULL REFERENCES "sellers"("id"),
"inventory_item_id" uuid NOT NULL REFERENCES "inventory_items"("id"),
"product_id" uuid NOT NULL REFERENCES "products"("id"),
"condition_id" uuid NOT NULL REFERENCES "conditions"("id"),
"provider_id" text NOT NULL,
"status" text DEFAULT 'PENDING' NOT NULL,
"observations" jsonb DEFAULT '[]'::jsonb NOT NULL,
"valuation" jsonb,
"error" text,
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE INDEX "pricing_refresh_jobs_status_created_at_index" ON "pricing_refresh_jobs" USING btree ("status", "created_at");