@adatechnology/content-module 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,44 @@
1
+ CREATE TABLE "content"."community_images" (
2
+ "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
3
+ "company_id" uuid NOT NULL,
4
+ "account_id" varchar(64) NOT NULL,
5
+ "storage_key" varchar(512) NOT NULL,
6
+ "url" varchar(2048) NOT NULL,
7
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL
8
+ );
9
+ --> statement-breakpoint
10
+ CREATE TABLE "content"."content_settings" (
11
+ "company_id" uuid PRIMARY KEY NOT NULL,
12
+ "community_moderation" varchar(8) DEFAULT 'before' NOT NULL,
13
+ "community_daily_limit" integer DEFAULT 3 NOT NULL,
14
+ "max_images_per_post" integer DEFAULT 12 NOT NULL,
15
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL
16
+ );
17
+ --> statement-breakpoint
18
+ CREATE TABLE "content"."post_reports" (
19
+ "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
20
+ "company_id" uuid NOT NULL,
21
+ "post_id" uuid NOT NULL,
22
+ "reason" varchar(300) NOT NULL,
23
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
24
+ "resolved_at" timestamp with time zone,
25
+ "resolved_by" varchar(64)
26
+ );
27
+ --> statement-breakpoint
28
+ ALTER TABLE "content"."posts" ALTER COLUMN "status" SET DATA TYPE varchar(16);--> statement-breakpoint
29
+ ALTER TABLE "content"."posts" ALTER COLUMN "status" SET DEFAULT 'draft';--> statement-breakpoint
30
+ ALTER TABLE "content"."posts" ADD COLUMN "origin" varchar(12) DEFAULT 'staff' NOT NULL;--> statement-breakpoint
31
+ ALTER TABLE "content"."posts" ADD COLUMN "author_account_id" varchar(64);--> statement-breakpoint
32
+ ALTER TABLE "content"."posts" ADD COLUMN "author_display_name" varchar(80);--> statement-breakpoint
33
+ ALTER TABLE "content"."posts" ADD COLUMN "author_reference_month" varchar(7);--> statement-breakpoint
34
+ ALTER TABLE "content"."posts" ADD COLUMN "review_note" varchar(500);--> statement-breakpoint
35
+ ALTER TABLE "content"."posts" ADD COLUMN "terms_accepted_at" timestamp with time zone;--> statement-breakpoint
36
+ ALTER TABLE "content"."posts" ADD COLUMN "submitted_at" timestamp with time zone;--> statement-breakpoint
37
+ ALTER TABLE "content"."posts" ADD COLUMN "pending_revision" jsonb;--> statement-breakpoint
38
+ ALTER TABLE "content"."post_reports" ADD CONSTRAINT "post_reports_post_id_posts_id_fk" FOREIGN KEY ("post_id") REFERENCES "content"."posts"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
39
+ CREATE UNIQUE INDEX "idx_community_images_company_url" ON "content"."community_images" USING btree ("company_id","url");--> statement-breakpoint
40
+ CREATE INDEX "idx_community_images_account" ON "content"."community_images" USING btree ("company_id","account_id","created_at");--> statement-breakpoint
41
+ CREATE INDEX "idx_post_reports_open" ON "content"."post_reports" USING btree ("company_id","created_at") WHERE "resolved_at" IS NULL;--> statement-breakpoint
42
+ CREATE INDEX "idx_posts_company_origin_status_published" ON "content"."posts" USING btree ("company_id","origin","status","published_at");--> statement-breakpoint
43
+ CREATE INDEX "idx_posts_community_author_created" ON "content"."posts" USING btree ("company_id","author_account_id","created_at") WHERE "origin" = 'community';--> statement-breakpoint
44
+ CREATE INDEX "idx_posts_moderation_queue" ON "content"."posts" USING btree ("company_id","submitted_at") WHERE "status" = 'pending_review' OR "pending_revision" IS NOT NULL;