Skip to content

Commit 5d25fe8

Browse files
authored
Merge pull request #9 from typelets/feat/public-notes-api
feat: add public notes API for publishing encrypted notes
2 parents 9835f6f + 76061b7 commit 5d25fe8

File tree

10 files changed

+1845
-8
lines changed

10 files changed

+1845
-8
lines changed

drizzle/0002_mixed_bulldozer.sql

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
CREATE TABLE "public_notes" (
2+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
3+
"slug" text NOT NULL,
4+
"note_id" uuid NOT NULL,
5+
"user_id" text NOT NULL,
6+
"title" text NOT NULL,
7+
"content" text NOT NULL,
8+
"type" text DEFAULT 'note' NOT NULL,
9+
"author_name" text,
10+
"published_at" timestamp with time zone DEFAULT now() NOT NULL,
11+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
12+
CONSTRAINT "public_notes_slug_unique" UNIQUE("slug")
13+
);
14+
--> statement-breakpoint
15+
ALTER TABLE "public_notes" ADD CONSTRAINT "public_notes_note_id_notes_id_fk" FOREIGN KEY ("note_id") REFERENCES "public"."notes"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
16+
ALTER TABLE "public_notes" ADD CONSTRAINT "public_notes_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
17+
CREATE INDEX "idx_public_notes_slug" ON "public_notes" USING btree ("slug");--> statement-breakpoint
18+
CREATE INDEX "idx_public_notes_note_id" ON "public_notes" USING btree ("note_id");--> statement-breakpoint
19+
CREATE INDEX "idx_public_notes_user_id" ON "public_notes" USING btree ("user_id");

0 commit comments

Comments
 (0)