Skip to content

Commit aa1d8b6

Browse files
Moved from localStorage to DB. Added homepage
1 parent 9e69b9f commit aa1d8b6

19 files changed

+902
-58
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
!.yarn/plugins
1010
!.yarn/releases
1111
!.yarn/versions
12+
.npmrc
1213

1314
# testing
1415
/coverage

migrations/0000_curved_agent_zero.sql

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
-- Current sql file was generated after introspecting the database
2+
-- If you want to run this migration please uncomment this code before executing migrations
3+
/*
4+
CREATE TABLE IF NOT EXISTS "pilcrowstacks_user" (
5+
"id" text PRIMARY KEY NOT NULL,
6+
"name" text NOT NULL,
7+
"email" text,
8+
"image" text,
9+
CONSTRAINT "pilcrowstacks_user_email_unique" UNIQUE("email")
10+
);
11+
--> statement-breakpoint
12+
CREATE TABLE IF NOT EXISTS "pilcrowstacks_docs" (
13+
"id" text PRIMARY KEY NOT NULL,
14+
"title" text,
15+
"emoji" text,
16+
"content" jsonb,
17+
"last_edited" timestamp DEFAULT now() NOT NULL,
18+
"user_id" text
19+
);
20+
--> statement-breakpoint
21+
CREATE TABLE IF NOT EXISTS "pilcrowstacks_docs_in_view" (
22+
"id" text PRIMARY KEY NOT NULL,
23+
"user_id" text NOT NULL,
24+
"doc_ids" jsonb NOT NULL,
25+
"cursor" text DEFAULT '0' NOT NULL,
26+
"homepage" text,
27+
"last_updated" timestamp DEFAULT now() NOT NULL
28+
);
29+
--> statement-breakpoint
30+
CREATE TABLE IF NOT EXISTS "pilcrowstacks_backlinks" (
31+
"user_id" text NOT NULL,
32+
"source_id" text NOT NULL,
33+
"target_id" text NOT NULL,
34+
CONSTRAINT "pilcrowstacks_backlinks_source_id_target_id_pk" PRIMARY KEY("source_id","target_id")
35+
);
36+
--> statement-breakpoint
37+
DO $$ BEGIN
38+
ALTER TABLE "pilcrowstacks_docs" ADD CONSTRAINT "posts_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "public"."pilcrowstacks_user"("id") ON DELETE cascade ON UPDATE cascade;
39+
EXCEPTION
40+
WHEN duplicate_object THEN null;
41+
END $$;
42+
--> statement-breakpoint
43+
DO $$ BEGIN
44+
ALTER TABLE "pilcrowstacks_docs_in_view" ADD CONSTRAINT "pilcrowstacks_docs_in_view_user_id_pilcrowstacks_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."pilcrowstacks_user"("id") ON DELETE cascade ON UPDATE no action;
45+
EXCEPTION
46+
WHEN duplicate_object THEN null;
47+
END $$;
48+
--> statement-breakpoint
49+
DO $$ BEGIN
50+
ALTER TABLE "pilcrowstacks_docs_in_view" ADD CONSTRAINT "pilcrowstacks_docs_in_view_homepage_pilcrowstacks_docs_id_fk" FOREIGN KEY ("homepage") REFERENCES "public"."pilcrowstacks_docs"("id") ON DELETE cascade ON UPDATE no action;
51+
EXCEPTION
52+
WHEN duplicate_object THEN null;
53+
END $$;
54+
--> statement-breakpoint
55+
DO $$ BEGIN
56+
ALTER TABLE "pilcrowstacks_backlinks" ADD CONSTRAINT "pilcrowstacks_backlinks_user_id_pilcrowstacks_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."pilcrowstacks_user"("id") ON DELETE cascade ON UPDATE no action;
57+
EXCEPTION
58+
WHEN duplicate_object THEN null;
59+
END $$;
60+
--> statement-breakpoint
61+
DO $$ BEGIN
62+
ALTER TABLE "pilcrowstacks_backlinks" ADD CONSTRAINT "pilcrowstacks_backlinks_source_id_pilcrowstacks_docs_id_fk" FOREIGN KEY ("source_id") REFERENCES "public"."pilcrowstacks_docs"("id") ON DELETE cascade ON UPDATE no action;
63+
EXCEPTION
64+
WHEN duplicate_object THEN null;
65+
END $$;
66+
--> statement-breakpoint
67+
DO $$ BEGIN
68+
ALTER TABLE "pilcrowstacks_backlinks" ADD CONSTRAINT "pilcrowstacks_backlinks_target_id_pilcrowstacks_docs_id_fk" FOREIGN KEY ("target_id") REFERENCES "public"."pilcrowstacks_docs"("id") ON DELETE cascade ON UPDATE no action;
69+
EXCEPTION
70+
WHEN duplicate_object THEN null;
71+
END $$;
72+
73+
*/

migrations/meta/0000_snapshot.json

+284
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,284 @@
1+
{
2+
"id": "00000000-0000-0000-0000-000000000000",
3+
"prevId": "",
4+
"version": "7",
5+
"dialect": "postgresql",
6+
"tables": {
7+
"public.pilcrowstacks_user": {
8+
"name": "pilcrowstacks_user",
9+
"schema": "",
10+
"columns": {
11+
"id": {
12+
"name": "id",
13+
"type": "text",
14+
"primaryKey": true,
15+
"notNull": true
16+
},
17+
"name": {
18+
"name": "name",
19+
"type": "text",
20+
"primaryKey": false,
21+
"notNull": true
22+
},
23+
"email": {
24+
"name": "email",
25+
"type": "text",
26+
"primaryKey": false,
27+
"notNull": false
28+
},
29+
"image": {
30+
"name": "image",
31+
"type": "text",
32+
"primaryKey": false,
33+
"notNull": false
34+
}
35+
},
36+
"indexes": {},
37+
"foreignKeys": {},
38+
"compositePrimaryKeys": {},
39+
"uniqueConstraints": {
40+
"pilcrowstacks_user_email_unique": {
41+
"columns": [
42+
"email"
43+
],
44+
"nullsNotDistinct": false,
45+
"name": "pilcrowstacks_user_email_unique"
46+
}
47+
},
48+
"checkConstraints": {}
49+
},
50+
"public.pilcrowstacks_docs": {
51+
"name": "pilcrowstacks_docs",
52+
"schema": "",
53+
"columns": {
54+
"id": {
55+
"name": "id",
56+
"type": "text",
57+
"primaryKey": true,
58+
"notNull": true
59+
},
60+
"title": {
61+
"name": "title",
62+
"type": "text",
63+
"primaryKey": false,
64+
"notNull": false
65+
},
66+
"emoji": {
67+
"name": "emoji",
68+
"type": "text",
69+
"primaryKey": false,
70+
"notNull": false
71+
},
72+
"content": {
73+
"name": "content",
74+
"type": "jsonb",
75+
"primaryKey": false,
76+
"notNull": false
77+
},
78+
"last_edited": {
79+
"name": "last_edited",
80+
"type": "timestamp",
81+
"primaryKey": false,
82+
"notNull": true,
83+
"default": "now()"
84+
},
85+
"user_id": {
86+
"name": "user_id",
87+
"type": "text",
88+
"primaryKey": false,
89+
"notNull": false
90+
}
91+
},
92+
"indexes": {},
93+
"foreignKeys": {
94+
"posts_user_id_fkey": {
95+
"name": "posts_user_id_fkey",
96+
"tableFrom": "pilcrowstacks_docs",
97+
"tableTo": "pilcrowstacks_user",
98+
"schemaTo": "public",
99+
"columnsFrom": [
100+
"user_id"
101+
],
102+
"columnsTo": [
103+
"id"
104+
],
105+
"onDelete": "cascade",
106+
"onUpdate": "cascade"
107+
}
108+
},
109+
"compositePrimaryKeys": {},
110+
"uniqueConstraints": {},
111+
"checkConstraints": {}
112+
},
113+
"public.pilcrowstacks_docs_in_view": {
114+
"name": "pilcrowstacks_docs_in_view",
115+
"schema": "",
116+
"columns": {
117+
"id": {
118+
"name": "id",
119+
"type": "text",
120+
"primaryKey": true,
121+
"notNull": true
122+
},
123+
"user_id": {
124+
"name": "user_id",
125+
"type": "text",
126+
"primaryKey": false,
127+
"notNull": true
128+
},
129+
"doc_ids": {
130+
"name": "doc_ids",
131+
"type": "jsonb",
132+
"primaryKey": false,
133+
"notNull": true
134+
},
135+
"cursor": {
136+
"name": "cursor",
137+
"type": "text",
138+
"primaryKey": false,
139+
"notNull": true,
140+
"default": "'0'"
141+
},
142+
"homepage": {
143+
"name": "homepage",
144+
"type": "text",
145+
"primaryKey": false,
146+
"notNull": false
147+
},
148+
"last_updated": {
149+
"name": "last_updated",
150+
"type": "timestamp",
151+
"primaryKey": false,
152+
"notNull": true,
153+
"default": "now()"
154+
}
155+
},
156+
"indexes": {},
157+
"foreignKeys": {
158+
"pilcrowstacks_docs_in_view_user_id_pilcrowstacks_user_id_fk": {
159+
"name": "pilcrowstacks_docs_in_view_user_id_pilcrowstacks_user_id_fk",
160+
"tableFrom": "pilcrowstacks_docs_in_view",
161+
"tableTo": "pilcrowstacks_user",
162+
"schemaTo": "public",
163+
"columnsFrom": [
164+
"user_id"
165+
],
166+
"columnsTo": [
167+
"id"
168+
],
169+
"onDelete": "cascade",
170+
"onUpdate": "no action"
171+
},
172+
"pilcrowstacks_docs_in_view_homepage_pilcrowstacks_docs_id_fk": {
173+
"name": "pilcrowstacks_docs_in_view_homepage_pilcrowstacks_docs_id_fk",
174+
"tableFrom": "pilcrowstacks_docs_in_view",
175+
"tableTo": "pilcrowstacks_docs",
176+
"schemaTo": "public",
177+
"columnsFrom": [
178+
"homepage"
179+
],
180+
"columnsTo": [
181+
"id"
182+
],
183+
"onDelete": "cascade",
184+
"onUpdate": "no action"
185+
}
186+
},
187+
"compositePrimaryKeys": {},
188+
"uniqueConstraints": {},
189+
"checkConstraints": {}
190+
},
191+
"public.pilcrowstacks_backlinks": {
192+
"name": "pilcrowstacks_backlinks",
193+
"schema": "",
194+
"columns": {
195+
"user_id": {
196+
"name": "user_id",
197+
"type": "text",
198+
"primaryKey": false,
199+
"notNull": true
200+
},
201+
"source_id": {
202+
"name": "source_id",
203+
"type": "text",
204+
"primaryKey": false,
205+
"notNull": true
206+
},
207+
"target_id": {
208+
"name": "target_id",
209+
"type": "text",
210+
"primaryKey": false,
211+
"notNull": true
212+
}
213+
},
214+
"indexes": {},
215+
"foreignKeys": {
216+
"pilcrowstacks_backlinks_user_id_pilcrowstacks_user_id_fk": {
217+
"name": "pilcrowstacks_backlinks_user_id_pilcrowstacks_user_id_fk",
218+
"tableFrom": "pilcrowstacks_backlinks",
219+
"tableTo": "pilcrowstacks_user",
220+
"schemaTo": "public",
221+
"columnsFrom": [
222+
"user_id"
223+
],
224+
"columnsTo": [
225+
"id"
226+
],
227+
"onDelete": "cascade",
228+
"onUpdate": "no action"
229+
},
230+
"pilcrowstacks_backlinks_source_id_pilcrowstacks_docs_id_fk": {
231+
"name": "pilcrowstacks_backlinks_source_id_pilcrowstacks_docs_id_fk",
232+
"tableFrom": "pilcrowstacks_backlinks",
233+
"tableTo": "pilcrowstacks_docs",
234+
"schemaTo": "public",
235+
"columnsFrom": [
236+
"source_id"
237+
],
238+
"columnsTo": [
239+
"id"
240+
],
241+
"onDelete": "cascade",
242+
"onUpdate": "no action"
243+
},
244+
"pilcrowstacks_backlinks_target_id_pilcrowstacks_docs_id_fk": {
245+
"name": "pilcrowstacks_backlinks_target_id_pilcrowstacks_docs_id_fk",
246+
"tableFrom": "pilcrowstacks_backlinks",
247+
"tableTo": "pilcrowstacks_docs",
248+
"schemaTo": "public",
249+
"columnsFrom": [
250+
"target_id"
251+
],
252+
"columnsTo": [
253+
"id"
254+
],
255+
"onDelete": "cascade",
256+
"onUpdate": "no action"
257+
}
258+
},
259+
"compositePrimaryKeys": {
260+
"pilcrowstacks_backlinks_source_id_target_id_pk": {
261+
"name": "pilcrowstacks_backlinks_source_id_target_id_pk",
262+
"columns": [
263+
"source_id",
264+
"target_id"
265+
]
266+
}
267+
},
268+
"uniqueConstraints": {},
269+
"checkConstraints": {}
270+
}
271+
},
272+
"enums": {},
273+
"schemas": {},
274+
"sequences": {},
275+
"views": {},
276+
"_meta": {
277+
"schemas": {},
278+
"tables": {},
279+
"columns": {}
280+
},
281+
"internal": {
282+
"tables": {}
283+
}
284+
}

migrations/meta/_journal.json

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
{
22
"version": "7",
33
"dialect": "postgresql",
4-
"entries": []
4+
"entries": [
5+
{
6+
"idx": 0,
7+
"version": "7",
8+
"when": 1733831627179,
9+
"tag": "0000_curved_agent_zero",
10+
"breakpoints": true
11+
}
12+
]
513
}

0 commit comments

Comments
 (0)