A product can be filed under another IMVU category than its parent's: any category path the hub has seen on a revision's parent (and each step of it), within the parent's top-level category, so it stays the same kind of product (the proxy tells clothing, furniture and rooms apart by category). It's an info field like the others: lockable, in the history, undone by the same rules. Lists filter by the chosen path, and products show it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
23 lines
1.6 KiB
SQL
23 lines
1.6 KiB
SQL
CREATE TABLE "product_info_change" (
|
|
"id" serial PRIMARY KEY NOT NULL,
|
|
"product_id" text NOT NULL,
|
|
"by_id" text,
|
|
"kind" text NOT NULL,
|
|
"changes" jsonb NOT NULL,
|
|
"reason" text DEFAULT '' NOT NULL,
|
|
"revert_of" integer,
|
|
"created_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
);
|
|
--> statement-breakpoint
|
|
ALTER TABLE "product" ADD COLUMN "status" text DEFAULT 'published' NOT NULL;--> statement-breakpoint
|
|
ALTER TABLE "product" ADD COLUMN "published_at" timestamp with time zone;--> statement-breakpoint
|
|
ALTER TABLE "product" ADD COLUMN "listed" boolean DEFAULT true NOT NULL;--> statement-breakpoint
|
|
ALTER TABLE "product" ADD COLUMN "tags" jsonb DEFAULT '[]'::jsonb NOT NULL;--> statement-breakpoint
|
|
ALTER TABLE "product" ADD COLUMN "category" jsonb;--> statement-breakpoint
|
|
ALTER TABLE "product" ADD COLUMN "locked" jsonb DEFAULT '[]'::jsonb NOT NULL;--> statement-breakpoint
|
|
ALTER TABLE "product_info_change" ADD CONSTRAINT "product_info_change_product_id_product_id_fk" FOREIGN KEY ("product_id") REFERENCES "public"."product"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
ALTER TABLE "product_info_change" ADD CONSTRAINT "product_info_change_by_id_user_id_fk" FOREIGN KEY ("by_id") REFERENCES "public"."user"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
|
|
CREATE INDEX "product_info_change_product" ON "product_info_change" USING btree ("product_id","id");--> statement-breakpoint
|
|
CREATE INDEX "product_tags" ON "product" USING gin ("tags");--> statement-breakpoint
|
|
-- Products from before drafts were published when made.
|
|
UPDATE "product" SET "published_at" = "created_at" WHERE "published_at" IS NULL; |