This commit is contained in:
z.ai committed 2026-10-08 11:09:37 +08:00
1 parent c1541b80df
commit b4c7908029
97 files changed
+12403 -154

No files matched your search

+21
View File
@@ -0,0 +1,21 @@
CREATE TABLE "posts" (
"id" serial PRIMARY KEY NOT NULL,
"slug" varchar(200) NOT NULL,
"title" text NOT NULL,
"summary" text NOT NULL,
"content" text NOT NULL,
"tags" text[] DEFAULT ARRAY[]::text[] NOT NULL,
"status" varchar(20) DEFAULT 'draft' NOT NULL,
"reading_minutes" integer DEFAULT 1 NOT NULL,
"cover" text,
"description" text,
"published_at" timestamp with time zone,
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE UNIQUE INDEX "posts_slug_unique_idx" ON "posts" USING btree ("slug");--> statement-breakpoint
CREATE INDEX "posts_status_published_at_idx" ON "posts" USING btree ("status","published_at" DESC NULLS LAST);--> statement-breakpoint
CREATE INDEX "posts_tags_gin_idx" ON "posts" USING gin ("tags");--> statement-breakpoint
ALTER TABLE "posts" ADD CONSTRAINT "posts_status_check" CHECK ("status" IN ('draft', 'published'));--> statement-breakpoint
ALTER TABLE "posts" ADD CONSTRAINT "posts_slug_format_check" CHECK ("slug" ~ '^[a-z0-9]+(-[a-z0-9]+)*$');