12 lines
633 B
SQL
12 lines
633 B
SQL
CREATE TABLE "announcements" (
|
|
"id" text PRIMARY KEY NOT NULL,
|
|
"title" text NOT NULL,
|
|
"body" text DEFAULT '' NOT NULL,
|
|
"published" boolean DEFAULT false NOT NULL,
|
|
"created_by" text,
|
|
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
"updated_at" timestamp with time zone
|
|
);
|
|
--> statement-breakpoint
|
|
ALTER TABLE "announcements" ADD CONSTRAINT "announcements_created_by_users_id_fk" FOREIGN KEY ("created_by") REFERENCES "public"."users"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
|
|
CREATE INDEX "announcements_published_created_idx" ON "announcements" USING btree ("published","created_at"); |