Files
pokemon-inventory/database/migrations/0014_acquisitions.sql
T
fragginwagon eee8e1978f
Quality / test (push) Canceled after 0s
feat: add acquisition API foundation
Add acquisition persistence, cost-basis calculation, seller-scoped admin routes, contracts, validation, migration, and focused application/HTTP tests.
2026-09-09 00:39:56 -04:00

19 lines
758 B
SQL

CREATE TABLE "acquisitions" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"inventory_item_id" uuid NOT NULL REFERENCES "inventory_items"("id"),
"method" text NOT NULL,
"cost_minor" integer NOT NULL,
"currency" text NOT NULL,
"date" text,
"source" text,
"location" text,
"shipping_minor" integer DEFAULT 0 NOT NULL,
"tax_minor" integer DEFAULT 0 NOT NULL,
"other_fees_minor" integer DEFAULT 0 NOT NULL,
"estimated_trade_value_minor" integer DEFAULT 0 NOT NULL,
"notes" 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 "acquisitions_inventory_item_id_index" ON "acquisitions" USING btree ("inventory_item_id");