feat(18-01): add globalItems, itemGlobalLinks tables and user profile/setup visibility columns
- Add globalItems table with brand, model, category, weightGrams, priceCents, imageUrl, description - Add itemGlobalLinks junction table linking user items to global items (unique per item) - Add displayName, avatarUrl, bio nullable columns to users table - Add isPublic boolean column to setups table (default false) - Import boolean from drizzle-orm/pg-core - Generate migration 0001_tough_boomerang.sql
This commit is contained in:
25
drizzle-pg/0001_tough_boomerang.sql
Normal file
25
drizzle-pg/0001_tough_boomerang.sql
Normal file
@@ -0,0 +1,25 @@
|
||||
CREATE TABLE "global_items" (
|
||||
"id" serial PRIMARY KEY NOT NULL,
|
||||
"brand" text NOT NULL,
|
||||
"model" text NOT NULL,
|
||||
"category" text,
|
||||
"weight_grams" double precision,
|
||||
"price_cents" integer,
|
||||
"image_url" text,
|
||||
"description" text,
|
||||
"created_at" timestamp DEFAULT now() NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "item_global_links" (
|
||||
"id" serial PRIMARY KEY NOT NULL,
|
||||
"item_id" integer NOT NULL,
|
||||
"global_item_id" integer NOT NULL,
|
||||
CONSTRAINT "item_global_links_item_id_unique" UNIQUE("item_id")
|
||||
);
|
||||
--> statement-breakpoint
|
||||
ALTER TABLE "setups" ADD COLUMN "is_public" boolean DEFAULT false NOT NULL;--> statement-breakpoint
|
||||
ALTER TABLE "users" ADD COLUMN "display_name" text;--> statement-breakpoint
|
||||
ALTER TABLE "users" ADD COLUMN "avatar_url" text;--> statement-breakpoint
|
||||
ALTER TABLE "users" ADD COLUMN "bio" text;--> statement-breakpoint
|
||||
ALTER TABLE "item_global_links" ADD CONSTRAINT "item_global_links_item_id_items_id_fk" FOREIGN KEY ("item_id") REFERENCES "public"."items"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "item_global_links" ADD CONSTRAINT "item_global_links_global_item_id_global_items_id_fk" FOREIGN KEY ("global_item_id") REFERENCES "public"."global_items"("id") ON DELETE cascade ON UPDATE no action;
|
||||
Reference in New Issue
Block a user