Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Requirements:
```sh
bun dev
```
5. (Optional) Fill the database with sample data: Telegram users, groups and messages, course groups and labels, projects, associations, FAQs, freshman guides, group link reports, audit log entries and grants:
5. (Optional) Fill the database with sample data: Telegram users, groups and messages, course groups and labels, projects, associations, FAQs, freshman guides, website documents (with placeholder file links), group link reports, audit log entries and grants:
```sh
bun run seed:db
```
Expand Down
52 changes: 52 additions & 0 deletions drizzle/0037_web_documents.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
CREATE TABLE "web_document_categories" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "web_document_categories_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"slug" text NOT NULL,
"title" text NOT NULL,
"description" text NOT NULL,
"position" integer DEFAULT 0 NOT NULL,
"legacy_created_by_tg_id" bigint,
"legacy_modified_by_tg_id" bigint,
"created_by_sub" text,
"modified_by_sub" text,
"updated_at" timestamp (0) with time zone,
"created_at" timestamp (0) with time zone DEFAULT now() NOT NULL,
CONSTRAINT "web_document_categories_slug_unique" UNIQUE("slug"),
CONSTRAINT "web_document_categories_creator_check" CHECK ("web_document_categories"."legacy_created_by_tg_id" IS NOT NULL OR "web_document_categories"."created_by_sub" IS NOT NULL)
);
--> statement-breakpoint
CREATE TABLE "web_document_versions" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "web_document_versions_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"document_id" integer NOT NULL,
"version" text NOT NULL,
"date" text NOT NULL,
"file" text NOT NULL,
"legacy_created_by_tg_id" bigint,
"legacy_modified_by_tg_id" bigint,
"created_by_sub" text,
"modified_by_sub" text,
"updated_at" timestamp (0) with time zone,
"created_at" timestamp (0) with time zone DEFAULT now() NOT NULL,
CONSTRAINT "web_document_versions_document_id_version_unique" UNIQUE("document_id","version"),
CONSTRAINT "web_document_versions_creator_check" CHECK ("web_document_versions"."legacy_created_by_tg_id" IS NOT NULL OR "web_document_versions"."created_by_sub" IS NOT NULL)
);
--> statement-breakpoint
CREATE TABLE "web_documents" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "web_documents_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"category_id" integer NOT NULL,
"slug" text NOT NULL,
"title" text NOT NULL,
"description" text,
"position" integer DEFAULT 0 NOT NULL,
"legacy_created_by_tg_id" bigint,
"legacy_modified_by_tg_id" bigint,
"created_by_sub" text,
"modified_by_sub" text,
"updated_at" timestamp (0) with time zone,
"created_at" timestamp (0) with time zone DEFAULT now() NOT NULL,
CONSTRAINT "web_documents_slug_unique" UNIQUE("slug"),
CONSTRAINT "web_documents_creator_check" CHECK ("web_documents"."legacy_created_by_tg_id" IS NOT NULL OR "web_documents"."created_by_sub" IS NOT NULL)
);
--> statement-breakpoint
ALTER TABLE "web_document_versions" ADD CONSTRAINT "web_document_versions_document_id_web_documents_id_fk" FOREIGN KEY ("document_id") REFERENCES "public"."web_documents"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "web_documents" ADD CONSTRAINT "web_documents_category_id_web_document_categories_id_fk" FOREIGN KEY ("category_id") REFERENCES "public"."web_document_categories"("id") ON DELETE restrict ON UPDATE no action;--> statement-breakpoint
CREATE INDEX "web_documents_category_id_idx" ON "web_documents" USING btree ("category_id");
Loading
Loading