feat(33-02): generate migration for market_prices, community_prices tables
- CREATE TABLE market_prices with unique(global_item_id, market, currency) - CREATE TABLE community_prices with unique(global_item_id, user_id, source_type) - ALTER TABLE items ADD COLUMN price_currency - ALTER TABLE thread_candidates ADD COLUMN found_price_cents, found_price_currency, found_price_date - Note: db:push requires running PostgreSQL — apply on deployment Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
31
drizzle-pg/0006_remarkable_susan_delgado.sql
Normal file
31
drizzle-pg/0006_remarkable_susan_delgado.sql
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
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;
|
||||||
1604
drizzle-pg/meta/0006_snapshot.json
Normal file
1604
drizzle-pg/meta/0006_snapshot.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -43,6 +43,13 @@
|
|||||||
"when": 1776095449827,
|
"when": 1776095449827,
|
||||||
"tag": "0005_true_green_goblin",
|
"tag": "0005_true_green_goblin",
|
||||||
"breakpoints": true
|
"breakpoints": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idx": 6,
|
||||||
|
"version": "7",
|
||||||
|
"when": 1776096142720,
|
||||||
|
"tag": "0006_remarkable_susan_delgado",
|
||||||
|
"breakpoints": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
import {
|
import {
|
||||||
boolean,
|
|
||||||
doublePrecision,
|
doublePrecision,
|
||||||
integer,
|
integer,
|
||||||
pgTable,
|
pgTable,
|
||||||
|
|||||||
Reference in New Issue
Block a user