@horizonwing/engine 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -2
- package/drizzle/pg/schema.ts +100 -0
- package/drizzle/postgres/0000_smooth_princess_powerful.sql +34 -0
- package/drizzle/postgres/0001_colossal_morbius.sql +50 -0
- package/drizzle/postgres/README.md +23 -0
- package/drizzle/postgres/meta/0000_snapshot.json +244 -0
- package/drizzle/postgres/meta/0001_snapshot.json +545 -0
- package/drizzle/postgres/meta/_journal.json +20 -0
- package/drizzle/schema.ts +128 -0
- package/drizzle/sqlite/0000_cooing_jackpot.sql +34 -0
- package/drizzle/sqlite/0001_living_ben_urich.sql +49 -0
- package/drizzle/sqlite/meta/0000_snapshot.json +231 -0
- package/drizzle/sqlite/meta/0001_snapshot.json +554 -0
- package/drizzle/sqlite/meta/_journal.json +20 -0
- package/package.json +79 -4
- package/src/account-pages.tsx +151 -0
- package/src/auth.tsx +264 -0
- package/src/cache.ts +199 -0
- package/src/content.ts +448 -0
- package/src/db.ts +107 -0
- package/src/feeds.ts +376 -0
- package/src/guard.ts +126 -0
- package/src/html.ts +20 -0
- package/src/i18n.ts +304 -0
- package/src/index.ts +27 -0
- package/src/md.ts +278 -0
- package/src/media.ts +70 -0
- package/src/password.ts +59 -0
- package/src/platform.node.ts +75 -0
- package/src/platform.postgres.ts +61 -0
- package/src/platform.shared.ts +114 -0
- package/src/platform.ts +24 -0
- package/src/platform.workers.ts +94 -0
- package/src/ratelimit.ts +144 -0
- package/src/section.ts +123 -0
- package/src/sections/blog/index.tsx +92 -0
- package/src/sections/blog/schema.ts +12 -0
- package/src/sections/blog/views/pages.tsx +166 -0
- package/src/sections/docs/index.tsx +66 -0
- package/src/sections/docs/schema.ts +16 -0
- package/src/sections/docs/views/pages.tsx +180 -0
- package/src/sections/landing/index.tsx +41 -0
- package/src/sections/landing/views/pages.tsx +217 -0
- package/src/seo.ts +193 -0
- package/src/server.ts +122 -0
- package/src/services/content.ts +342 -0
- package/src/turnstile.ts +62 -0
- package/src/types.ts +192 -0
- package/src/views/error.tsx +35 -0
- package/src/views/index.tsx +12 -0
- package/src/views/layout.tsx +88 -0
- package/themes/warm/tokens.css +119 -0
|
@@ -0,0 +1,545 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "96fd0946-d2f3-4817-afb8-5906ad896503",
|
|
3
|
+
"prevId": "d22a4cc1-e406-4d70-a91b-3cf77ea431fc",
|
|
4
|
+
"version": "7",
|
|
5
|
+
"dialect": "postgresql",
|
|
6
|
+
"tables": {
|
|
7
|
+
"public.account": {
|
|
8
|
+
"name": "account",
|
|
9
|
+
"schema": "",
|
|
10
|
+
"columns": {
|
|
11
|
+
"id": {
|
|
12
|
+
"name": "id",
|
|
13
|
+
"type": "text",
|
|
14
|
+
"primaryKey": true,
|
|
15
|
+
"notNull": true
|
|
16
|
+
},
|
|
17
|
+
"account_id": {
|
|
18
|
+
"name": "account_id",
|
|
19
|
+
"type": "text",
|
|
20
|
+
"primaryKey": false,
|
|
21
|
+
"notNull": true
|
|
22
|
+
},
|
|
23
|
+
"provider_id": {
|
|
24
|
+
"name": "provider_id",
|
|
25
|
+
"type": "text",
|
|
26
|
+
"primaryKey": false,
|
|
27
|
+
"notNull": true
|
|
28
|
+
},
|
|
29
|
+
"user_id": {
|
|
30
|
+
"name": "user_id",
|
|
31
|
+
"type": "text",
|
|
32
|
+
"primaryKey": false,
|
|
33
|
+
"notNull": true
|
|
34
|
+
},
|
|
35
|
+
"access_token": {
|
|
36
|
+
"name": "access_token",
|
|
37
|
+
"type": "text",
|
|
38
|
+
"primaryKey": false,
|
|
39
|
+
"notNull": false
|
|
40
|
+
},
|
|
41
|
+
"refresh_token": {
|
|
42
|
+
"name": "refresh_token",
|
|
43
|
+
"type": "text",
|
|
44
|
+
"primaryKey": false,
|
|
45
|
+
"notNull": false
|
|
46
|
+
},
|
|
47
|
+
"id_token": {
|
|
48
|
+
"name": "id_token",
|
|
49
|
+
"type": "text",
|
|
50
|
+
"primaryKey": false,
|
|
51
|
+
"notNull": false
|
|
52
|
+
},
|
|
53
|
+
"access_token_expires_at": {
|
|
54
|
+
"name": "access_token_expires_at",
|
|
55
|
+
"type": "timestamp with time zone",
|
|
56
|
+
"primaryKey": false,
|
|
57
|
+
"notNull": false
|
|
58
|
+
},
|
|
59
|
+
"refresh_token_expires_at": {
|
|
60
|
+
"name": "refresh_token_expires_at",
|
|
61
|
+
"type": "timestamp with time zone",
|
|
62
|
+
"primaryKey": false,
|
|
63
|
+
"notNull": false
|
|
64
|
+
},
|
|
65
|
+
"scope": {
|
|
66
|
+
"name": "scope",
|
|
67
|
+
"type": "text",
|
|
68
|
+
"primaryKey": false,
|
|
69
|
+
"notNull": false
|
|
70
|
+
},
|
|
71
|
+
"password": {
|
|
72
|
+
"name": "password",
|
|
73
|
+
"type": "text",
|
|
74
|
+
"primaryKey": false,
|
|
75
|
+
"notNull": false
|
|
76
|
+
},
|
|
77
|
+
"created_at": {
|
|
78
|
+
"name": "created_at",
|
|
79
|
+
"type": "timestamp with time zone",
|
|
80
|
+
"primaryKey": false,
|
|
81
|
+
"notNull": true
|
|
82
|
+
},
|
|
83
|
+
"updated_at": {
|
|
84
|
+
"name": "updated_at",
|
|
85
|
+
"type": "timestamp with time zone",
|
|
86
|
+
"primaryKey": false,
|
|
87
|
+
"notNull": true
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
"indexes": {},
|
|
91
|
+
"foreignKeys": {
|
|
92
|
+
"account_user_id_user_id_fk": {
|
|
93
|
+
"name": "account_user_id_user_id_fk",
|
|
94
|
+
"tableFrom": "account",
|
|
95
|
+
"tableTo": "user",
|
|
96
|
+
"columnsFrom": [
|
|
97
|
+
"user_id"
|
|
98
|
+
],
|
|
99
|
+
"columnsTo": [
|
|
100
|
+
"id"
|
|
101
|
+
],
|
|
102
|
+
"onDelete": "cascade",
|
|
103
|
+
"onUpdate": "no action"
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
"compositePrimaryKeys": {},
|
|
107
|
+
"uniqueConstraints": {},
|
|
108
|
+
"policies": {},
|
|
109
|
+
"checkConstraints": {},
|
|
110
|
+
"isRLSEnabled": false
|
|
111
|
+
},
|
|
112
|
+
"public.content": {
|
|
113
|
+
"name": "content",
|
|
114
|
+
"schema": "",
|
|
115
|
+
"columns": {
|
|
116
|
+
"id": {
|
|
117
|
+
"name": "id",
|
|
118
|
+
"type": "serial",
|
|
119
|
+
"primaryKey": true,
|
|
120
|
+
"notNull": true
|
|
121
|
+
},
|
|
122
|
+
"section": {
|
|
123
|
+
"name": "section",
|
|
124
|
+
"type": "text",
|
|
125
|
+
"primaryKey": false,
|
|
126
|
+
"notNull": true
|
|
127
|
+
},
|
|
128
|
+
"slug": {
|
|
129
|
+
"name": "slug",
|
|
130
|
+
"type": "text",
|
|
131
|
+
"primaryKey": false,
|
|
132
|
+
"notNull": true
|
|
133
|
+
},
|
|
134
|
+
"locale": {
|
|
135
|
+
"name": "locale",
|
|
136
|
+
"type": "text",
|
|
137
|
+
"primaryKey": false,
|
|
138
|
+
"notNull": true,
|
|
139
|
+
"default": "'zh-CN'"
|
|
140
|
+
},
|
|
141
|
+
"title": {
|
|
142
|
+
"name": "title",
|
|
143
|
+
"type": "text",
|
|
144
|
+
"primaryKey": false,
|
|
145
|
+
"notNull": true
|
|
146
|
+
},
|
|
147
|
+
"description": {
|
|
148
|
+
"name": "description",
|
|
149
|
+
"type": "text",
|
|
150
|
+
"primaryKey": false,
|
|
151
|
+
"notNull": true
|
|
152
|
+
},
|
|
153
|
+
"published_at": {
|
|
154
|
+
"name": "published_at",
|
|
155
|
+
"type": "timestamp with time zone",
|
|
156
|
+
"primaryKey": false,
|
|
157
|
+
"notNull": true
|
|
158
|
+
},
|
|
159
|
+
"updated_at": {
|
|
160
|
+
"name": "updated_at",
|
|
161
|
+
"type": "timestamp with time zone",
|
|
162
|
+
"primaryKey": false,
|
|
163
|
+
"notNull": true
|
|
164
|
+
},
|
|
165
|
+
"tags": {
|
|
166
|
+
"name": "tags",
|
|
167
|
+
"type": "text",
|
|
168
|
+
"primaryKey": false,
|
|
169
|
+
"notNull": true,
|
|
170
|
+
"default": "'[]'"
|
|
171
|
+
},
|
|
172
|
+
"meta": {
|
|
173
|
+
"name": "meta",
|
|
174
|
+
"type": "text",
|
|
175
|
+
"primaryKey": false,
|
|
176
|
+
"notNull": true,
|
|
177
|
+
"default": "'{}'"
|
|
178
|
+
},
|
|
179
|
+
"body_md": {
|
|
180
|
+
"name": "body_md",
|
|
181
|
+
"type": "text",
|
|
182
|
+
"primaryKey": false,
|
|
183
|
+
"notNull": true
|
|
184
|
+
},
|
|
185
|
+
"body_html": {
|
|
186
|
+
"name": "body_html",
|
|
187
|
+
"type": "text",
|
|
188
|
+
"primaryKey": false,
|
|
189
|
+
"notNull": true
|
|
190
|
+
},
|
|
191
|
+
"renderer_version": {
|
|
192
|
+
"name": "renderer_version",
|
|
193
|
+
"type": "text",
|
|
194
|
+
"primaryKey": false,
|
|
195
|
+
"notNull": true
|
|
196
|
+
},
|
|
197
|
+
"checksum": {
|
|
198
|
+
"name": "checksum",
|
|
199
|
+
"type": "text",
|
|
200
|
+
"primaryKey": false,
|
|
201
|
+
"notNull": true
|
|
202
|
+
},
|
|
203
|
+
"draft": {
|
|
204
|
+
"name": "draft",
|
|
205
|
+
"type": "boolean",
|
|
206
|
+
"primaryKey": false,
|
|
207
|
+
"notNull": true,
|
|
208
|
+
"default": false
|
|
209
|
+
},
|
|
210
|
+
"author": {
|
|
211
|
+
"name": "author",
|
|
212
|
+
"type": "text",
|
|
213
|
+
"primaryKey": false,
|
|
214
|
+
"notNull": false
|
|
215
|
+
}
|
|
216
|
+
},
|
|
217
|
+
"indexes": {
|
|
218
|
+
"content_section_locale_slug_uq": {
|
|
219
|
+
"name": "content_section_locale_slug_uq",
|
|
220
|
+
"columns": [
|
|
221
|
+
{
|
|
222
|
+
"expression": "section",
|
|
223
|
+
"isExpression": false,
|
|
224
|
+
"asc": true,
|
|
225
|
+
"nulls": "last"
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
"expression": "locale",
|
|
229
|
+
"isExpression": false,
|
|
230
|
+
"asc": true,
|
|
231
|
+
"nulls": "last"
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
"expression": "slug",
|
|
235
|
+
"isExpression": false,
|
|
236
|
+
"asc": true,
|
|
237
|
+
"nulls": "last"
|
|
238
|
+
}
|
|
239
|
+
],
|
|
240
|
+
"isUnique": true,
|
|
241
|
+
"concurrently": false,
|
|
242
|
+
"method": "btree",
|
|
243
|
+
"with": {}
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
"foreignKeys": {},
|
|
247
|
+
"compositePrimaryKeys": {},
|
|
248
|
+
"uniqueConstraints": {},
|
|
249
|
+
"policies": {},
|
|
250
|
+
"checkConstraints": {},
|
|
251
|
+
"isRLSEnabled": false
|
|
252
|
+
},
|
|
253
|
+
"public.kv": {
|
|
254
|
+
"name": "kv",
|
|
255
|
+
"schema": "",
|
|
256
|
+
"columns": {
|
|
257
|
+
"key": {
|
|
258
|
+
"name": "key",
|
|
259
|
+
"type": "text",
|
|
260
|
+
"primaryKey": true,
|
|
261
|
+
"notNull": true
|
|
262
|
+
},
|
|
263
|
+
"value": {
|
|
264
|
+
"name": "value",
|
|
265
|
+
"type": "text",
|
|
266
|
+
"primaryKey": false,
|
|
267
|
+
"notNull": true
|
|
268
|
+
},
|
|
269
|
+
"expires_at": {
|
|
270
|
+
"name": "expires_at",
|
|
271
|
+
"type": "timestamp with time zone",
|
|
272
|
+
"primaryKey": false,
|
|
273
|
+
"notNull": false
|
|
274
|
+
}
|
|
275
|
+
},
|
|
276
|
+
"indexes": {},
|
|
277
|
+
"foreignKeys": {},
|
|
278
|
+
"compositePrimaryKeys": {},
|
|
279
|
+
"uniqueConstraints": {},
|
|
280
|
+
"policies": {},
|
|
281
|
+
"checkConstraints": {},
|
|
282
|
+
"isRLSEnabled": false
|
|
283
|
+
},
|
|
284
|
+
"public.redirects": {
|
|
285
|
+
"name": "redirects",
|
|
286
|
+
"schema": "",
|
|
287
|
+
"columns": {
|
|
288
|
+
"id": {
|
|
289
|
+
"name": "id",
|
|
290
|
+
"type": "serial",
|
|
291
|
+
"primaryKey": true,
|
|
292
|
+
"notNull": true
|
|
293
|
+
},
|
|
294
|
+
"from_path": {
|
|
295
|
+
"name": "from_path",
|
|
296
|
+
"type": "text",
|
|
297
|
+
"primaryKey": false,
|
|
298
|
+
"notNull": true
|
|
299
|
+
},
|
|
300
|
+
"to_path": {
|
|
301
|
+
"name": "to_path",
|
|
302
|
+
"type": "text",
|
|
303
|
+
"primaryKey": false,
|
|
304
|
+
"notNull": true
|
|
305
|
+
},
|
|
306
|
+
"created_at": {
|
|
307
|
+
"name": "created_at",
|
|
308
|
+
"type": "timestamp with time zone",
|
|
309
|
+
"primaryKey": false,
|
|
310
|
+
"notNull": true
|
|
311
|
+
}
|
|
312
|
+
},
|
|
313
|
+
"indexes": {
|
|
314
|
+
"redirects_from_path_uq": {
|
|
315
|
+
"name": "redirects_from_path_uq",
|
|
316
|
+
"columns": [
|
|
317
|
+
{
|
|
318
|
+
"expression": "from_path",
|
|
319
|
+
"isExpression": false,
|
|
320
|
+
"asc": true,
|
|
321
|
+
"nulls": "last"
|
|
322
|
+
}
|
|
323
|
+
],
|
|
324
|
+
"isUnique": true,
|
|
325
|
+
"concurrently": false,
|
|
326
|
+
"method": "btree",
|
|
327
|
+
"with": {}
|
|
328
|
+
}
|
|
329
|
+
},
|
|
330
|
+
"foreignKeys": {},
|
|
331
|
+
"compositePrimaryKeys": {},
|
|
332
|
+
"uniqueConstraints": {},
|
|
333
|
+
"policies": {},
|
|
334
|
+
"checkConstraints": {},
|
|
335
|
+
"isRLSEnabled": false
|
|
336
|
+
},
|
|
337
|
+
"public.session": {
|
|
338
|
+
"name": "session",
|
|
339
|
+
"schema": "",
|
|
340
|
+
"columns": {
|
|
341
|
+
"id": {
|
|
342
|
+
"name": "id",
|
|
343
|
+
"type": "text",
|
|
344
|
+
"primaryKey": true,
|
|
345
|
+
"notNull": true
|
|
346
|
+
},
|
|
347
|
+
"expires_at": {
|
|
348
|
+
"name": "expires_at",
|
|
349
|
+
"type": "timestamp with time zone",
|
|
350
|
+
"primaryKey": false,
|
|
351
|
+
"notNull": true
|
|
352
|
+
},
|
|
353
|
+
"token": {
|
|
354
|
+
"name": "token",
|
|
355
|
+
"type": "text",
|
|
356
|
+
"primaryKey": false,
|
|
357
|
+
"notNull": true
|
|
358
|
+
},
|
|
359
|
+
"created_at": {
|
|
360
|
+
"name": "created_at",
|
|
361
|
+
"type": "timestamp with time zone",
|
|
362
|
+
"primaryKey": false,
|
|
363
|
+
"notNull": true
|
|
364
|
+
},
|
|
365
|
+
"updated_at": {
|
|
366
|
+
"name": "updated_at",
|
|
367
|
+
"type": "timestamp with time zone",
|
|
368
|
+
"primaryKey": false,
|
|
369
|
+
"notNull": true
|
|
370
|
+
},
|
|
371
|
+
"ip_address": {
|
|
372
|
+
"name": "ip_address",
|
|
373
|
+
"type": "text",
|
|
374
|
+
"primaryKey": false,
|
|
375
|
+
"notNull": false
|
|
376
|
+
},
|
|
377
|
+
"user_agent": {
|
|
378
|
+
"name": "user_agent",
|
|
379
|
+
"type": "text",
|
|
380
|
+
"primaryKey": false,
|
|
381
|
+
"notNull": false
|
|
382
|
+
},
|
|
383
|
+
"user_id": {
|
|
384
|
+
"name": "user_id",
|
|
385
|
+
"type": "text",
|
|
386
|
+
"primaryKey": false,
|
|
387
|
+
"notNull": true
|
|
388
|
+
}
|
|
389
|
+
},
|
|
390
|
+
"indexes": {},
|
|
391
|
+
"foreignKeys": {
|
|
392
|
+
"session_user_id_user_id_fk": {
|
|
393
|
+
"name": "session_user_id_user_id_fk",
|
|
394
|
+
"tableFrom": "session",
|
|
395
|
+
"tableTo": "user",
|
|
396
|
+
"columnsFrom": [
|
|
397
|
+
"user_id"
|
|
398
|
+
],
|
|
399
|
+
"columnsTo": [
|
|
400
|
+
"id"
|
|
401
|
+
],
|
|
402
|
+
"onDelete": "cascade",
|
|
403
|
+
"onUpdate": "no action"
|
|
404
|
+
}
|
|
405
|
+
},
|
|
406
|
+
"compositePrimaryKeys": {},
|
|
407
|
+
"uniqueConstraints": {
|
|
408
|
+
"session_token_unique": {
|
|
409
|
+
"name": "session_token_unique",
|
|
410
|
+
"nullsNotDistinct": false,
|
|
411
|
+
"columns": [
|
|
412
|
+
"token"
|
|
413
|
+
]
|
|
414
|
+
}
|
|
415
|
+
},
|
|
416
|
+
"policies": {},
|
|
417
|
+
"checkConstraints": {},
|
|
418
|
+
"isRLSEnabled": false
|
|
419
|
+
},
|
|
420
|
+
"public.user": {
|
|
421
|
+
"name": "user",
|
|
422
|
+
"schema": "",
|
|
423
|
+
"columns": {
|
|
424
|
+
"id": {
|
|
425
|
+
"name": "id",
|
|
426
|
+
"type": "text",
|
|
427
|
+
"primaryKey": true,
|
|
428
|
+
"notNull": true
|
|
429
|
+
},
|
|
430
|
+
"name": {
|
|
431
|
+
"name": "name",
|
|
432
|
+
"type": "text",
|
|
433
|
+
"primaryKey": false,
|
|
434
|
+
"notNull": true
|
|
435
|
+
},
|
|
436
|
+
"email": {
|
|
437
|
+
"name": "email",
|
|
438
|
+
"type": "text",
|
|
439
|
+
"primaryKey": false,
|
|
440
|
+
"notNull": true
|
|
441
|
+
},
|
|
442
|
+
"email_verified": {
|
|
443
|
+
"name": "email_verified",
|
|
444
|
+
"type": "boolean",
|
|
445
|
+
"primaryKey": false,
|
|
446
|
+
"notNull": true,
|
|
447
|
+
"default": false
|
|
448
|
+
},
|
|
449
|
+
"image": {
|
|
450
|
+
"name": "image",
|
|
451
|
+
"type": "text",
|
|
452
|
+
"primaryKey": false,
|
|
453
|
+
"notNull": false
|
|
454
|
+
},
|
|
455
|
+
"created_at": {
|
|
456
|
+
"name": "created_at",
|
|
457
|
+
"type": "timestamp with time zone",
|
|
458
|
+
"primaryKey": false,
|
|
459
|
+
"notNull": true
|
|
460
|
+
},
|
|
461
|
+
"updated_at": {
|
|
462
|
+
"name": "updated_at",
|
|
463
|
+
"type": "timestamp with time zone",
|
|
464
|
+
"primaryKey": false,
|
|
465
|
+
"notNull": true
|
|
466
|
+
}
|
|
467
|
+
},
|
|
468
|
+
"indexes": {},
|
|
469
|
+
"foreignKeys": {},
|
|
470
|
+
"compositePrimaryKeys": {},
|
|
471
|
+
"uniqueConstraints": {
|
|
472
|
+
"user_email_unique": {
|
|
473
|
+
"name": "user_email_unique",
|
|
474
|
+
"nullsNotDistinct": false,
|
|
475
|
+
"columns": [
|
|
476
|
+
"email"
|
|
477
|
+
]
|
|
478
|
+
}
|
|
479
|
+
},
|
|
480
|
+
"policies": {},
|
|
481
|
+
"checkConstraints": {},
|
|
482
|
+
"isRLSEnabled": false
|
|
483
|
+
},
|
|
484
|
+
"public.verification": {
|
|
485
|
+
"name": "verification",
|
|
486
|
+
"schema": "",
|
|
487
|
+
"columns": {
|
|
488
|
+
"id": {
|
|
489
|
+
"name": "id",
|
|
490
|
+
"type": "text",
|
|
491
|
+
"primaryKey": true,
|
|
492
|
+
"notNull": true
|
|
493
|
+
},
|
|
494
|
+
"identifier": {
|
|
495
|
+
"name": "identifier",
|
|
496
|
+
"type": "text",
|
|
497
|
+
"primaryKey": false,
|
|
498
|
+
"notNull": true
|
|
499
|
+
},
|
|
500
|
+
"value": {
|
|
501
|
+
"name": "value",
|
|
502
|
+
"type": "text",
|
|
503
|
+
"primaryKey": false,
|
|
504
|
+
"notNull": true
|
|
505
|
+
},
|
|
506
|
+
"expires_at": {
|
|
507
|
+
"name": "expires_at",
|
|
508
|
+
"type": "timestamp with time zone",
|
|
509
|
+
"primaryKey": false,
|
|
510
|
+
"notNull": true
|
|
511
|
+
},
|
|
512
|
+
"created_at": {
|
|
513
|
+
"name": "created_at",
|
|
514
|
+
"type": "timestamp with time zone",
|
|
515
|
+
"primaryKey": false,
|
|
516
|
+
"notNull": false
|
|
517
|
+
},
|
|
518
|
+
"updated_at": {
|
|
519
|
+
"name": "updated_at",
|
|
520
|
+
"type": "timestamp with time zone",
|
|
521
|
+
"primaryKey": false,
|
|
522
|
+
"notNull": false
|
|
523
|
+
}
|
|
524
|
+
},
|
|
525
|
+
"indexes": {},
|
|
526
|
+
"foreignKeys": {},
|
|
527
|
+
"compositePrimaryKeys": {},
|
|
528
|
+
"uniqueConstraints": {},
|
|
529
|
+
"policies": {},
|
|
530
|
+
"checkConstraints": {},
|
|
531
|
+
"isRLSEnabled": false
|
|
532
|
+
}
|
|
533
|
+
},
|
|
534
|
+
"enums": {},
|
|
535
|
+
"schemas": {},
|
|
536
|
+
"sequences": {},
|
|
537
|
+
"roles": {},
|
|
538
|
+
"policies": {},
|
|
539
|
+
"views": {},
|
|
540
|
+
"_meta": {
|
|
541
|
+
"columns": {},
|
|
542
|
+
"schemas": {},
|
|
543
|
+
"tables": {}
|
|
544
|
+
}
|
|
545
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "7",
|
|
3
|
+
"dialect": "postgresql",
|
|
4
|
+
"entries": [
|
|
5
|
+
{
|
|
6
|
+
"idx": 0,
|
|
7
|
+
"version": "7",
|
|
8
|
+
"when": 1796527088070,
|
|
9
|
+
"tag": "0000_smooth_princess_powerful",
|
|
10
|
+
"breakpoints": true
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"idx": 1,
|
|
14
|
+
"version": "7",
|
|
15
|
+
"when": 1796530980269,
|
|
16
|
+
"tag": "0001_colossal_morbius",
|
|
17
|
+
"breakpoints": true
|
|
18
|
+
}
|
|
19
|
+
]
|
|
20
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { integer, sqliteTable, text, uniqueIndex } from 'drizzle-orm/sqlite-core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* kit 引擎数据表(总设计 §4)。SQLite 方言:D1 与 better-sqlite3 共用同一份
|
|
5
|
+
* schema 与 migration;PG 方言见 drizzle/pg/schema.ts(镜像定义)。
|
|
6
|
+
*
|
|
7
|
+
* 时间列统一 integer + mode 'timestamp_ms'(UTC epoch ms)。
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/* ------------------------------------------------------------ content */
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* 内容表:repo markdown 同步进来的一等公民集合。
|
|
14
|
+
* 写路径纪律:只允许 engine/services/content.ts 的 upsertContent(ON CONFLICT 受控路径)。
|
|
15
|
+
*/
|
|
16
|
+
export const content = sqliteTable(
|
|
17
|
+
'content',
|
|
18
|
+
{
|
|
19
|
+
id: integer('id').primaryKey({ autoIncrement: true }),
|
|
20
|
+
/** 栏目名:blog / docs(M2 起由 section 协议扩展) */
|
|
21
|
+
section: text('section').notNull(),
|
|
22
|
+
/** URL slug(docs 支持嵌套路径,posix 风格 'guide/quickstart') */
|
|
23
|
+
slug: text('slug').notNull(),
|
|
24
|
+
/** 默认 zh-CN,M3 起多值 */
|
|
25
|
+
locale: text('locale').notNull().default('zh-CN'),
|
|
26
|
+
title: text('title').notNull(),
|
|
27
|
+
description: text('description').notNull(),
|
|
28
|
+
/** frontmatter date(缺省取同步时刻) */
|
|
29
|
+
publishedAt: integer('published_at', { mode: 'timestamp_ms' }).notNull(),
|
|
30
|
+
/** frontmatter updated(缺省同 published_at) */
|
|
31
|
+
updatedAt: integer('updated_at', { mode: 'timestamp_ms' }).notNull(),
|
|
32
|
+
/** string[] JSON */
|
|
33
|
+
tags: text('tags', { mode: 'json' }).notNull().default('[]'),
|
|
34
|
+
/** frontmatter 剩余字段 JSON(基础 schema 之外的扩展位) */
|
|
35
|
+
meta: text('meta', { mode: 'json' }).notNull().default('{}'),
|
|
36
|
+
bodyMd: text('body_md').notNull(),
|
|
37
|
+
/** 同步期渲染产物(热数据零成本;读路径按 renderer_version 自愈) */
|
|
38
|
+
bodyHtml: text('body_html').notNull(),
|
|
39
|
+
rendererVersion: text('renderer_version').notNull(),
|
|
40
|
+
/** sha256(frontmatter 规范 JSON + body) —— 同步 diff 的比对依据 */
|
|
41
|
+
checksum: text('checksum').notNull(),
|
|
42
|
+
draft: integer('draft', { mode: 'boolean' }).notNull().default(false),
|
|
43
|
+
author: text('author'),
|
|
44
|
+
},
|
|
45
|
+
(t) => [uniqueIndex('content_section_locale_slug_uq').on(t.section, t.locale, t.slug)],
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
/* ------------------------------------------------------------ redirects */
|
|
49
|
+
|
|
50
|
+
/** slug 变更映射:from_path UNIQUE;命中 301 no-store(bbs t22 教训) */
|
|
51
|
+
export const redirects = sqliteTable(
|
|
52
|
+
'redirects',
|
|
53
|
+
{
|
|
54
|
+
id: integer('id').primaryKey({ autoIncrement: true }),
|
|
55
|
+
fromPath: text('from_path').notNull(),
|
|
56
|
+
toPath: text('to_path').notNull(),
|
|
57
|
+
createdAt: integer('created_at', { mode: 'timestamp_ms' }).notNull(),
|
|
58
|
+
},
|
|
59
|
+
(t) => [uniqueIndex('redirects_from_path_uq').on(t.fromPath)],
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
/* ------------------------------------------------------------ kv */
|
|
63
|
+
|
|
64
|
+
/** 引擎键值:content_version 等运行时元数据;expires_at 为 NULL 表示永不过期 */
|
|
65
|
+
export const kv = sqliteTable('kv', {
|
|
66
|
+
key: text('key').primaryKey(),
|
|
67
|
+
value: text('value').notNull(),
|
|
68
|
+
/** epoch ms;NULL 永不过期 */
|
|
69
|
+
expiresAt: integer('expires_at', { mode: 'timestamp_ms' }),
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
/* ------------------------------------------------------------ auth(M2,better-auth drizzleAdapter 官方四表) */
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* better-auth 标准四表(官方 schema 字段):user / session / account / verification。
|
|
76
|
+
* id 由 better-auth 生成(随机串),全 text 主键;时间列与引擎约定一致用
|
|
77
|
+
* integer + timestamp_ms。写路径全部经 better-auth(drizzleAdapter 内部 CRUD),
|
|
78
|
+
* 引擎代码不允许裸写这四张表(结构守卫 tests/guard-sql.spec.ts 红线)。
|
|
79
|
+
*/
|
|
80
|
+
export const user = sqliteTable('user', {
|
|
81
|
+
id: text('id').primaryKey(),
|
|
82
|
+
name: text('name').notNull(),
|
|
83
|
+
email: text('email').notNull().unique(),
|
|
84
|
+
emailVerified: integer('email_verified', { mode: 'boolean' }).notNull().default(false),
|
|
85
|
+
image: text('image'),
|
|
86
|
+
createdAt: integer('created_at', { mode: 'timestamp_ms' }).notNull(),
|
|
87
|
+
updatedAt: integer('updated_at', { mode: 'timestamp_ms' }).notNull(),
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
export const session = sqliteTable('session', {
|
|
91
|
+
id: text('id').primaryKey(),
|
|
92
|
+
expiresAt: integer('expires_at', { mode: 'timestamp_ms' }).notNull(),
|
|
93
|
+
token: text('token').notNull().unique(),
|
|
94
|
+
createdAt: integer('created_at', { mode: 'timestamp_ms' }).notNull(),
|
|
95
|
+
updatedAt: integer('updated_at', { mode: 'timestamp_ms' }).notNull(),
|
|
96
|
+
ipAddress: text('ip_address'),
|
|
97
|
+
userAgent: text('user_agent'),
|
|
98
|
+
userId: text('user_id')
|
|
99
|
+
.notNull()
|
|
100
|
+
.references(() => user.id, { onDelete: 'cascade' }),
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
export const account = sqliteTable('account', {
|
|
104
|
+
id: text('id').primaryKey(),
|
|
105
|
+
accountId: text('account_id').notNull(),
|
|
106
|
+
providerId: text('provider_id').notNull(),
|
|
107
|
+
userId: text('user_id')
|
|
108
|
+
.notNull()
|
|
109
|
+
.references(() => user.id, { onDelete: 'cascade' }),
|
|
110
|
+
accessToken: text('access_token'),
|
|
111
|
+
refreshToken: text('refresh_token'),
|
|
112
|
+
idToken: text('id_token'),
|
|
113
|
+
accessTokenExpiresAt: integer('access_token_expires_at', { mode: 'timestamp_ms' }),
|
|
114
|
+
refreshTokenExpiresAt: integer('refresh_token_expires_at', { mode: 'timestamp_ms' }),
|
|
115
|
+
scope: text('scope'),
|
|
116
|
+
password: text('password'),
|
|
117
|
+
createdAt: integer('created_at', { mode: 'timestamp_ms' }).notNull(),
|
|
118
|
+
updatedAt: integer('updated_at', { mode: 'timestamp_ms' }).notNull(),
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
export const verification = sqliteTable('verification', {
|
|
122
|
+
id: text('id').primaryKey(),
|
|
123
|
+
identifier: text('identifier').notNull(),
|
|
124
|
+
value: text('value').notNull(),
|
|
125
|
+
expiresAt: integer('expires_at', { mode: 'timestamp_ms' }).notNull(),
|
|
126
|
+
createdAt: integer('created_at', { mode: 'timestamp_ms' }),
|
|
127
|
+
updatedAt: integer('updated_at', { mode: 'timestamp_ms' }),
|
|
128
|
+
});
|