@jant/core 0.3.35 → 0.3.37

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.
Files changed (307) hide show
  1. package/bin/commands/export.js +1 -1
  2. package/bin/commands/import-site.js +529 -0
  3. package/bin/commands/reset-password.js +3 -2
  4. package/dist/client/assets/heic-to-DIRPI3VF.js +1 -0
  5. package/dist/client/assets/module-RjUF93sV.js +716 -0
  6. package/dist/client/assets/native-48B9X9Wg.js +1 -0
  7. package/dist/client/assets/url-FWFqPJPb.js +1 -0
  8. package/dist/client/client.css +1 -1
  9. package/dist/client/client.js +4564 -3013
  10. package/dist/index.js +12885 -8161
  11. package/package.json +23 -6
  12. package/src/__tests__/helpers/app.ts +10 -10
  13. package/src/__tests__/helpers/db.ts +91 -87
  14. package/src/app.tsx +157 -31
  15. package/src/auth.ts +20 -2
  16. package/src/client/archive-nav.js +187 -0
  17. package/src/client/audio-player.ts +478 -0
  18. package/src/client/audio-processor.ts +84 -0
  19. package/src/{lib → client}/avatar-upload.ts +4 -3
  20. package/src/{lib → client}/collection-form-bridge.ts +2 -2
  21. package/src/{ui → client}/components/__tests__/jant-collection-form.test.ts +26 -9
  22. package/src/client/components/__tests__/jant-compose-dialog.test.ts +1140 -0
  23. package/src/client/components/__tests__/jant-compose-editor.test.ts +504 -0
  24. package/src/{ui → client}/components/__tests__/jant-post-form.test.ts +37 -17
  25. package/src/{ui → client}/components/__tests__/jant-settings-avatar.test.ts +2 -2
  26. package/src/{ui → client}/components/__tests__/jant-settings-general.test.ts +3 -3
  27. package/src/client/components/collection-sidebar-types.ts +43 -0
  28. package/src/{ui → client}/components/collection-types.ts +3 -4
  29. package/src/client/components/compose-types.ts +174 -0
  30. package/src/client/components/jant-collection-form.ts +667 -0
  31. package/src/client/components/jant-collection-sidebar.ts +805 -0
  32. package/src/client/components/jant-compose-dialog.ts +2161 -0
  33. package/src/client/components/jant-compose-editor.ts +1813 -0
  34. package/src/client/components/jant-compose-fullscreen.ts +283 -0
  35. package/src/client/components/jant-media-lightbox.ts +259 -0
  36. package/src/{ui → client}/components/jant-nav-manager.ts +97 -298
  37. package/src/{ui → client}/components/jant-post-form.ts +141 -12
  38. package/src/client/components/jant-post-menu.ts +1019 -0
  39. package/src/{ui → client}/components/jant-settings-avatar.ts +3 -3
  40. package/src/{ui → client}/components/jant-settings-general.ts +38 -4
  41. package/src/client/components/jant-text-preview.ts +232 -0
  42. package/src/{ui → client}/components/nav-manager-types.ts +6 -18
  43. package/src/{ui → client}/components/post-form-template.ts +137 -38
  44. package/src/{ui → client}/components/post-form-types.ts +15 -4
  45. package/src/client/compose-bridge.ts +583 -0
  46. package/src/{lib → client}/image-processor.ts +26 -8
  47. package/src/client/lazy-slugify.ts +51 -0
  48. package/src/client/media-metadata.ts +247 -0
  49. package/src/client/multipart-upload.ts +160 -0
  50. package/src/{lib → client}/nav-manager-bridge.ts +1 -1
  51. package/src/{lib → client}/post-form-bridge.ts +53 -2
  52. package/src/{lib → client}/settings-bridge.ts +3 -15
  53. package/src/client/thread-context.ts +140 -0
  54. package/src/client/tiptap/bubble-menu.ts +205 -0
  55. package/src/client/tiptap/create-editor.ts +86 -0
  56. package/src/client/tiptap/exitable-marks.ts +73 -0
  57. package/src/client/tiptap/extensions.ts +65 -0
  58. package/src/client/tiptap/image-node.ts +482 -0
  59. package/src/client/tiptap/link-toolbar.ts +371 -0
  60. package/src/client/tiptap/more-break.ts +50 -0
  61. package/src/client/tiptap/paste-image.ts +129 -0
  62. package/src/client/tiptap/slash-commands.ts +438 -0
  63. package/src/{lib → client}/toast.ts +101 -3
  64. package/src/client/types/sortablejs.d.ts +44 -0
  65. package/src/client/upload-with-metadata.ts +54 -0
  66. package/src/client/video-processor.ts +207 -0
  67. package/src/client.ts +27 -17
  68. package/src/db/__tests__/migrations.test.ts +118 -0
  69. package/src/db/index.ts +52 -0
  70. package/src/db/migrations/0000_baseline.sql +269 -0
  71. package/src/db/migrations/0001_fts_setup.sql +31 -0
  72. package/src/db/migrations/meta/0000_snapshot.json +703 -119
  73. package/src/db/migrations/meta/0001_snapshot.json +1337 -0
  74. package/src/db/migrations/meta/_journal.json +4 -39
  75. package/src/db/schema.ts +409 -140
  76. package/src/i18n/__tests__/detect.test.ts +115 -0
  77. package/src/i18n/context.tsx +2 -2
  78. package/src/i18n/detect.ts +85 -1
  79. package/src/i18n/i18n.ts +1 -1
  80. package/src/i18n/index.ts +2 -1
  81. package/src/i18n/locales/en.po +783 -1087
  82. package/src/i18n/locales/en.ts +1 -1
  83. package/src/i18n/locales/zh-Hans.po +867 -812
  84. package/src/i18n/locales/zh-Hans.ts +1 -1
  85. package/src/i18n/locales/zh-Hant.po +878 -823
  86. package/src/i18n/locales/zh-Hant.ts +1 -1
  87. package/src/i18n/middleware.ts +6 -0
  88. package/src/index.ts +5 -7
  89. package/src/lib/__tests__/blurhash-placeholder.test.ts +75 -0
  90. package/src/lib/__tests__/constants.test.ts +0 -1
  91. package/src/lib/__tests__/markdown-to-tiptap.test.ts +358 -0
  92. package/src/lib/__tests__/nanoid.test.ts +26 -0
  93. package/src/lib/__tests__/resolve-config.test.ts +2 -2
  94. package/src/lib/__tests__/schemas.test.ts +186 -65
  95. package/src/lib/__tests__/slug.test.ts +126 -0
  96. package/src/lib/__tests__/sse.test.ts +6 -6
  97. package/src/lib/__tests__/summary.test.ts +264 -0
  98. package/src/lib/__tests__/theme.test.ts +1 -1
  99. package/src/lib/__tests__/timeline.test.ts +33 -30
  100. package/src/lib/__tests__/tiptap-to-markdown.test.ts +346 -0
  101. package/src/lib/__tests__/url.test.ts +2 -2
  102. package/src/lib/__tests__/view.test.ts +140 -65
  103. package/src/lib/blurhash-placeholder.ts +102 -0
  104. package/src/lib/constants.ts +3 -1
  105. package/src/lib/emoji-catalog.ts +963 -0
  106. package/src/lib/errors.ts +11 -8
  107. package/src/lib/feed.ts +77 -31
  108. package/src/lib/html.ts +2 -1
  109. package/src/lib/icon-catalog.ts +5033 -1
  110. package/src/lib/icons.ts +3 -2
  111. package/src/lib/index.ts +0 -1
  112. package/src/lib/markdown-to-tiptap.ts +286 -0
  113. package/src/lib/media-helpers.ts +22 -12
  114. package/src/lib/nanoid.ts +29 -0
  115. package/src/lib/navigation.ts +1 -1
  116. package/src/lib/render.tsx +24 -5
  117. package/src/lib/resolve-config.ts +13 -2
  118. package/src/lib/schemas.ts +226 -58
  119. package/src/lib/search-snippet.ts +34 -0
  120. package/src/lib/slug.ts +96 -0
  121. package/src/lib/sse.ts +6 -6
  122. package/src/lib/storage.ts +115 -7
  123. package/src/lib/summary.ts +158 -0
  124. package/src/lib/theme.ts +11 -8
  125. package/src/lib/timeline.ts +76 -34
  126. package/src/lib/tiptap-render.ts +191 -0
  127. package/src/lib/tiptap-to-markdown.ts +305 -0
  128. package/src/lib/upload.ts +263 -14
  129. package/src/lib/url.ts +37 -22
  130. package/src/lib/view.ts +236 -55
  131. package/src/middleware/__tests__/auth.test.ts +191 -11
  132. package/src/middleware/__tests__/onboarding.test.ts +12 -10
  133. package/src/middleware/auth.ts +63 -9
  134. package/src/middleware/error-handler.ts +3 -3
  135. package/src/middleware/onboarding.ts +1 -1
  136. package/src/middleware/secure-headers.ts +40 -0
  137. package/src/preset.css +83 -2
  138. package/src/routes/__tests__/compose.test.ts +17 -24
  139. package/src/routes/api/__tests__/collections.test.ts +109 -61
  140. package/src/routes/api/__tests__/nav-items.test.ts +46 -29
  141. package/src/routes/api/__tests__/posts.test.ts +132 -68
  142. package/src/routes/api/__tests__/search.test.ts +15 -2
  143. package/src/routes/api/__tests__/upload-multipart.test.ts +534 -0
  144. package/src/routes/api/collections.ts +57 -31
  145. package/src/routes/api/custom-urls.ts +80 -0
  146. package/src/routes/api/export.ts +31 -0
  147. package/src/routes/api/nav-items.ts +23 -19
  148. package/src/routes/api/posts.ts +81 -62
  149. package/src/routes/api/search.ts +3 -4
  150. package/src/routes/api/upload-multipart.ts +245 -0
  151. package/src/routes/api/upload.ts +92 -24
  152. package/src/routes/auth/__tests__/setup.test.ts +20 -60
  153. package/src/routes/auth/reset.tsx +5 -4
  154. package/src/routes/auth/setup.tsx +39 -31
  155. package/src/routes/auth/signin.tsx +13 -14
  156. package/src/routes/compose.tsx +27 -63
  157. package/src/routes/dash/__tests__/settings-avatar.test.ts +44 -9
  158. package/src/routes/dash/custom-urls.tsx +414 -0
  159. package/src/routes/dash/settings.tsx +475 -99
  160. package/src/routes/feed/__tests__/rss.test.ts +22 -23
  161. package/src/routes/feed/rss.ts +6 -2
  162. package/src/routes/feed/sitemap.ts +2 -12
  163. package/src/routes/pages/__tests__/collections.test.ts +5 -6
  164. package/src/routes/pages/__tests__/featured.test.ts +36 -18
  165. package/src/routes/pages/archive.tsx +177 -37
  166. package/src/routes/pages/collection.tsx +43 -14
  167. package/src/routes/pages/collections.tsx +11 -2
  168. package/src/routes/pages/featured.tsx +27 -3
  169. package/src/routes/pages/home.tsx +15 -14
  170. package/src/routes/pages/latest.tsx +1 -11
  171. package/src/routes/pages/new.tsx +39 -0
  172. package/src/routes/pages/page.tsx +95 -49
  173. package/src/routes/pages/search.tsx +1 -1
  174. package/src/services/__tests__/api-token.test.ts +135 -0
  175. package/src/services/__tests__/collection.test.ts +275 -227
  176. package/src/services/__tests__/custom-url.test.ts +213 -0
  177. package/src/services/__tests__/media.test.ts +162 -22
  178. package/src/services/__tests__/navigation.test.ts +109 -68
  179. package/src/services/__tests__/post-timeline.test.ts +205 -32
  180. package/src/services/__tests__/post.test.ts +800 -230
  181. package/src/services/__tests__/search.test.ts +67 -10
  182. package/src/services/__tests__/settings.test.ts +3 -3
  183. package/src/services/api-token.ts +166 -0
  184. package/src/services/auth.ts +17 -2
  185. package/src/services/collection.ts +397 -131
  186. package/src/services/custom-url.ts +188 -0
  187. package/src/services/export.ts +802 -0
  188. package/src/services/index.ts +26 -19
  189. package/src/services/media.ts +100 -22
  190. package/src/services/navigation.ts +158 -47
  191. package/src/services/path.ts +339 -0
  192. package/src/services/post.ts +764 -172
  193. package/src/services/search.ts +161 -74
  194. package/src/services/settings.ts +6 -2
  195. package/src/styles/components.css +293 -62
  196. package/src/styles/tokens.css +93 -5
  197. package/src/styles/ui.css +4349 -766
  198. package/src/types/bindings.ts +8 -0
  199. package/src/types/config.ts +34 -4
  200. package/src/types/constants.ts +17 -2
  201. package/src/types/entities.ts +83 -37
  202. package/src/types/operations.ts +20 -27
  203. package/src/types/props.ts +52 -17
  204. package/src/types/views.ts +48 -24
  205. package/src/ui/color-themes.ts +133 -23
  206. package/src/ui/compose/ComposeDialog.tsx +255 -16
  207. package/src/ui/compose/ComposePrompt.tsx +1 -1
  208. package/src/ui/dash/CrudPageHeader.tsx +1 -1
  209. package/src/ui/dash/ListItemRow.tsx +1 -1
  210. package/src/ui/dash/StatusBadge.tsx +12 -2
  211. package/src/ui/dash/appearance/AdvancedContent.tsx +71 -59
  212. package/src/ui/dash/appearance/ColorThemeContent.tsx +48 -33
  213. package/src/ui/dash/appearance/FontThemeContent.tsx +65 -73
  214. package/src/ui/dash/appearance/NavigationContent.tsx +106 -135
  215. package/src/ui/dash/index.ts +0 -3
  216. package/src/ui/dash/settings/AccountContent.tsx +87 -146
  217. package/src/ui/dash/settings/AccountMenuContent.tsx +147 -0
  218. package/src/ui/dash/settings/ApiTokensContent.tsx +232 -0
  219. package/src/ui/dash/settings/AvatarContent.tsx +78 -0
  220. package/src/ui/dash/settings/GeneralContent.tsx +3 -62
  221. package/src/ui/dash/settings/SessionsContent.tsx +159 -0
  222. package/src/ui/dash/settings/SettingsRootContent.tsx +266 -0
  223. package/src/ui/feed/LinkCard.tsx +89 -40
  224. package/src/ui/feed/NoteCard.tsx +39 -25
  225. package/src/ui/feed/PostStatusBadges.tsx +67 -0
  226. package/src/ui/feed/QuoteCard.tsx +38 -23
  227. package/src/ui/feed/ThreadPreview.tsx +90 -26
  228. package/src/ui/feed/TimelineFeed.tsx +3 -2
  229. package/src/ui/feed/TimelineItem.tsx +15 -6
  230. package/src/ui/feed/__tests__/thread-preview.test.ts +107 -0
  231. package/src/ui/feed/thread-preview-state.ts +61 -0
  232. package/src/ui/font-themes.ts +2 -2
  233. package/src/ui/layouts/BaseLayout.tsx +2 -2
  234. package/src/ui/layouts/SiteLayout.tsx +116 -103
  235. package/src/ui/pages/ArchivePage.tsx +923 -95
  236. package/src/ui/pages/CollectionPage.tsx +6 -35
  237. package/src/ui/pages/CollectionsPage.tsx +2 -1
  238. package/src/ui/pages/ComposePage.tsx +54 -0
  239. package/src/ui/pages/FeaturedPage.tsx +2 -1
  240. package/src/ui/pages/HomePage.tsx +1 -1
  241. package/src/ui/pages/PostPage.tsx +30 -45
  242. package/src/ui/pages/SearchPage.tsx +182 -38
  243. package/src/ui/shared/AdminBreadcrumb.tsx +29 -0
  244. package/src/ui/shared/CollectionsSidebar.tsx +239 -4
  245. package/src/ui/shared/MediaGallery.tsx +475 -41
  246. package/src/ui/shared/PostFooter.tsx +204 -0
  247. package/src/ui/shared/StarRating.tsx +27 -0
  248. package/src/ui/shared/__tests__/format-chars.test.ts +35 -0
  249. package/src/ui/shared/index.ts +0 -1
  250. package/src/db/migrations/0000_square_wallflower.sql +0 -118
  251. package/src/db/migrations/0001_add_search_fts.sql +0 -34
  252. package/src/db/migrations/0002_add_media_attachments.sql +0 -3
  253. package/src/db/migrations/0003_add_navigation_links.sql +0 -8
  254. package/src/db/migrations/0004_add_storage_provider.sql +0 -3
  255. package/src/db/migrations/0005_v2_schema_migration.sql +0 -268
  256. package/src/db/migrations/0006_rename_slug_to_path.sql +0 -5
  257. package/src/db/migrations/0007_post_collections_m2m.sql +0 -94
  258. package/src/db/migrations/0008_add_collection_dividers.sql +0 -8
  259. package/src/db/migrations/0009_drop_collection_show_divider.sql +0 -2
  260. package/src/db/migrations/0010_add_performance_indexes.sql +0 -16
  261. package/src/db/migrations/0011_add_path_registry.sql +0 -23
  262. package/src/db/migrations/meta/0003_snapshot.json +0 -821
  263. package/src/lib/__tests__/sqid.test.ts +0 -65
  264. package/src/lib/collections-reorder.ts +0 -28
  265. package/src/lib/compose-bridge.ts +0 -280
  266. package/src/lib/media-upload.ts +0 -148
  267. package/src/lib/sqid.ts +0 -79
  268. package/src/routes/api/__tests__/pages.test.ts +0 -218
  269. package/src/routes/api/pages.ts +0 -73
  270. package/src/routes/dash/__tests__/pages.test.ts +0 -226
  271. package/src/routes/dash/appearance.tsx +0 -240
  272. package/src/routes/dash/collections.tsx +0 -211
  273. package/src/routes/dash/index.tsx +0 -103
  274. package/src/routes/dash/media.tsx +0 -132
  275. package/src/routes/dash/pages.tsx +0 -239
  276. package/src/routes/dash/posts.tsx +0 -334
  277. package/src/routes/dash/redirects.tsx +0 -257
  278. package/src/routes/pages/post.tsx +0 -59
  279. package/src/services/__tests__/page.test.ts +0 -298
  280. package/src/services/__tests__/path-registry.test.ts +0 -165
  281. package/src/services/__tests__/redirect.test.ts +0 -159
  282. package/src/services/page.ts +0 -203
  283. package/src/services/path-registry.ts +0 -160
  284. package/src/services/redirect.ts +0 -97
  285. package/src/types/sortablejs.d.ts +0 -29
  286. package/src/ui/components/__tests__/jant-compose-dialog.test.ts +0 -512
  287. package/src/ui/components/__tests__/jant-compose-editor.test.ts +0 -272
  288. package/src/ui/components/compose-types.ts +0 -75
  289. package/src/ui/components/jant-collection-form.ts +0 -512
  290. package/src/ui/components/jant-compose-dialog.ts +0 -495
  291. package/src/ui/components/jant-compose-editor.ts +0 -814
  292. package/src/ui/dash/PageForm.tsx +0 -185
  293. package/src/ui/dash/PostList.tsx +0 -95
  294. package/src/ui/dash/appearance/AppearanceNav.tsx +0 -60
  295. package/src/ui/dash/collections/CollectionForm.tsx +0 -166
  296. package/src/ui/dash/collections/CollectionsListContent.tsx +0 -146
  297. package/src/ui/dash/collections/IconPickerGrid.tsx +0 -50
  298. package/src/ui/dash/collections/ViewCollectionContent.tsx +0 -103
  299. package/src/ui/dash/media/MediaListContent.tsx +0 -201
  300. package/src/ui/dash/media/ViewMediaContent.tsx +0 -208
  301. package/src/ui/dash/pages/PagesContent.tsx +0 -74
  302. package/src/ui/dash/posts/PostForm.tsx +0 -248
  303. package/src/ui/dash/settings/SettingsNav.tsx +0 -52
  304. package/src/ui/layouts/DashLayout.tsx +0 -165
  305. package/src/ui/pages/SinglePage.tsx +0 -23
  306. package/src/ui/shared/ThreadView.tsx +0 -136
  307. /package/src/{ui → client}/components/settings-types.ts +0 -0
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": "6",
3
3
  "dialect": "sqlite",
4
- "id": "3d04f8ef-088d-43f4-9fe9-55ffa2d7a73f",
4
+ "id": "6387f30b-c6d3-4ad1-a627-1ec026abed4a",
5
5
  "prevId": "00000000-0000-0000-0000-000000000000",
6
6
  "tables": {
7
7
  "account": {
@@ -115,34 +115,41 @@
115
115
  "uniqueConstraints": {},
116
116
  "checkConstraints": {}
117
117
  },
118
- "collections": {
119
- "name": "collections",
118
+ "api_token": {
119
+ "name": "api_token",
120
120
  "columns": {
121
121
  "id": {
122
122
  "name": "id",
123
- "type": "integer",
123
+ "type": "text",
124
124
  "primaryKey": true,
125
125
  "notNull": true,
126
- "autoincrement": true
126
+ "autoincrement": false
127
127
  },
128
- "path": {
129
- "name": "path",
128
+ "name": {
129
+ "name": "name",
130
130
  "type": "text",
131
131
  "primaryKey": false,
132
- "notNull": false,
132
+ "notNull": true,
133
133
  "autoincrement": false
134
134
  },
135
- "title": {
136
- "name": "title",
135
+ "token_hash": {
136
+ "name": "token_hash",
137
137
  "type": "text",
138
138
  "primaryKey": false,
139
139
  "notNull": true,
140
140
  "autoincrement": false
141
141
  },
142
- "description": {
143
- "name": "description",
142
+ "prefix": {
143
+ "name": "prefix",
144
144
  "type": "text",
145
145
  "primaryKey": false,
146
+ "notNull": true,
147
+ "autoincrement": false
148
+ },
149
+ "last_used_at": {
150
+ "name": "last_used_at",
151
+ "type": "integer",
152
+ "primaryKey": false,
146
153
  "notNull": false,
147
154
  "autoincrement": false
148
155
  },
@@ -162,9 +169,9 @@
162
169
  }
163
170
  },
164
171
  "indexes": {
165
- "collections_path_unique": {
166
- "name": "collections_path_unique",
167
- "columns": ["path"],
172
+ "api_token_token_hash_unique": {
173
+ "name": "api_token_token_hash_unique",
174
+ "columns": ["token_hash"],
168
175
  "isUnique": true
169
176
  }
170
177
  },
@@ -173,6 +180,71 @@
173
180
  "uniqueConstraints": {},
174
181
  "checkConstraints": {}
175
182
  },
183
+ "collection": {
184
+ "name": "collection",
185
+ "columns": {
186
+ "id": {
187
+ "name": "id",
188
+ "type": "text",
189
+ "primaryKey": true,
190
+ "notNull": true,
191
+ "autoincrement": false
192
+ },
193
+ "title": {
194
+ "name": "title",
195
+ "type": "text",
196
+ "primaryKey": false,
197
+ "notNull": true,
198
+ "autoincrement": false
199
+ },
200
+ "description": {
201
+ "name": "description",
202
+ "type": "text",
203
+ "primaryKey": false,
204
+ "notNull": false,
205
+ "autoincrement": false
206
+ },
207
+ "icon": {
208
+ "name": "icon",
209
+ "type": "text",
210
+ "primaryKey": false,
211
+ "notNull": false,
212
+ "autoincrement": false
213
+ },
214
+ "sort_order": {
215
+ "name": "sort_order",
216
+ "type": "text",
217
+ "primaryKey": false,
218
+ "notNull": true,
219
+ "autoincrement": false,
220
+ "default": "'newest'"
221
+ },
222
+ "created_at": {
223
+ "name": "created_at",
224
+ "type": "integer",
225
+ "primaryKey": false,
226
+ "notNull": true,
227
+ "autoincrement": false
228
+ },
229
+ "updated_at": {
230
+ "name": "updated_at",
231
+ "type": "integer",
232
+ "primaryKey": false,
233
+ "notNull": true,
234
+ "autoincrement": false
235
+ }
236
+ },
237
+ "indexes": {},
238
+ "foreignKeys": {},
239
+ "compositePrimaryKeys": {},
240
+ "uniqueConstraints": {},
241
+ "checkConstraints": {
242
+ "chk_collection_sort_order": {
243
+ "name": "chk_collection_sort_order",
244
+ "value": "\"collection\".\"sort_order\" IN ('newest', 'oldest', 'rating_desc', 'rating_asc')"
245
+ }
246
+ }
247
+ },
176
248
  "media": {
177
249
  "name": "media",
178
250
  "columns": {
@@ -185,7 +257,7 @@
185
257
  },
186
258
  "post_id": {
187
259
  "name": "post_id",
188
- "type": "integer",
260
+ "type": "text",
189
261
  "primaryKey": false,
190
262
  "notNull": false,
191
263
  "autoincrement": false
@@ -218,13 +290,21 @@
218
290
  "notNull": true,
219
291
  "autoincrement": false
220
292
  },
221
- "r2_key": {
222
- "name": "r2_key",
293
+ "storage_key": {
294
+ "name": "storage_key",
223
295
  "type": "text",
224
296
  "primaryKey": false,
225
297
  "notNull": true,
226
298
  "autoincrement": false
227
299
  },
300
+ "provider": {
301
+ "name": "provider",
302
+ "type": "text",
303
+ "primaryKey": false,
304
+ "notNull": true,
305
+ "autoincrement": false,
306
+ "default": "'r2'"
307
+ },
228
308
  "width": {
229
309
  "name": "width",
230
310
  "type": "integer",
@@ -246,109 +326,443 @@
246
326
  "notNull": false,
247
327
  "autoincrement": false
248
328
  },
329
+ "position": {
330
+ "name": "position",
331
+ "type": "text",
332
+ "primaryKey": false,
333
+ "notNull": true,
334
+ "autoincrement": false,
335
+ "default": "'a0'"
336
+ },
337
+ "blurhash": {
338
+ "name": "blurhash",
339
+ "type": "text",
340
+ "primaryKey": false,
341
+ "notNull": false,
342
+ "autoincrement": false
343
+ },
344
+ "waveform": {
345
+ "name": "waveform",
346
+ "type": "text",
347
+ "primaryKey": false,
348
+ "notNull": false,
349
+ "autoincrement": false
350
+ },
351
+ "poster_key": {
352
+ "name": "poster_key",
353
+ "type": "text",
354
+ "primaryKey": false,
355
+ "notNull": false,
356
+ "autoincrement": false
357
+ },
358
+ "summary": {
359
+ "name": "summary",
360
+ "type": "text",
361
+ "primaryKey": false,
362
+ "notNull": false,
363
+ "autoincrement": false
364
+ },
365
+ "chars": {
366
+ "name": "chars",
367
+ "type": "integer",
368
+ "primaryKey": false,
369
+ "notNull": false,
370
+ "autoincrement": false
371
+ },
372
+ "media_kind": {
373
+ "name": "media_kind",
374
+ "type": "text",
375
+ "primaryKey": false,
376
+ "notNull": true,
377
+ "autoincrement": false,
378
+ "default": "'document'"
379
+ },
249
380
  "created_at": {
250
381
  "name": "created_at",
251
382
  "type": "integer",
252
383
  "primaryKey": false,
253
384
  "notNull": true,
254
385
  "autoincrement": false
386
+ },
387
+ "updated_at": {
388
+ "name": "updated_at",
389
+ "type": "integer",
390
+ "primaryKey": false,
391
+ "notNull": true,
392
+ "autoincrement": false
393
+ }
394
+ },
395
+ "indexes": {
396
+ "idx_media_post_id_position": {
397
+ "name": "idx_media_post_id_position",
398
+ "columns": ["post_id", "position"],
399
+ "isUnique": false
400
+ },
401
+ "uq_media_post_position": {
402
+ "name": "uq_media_post_position",
403
+ "columns": ["post_id", "position"],
404
+ "isUnique": true,
405
+ "where": "\"media\".\"post_id\" IS NOT NULL"
406
+ },
407
+ "uq_media_provider_storage_key": {
408
+ "name": "uq_media_provider_storage_key",
409
+ "columns": ["provider", "storage_key"],
410
+ "isUnique": true
411
+ },
412
+ "idx_media_media_kind_post_id": {
413
+ "name": "idx_media_media_kind_post_id",
414
+ "columns": ["media_kind", "post_id"],
415
+ "isUnique": false
255
416
  }
256
417
  },
257
- "indexes": {},
258
418
  "foreignKeys": {
259
- "media_post_id_posts_id_fk": {
260
- "name": "media_post_id_posts_id_fk",
419
+ "media_post_id_post_id_fk": {
420
+ "name": "media_post_id_post_id_fk",
261
421
  "tableFrom": "media",
262
- "tableTo": "posts",
422
+ "tableTo": "post",
263
423
  "columnsFrom": ["post_id"],
264
424
  "columnsTo": ["id"],
265
- "onDelete": "no action",
425
+ "onDelete": "set null",
266
426
  "onUpdate": "no action"
267
427
  }
268
428
  },
269
429
  "compositePrimaryKeys": {},
270
430
  "uniqueConstraints": {},
271
- "checkConstraints": {}
431
+ "checkConstraints": {
432
+ "chk_media_provider": {
433
+ "name": "chk_media_provider",
434
+ "value": "\"media\".\"provider\" IN ('r2', 's3')"
435
+ },
436
+ "chk_media_media_kind": {
437
+ "name": "chk_media_media_kind",
438
+ "value": "\"media\".\"media_kind\" IN ('image', 'video', 'audio', 'text', 'document')"
439
+ },
440
+ "chk_media_size_positive": {
441
+ "name": "chk_media_size_positive",
442
+ "value": "\"media\".\"size\" > 0"
443
+ },
444
+ "chk_media_position_not_blank": {
445
+ "name": "chk_media_position_not_blank",
446
+ "value": "trim(\"media\".\"position\") <> ''"
447
+ },
448
+ "chk_media_dimensions_positive": {
449
+ "name": "chk_media_dimensions_positive",
450
+ "value": "(\n \"media\".\"width\" IS NULL OR \"media\".\"width\" > 0\n ) AND (\n \"media\".\"height\" IS NULL OR \"media\".\"height\" > 0\n )"
451
+ },
452
+ "chk_media_chars_nonnegative": {
453
+ "name": "chk_media_chars_nonnegative",
454
+ "value": "\"media\".\"chars\" IS NULL OR \"media\".\"chars\" >= 0"
455
+ }
456
+ }
457
+ },
458
+ "nav_item": {
459
+ "name": "nav_item",
460
+ "columns": {
461
+ "id": {
462
+ "name": "id",
463
+ "type": "text",
464
+ "primaryKey": true,
465
+ "notNull": true,
466
+ "autoincrement": false
467
+ },
468
+ "type": {
469
+ "name": "type",
470
+ "type": "text",
471
+ "primaryKey": false,
472
+ "notNull": true,
473
+ "autoincrement": false,
474
+ "default": "'link'"
475
+ },
476
+ "label": {
477
+ "name": "label",
478
+ "type": "text",
479
+ "primaryKey": false,
480
+ "notNull": true,
481
+ "autoincrement": false
482
+ },
483
+ "url": {
484
+ "name": "url",
485
+ "type": "text",
486
+ "primaryKey": false,
487
+ "notNull": true,
488
+ "autoincrement": false
489
+ },
490
+ "position": {
491
+ "name": "position",
492
+ "type": "text",
493
+ "primaryKey": false,
494
+ "notNull": true,
495
+ "autoincrement": false,
496
+ "default": "'a0'"
497
+ },
498
+ "created_at": {
499
+ "name": "created_at",
500
+ "type": "integer",
501
+ "primaryKey": false,
502
+ "notNull": true,
503
+ "autoincrement": false
504
+ },
505
+ "updated_at": {
506
+ "name": "updated_at",
507
+ "type": "integer",
508
+ "primaryKey": false,
509
+ "notNull": true,
510
+ "autoincrement": false
511
+ }
512
+ },
513
+ "indexes": {
514
+ "uq_nav_item_position": {
515
+ "name": "uq_nav_item_position",
516
+ "columns": ["position"],
517
+ "isUnique": true
518
+ }
519
+ },
520
+ "foreignKeys": {},
521
+ "compositePrimaryKeys": {},
522
+ "uniqueConstraints": {},
523
+ "checkConstraints": {
524
+ "chk_nav_item_type": {
525
+ "name": "chk_nav_item_type",
526
+ "value": "\"nav_item\".\"type\" IN ('link', 'system')"
527
+ }
528
+ }
272
529
  },
273
- "post_collections": {
274
- "name": "post_collections",
530
+ "path_registry": {
531
+ "name": "path_registry",
275
532
  "columns": {
533
+ "id": {
534
+ "name": "id",
535
+ "type": "text",
536
+ "primaryKey": true,
537
+ "notNull": true,
538
+ "autoincrement": false
539
+ },
540
+ "path": {
541
+ "name": "path",
542
+ "type": "text",
543
+ "primaryKey": false,
544
+ "notNull": true,
545
+ "autoincrement": false
546
+ },
547
+ "kind": {
548
+ "name": "kind",
549
+ "type": "text",
550
+ "primaryKey": false,
551
+ "notNull": true,
552
+ "autoincrement": false
553
+ },
276
554
  "post_id": {
277
555
  "name": "post_id",
556
+ "type": "text",
557
+ "primaryKey": false,
558
+ "notNull": false,
559
+ "autoincrement": false
560
+ },
561
+ "collection_id": {
562
+ "name": "collection_id",
563
+ "type": "text",
564
+ "primaryKey": false,
565
+ "notNull": false,
566
+ "autoincrement": false
567
+ },
568
+ "redirect_to_path": {
569
+ "name": "redirect_to_path",
570
+ "type": "text",
571
+ "primaryKey": false,
572
+ "notNull": false,
573
+ "autoincrement": false
574
+ },
575
+ "redirect_type": {
576
+ "name": "redirect_type",
577
+ "type": "integer",
578
+ "primaryKey": false,
579
+ "notNull": false,
580
+ "autoincrement": false
581
+ },
582
+ "created_at": {
583
+ "name": "created_at",
278
584
  "type": "integer",
279
585
  "primaryKey": false,
280
586
  "notNull": true,
281
587
  "autoincrement": false
282
588
  },
589
+ "updated_at": {
590
+ "name": "updated_at",
591
+ "type": "integer",
592
+ "primaryKey": false,
593
+ "notNull": true,
594
+ "autoincrement": false
595
+ }
596
+ },
597
+ "indexes": {
598
+ "path_registry_path_unique": {
599
+ "name": "path_registry_path_unique",
600
+ "columns": ["path"],
601
+ "isUnique": true
602
+ },
603
+ "uq_path_registry_post_slug": {
604
+ "name": "uq_path_registry_post_slug",
605
+ "columns": ["post_id"],
606
+ "isUnique": true,
607
+ "where": "\"path_registry\".\"kind\" = 'slug' AND \"path_registry\".\"post_id\" IS NOT NULL"
608
+ },
609
+ "uq_path_registry_collection_slug": {
610
+ "name": "uq_path_registry_collection_slug",
611
+ "columns": ["collection_id"],
612
+ "isUnique": true,
613
+ "where": "\"path_registry\".\"kind\" = 'slug' AND \"path_registry\".\"collection_id\" IS NOT NULL"
614
+ },
615
+ "idx_path_registry_post_id": {
616
+ "name": "idx_path_registry_post_id",
617
+ "columns": ["post_id"],
618
+ "isUnique": false
619
+ },
620
+ "idx_path_registry_collection_id": {
621
+ "name": "idx_path_registry_collection_id",
622
+ "columns": ["collection_id"],
623
+ "isUnique": false
624
+ }
625
+ },
626
+ "foreignKeys": {
627
+ "path_registry_post_id_post_id_fk": {
628
+ "name": "path_registry_post_id_post_id_fk",
629
+ "tableFrom": "path_registry",
630
+ "tableTo": "post",
631
+ "columnsFrom": ["post_id"],
632
+ "columnsTo": ["id"],
633
+ "onDelete": "cascade",
634
+ "onUpdate": "no action"
635
+ },
636
+ "path_registry_collection_id_collection_id_fk": {
637
+ "name": "path_registry_collection_id_collection_id_fk",
638
+ "tableFrom": "path_registry",
639
+ "tableTo": "collection",
640
+ "columnsFrom": ["collection_id"],
641
+ "columnsTo": ["id"],
642
+ "onDelete": "cascade",
643
+ "onUpdate": "no action"
644
+ }
645
+ },
646
+ "compositePrimaryKeys": {},
647
+ "uniqueConstraints": {},
648
+ "checkConstraints": {
649
+ "chk_path_registry_kind": {
650
+ "name": "chk_path_registry_kind",
651
+ "value": "\"path_registry\".\"kind\" IN ('slug', 'alias', 'redirect')"
652
+ },
653
+ "chk_path_registry_shape": {
654
+ "name": "chk_path_registry_shape",
655
+ "value": "(\n \"path_registry\".\"kind\" IN ('slug', 'alias')\n AND (\n (\"path_registry\".\"post_id\" IS NOT NULL AND \"path_registry\".\"collection_id\" IS NULL)\n OR (\"path_registry\".\"post_id\" IS NULL AND \"path_registry\".\"collection_id\" IS NOT NULL)\n )\n AND \"path_registry\".\"redirect_to_path\" IS NULL\n AND \"path_registry\".\"redirect_type\" IS NULL\n ) OR (\n \"path_registry\".\"kind\" = 'redirect'\n AND \"path_registry\".\"post_id\" IS NULL\n AND \"path_registry\".\"collection_id\" IS NULL\n AND \"path_registry\".\"redirect_to_path\" IS NOT NULL\n AND \"path_registry\".\"redirect_type\" IN (301, 302)\n )"
656
+ }
657
+ }
658
+ },
659
+ "post_collection": {
660
+ "name": "post_collection",
661
+ "columns": {
662
+ "post_id": {
663
+ "name": "post_id",
664
+ "type": "text",
665
+ "primaryKey": false,
666
+ "notNull": true,
667
+ "autoincrement": false
668
+ },
283
669
  "collection_id": {
284
670
  "name": "collection_id",
285
- "type": "integer",
671
+ "type": "text",
286
672
  "primaryKey": false,
287
673
  "notNull": true,
288
674
  "autoincrement": false
289
675
  },
290
- "added_at": {
291
- "name": "added_at",
676
+ "created_at": {
677
+ "name": "created_at",
292
678
  "type": "integer",
293
679
  "primaryKey": false,
294
680
  "notNull": true,
295
681
  "autoincrement": false
296
682
  }
297
683
  },
298
- "indexes": {},
684
+ "indexes": {
685
+ "idx_post_collection_collection_id": {
686
+ "name": "idx_post_collection_collection_id",
687
+ "columns": ["collection_id"],
688
+ "isUnique": false
689
+ }
690
+ },
299
691
  "foreignKeys": {
300
- "post_collections_post_id_posts_id_fk": {
301
- "name": "post_collections_post_id_posts_id_fk",
302
- "tableFrom": "post_collections",
303
- "tableTo": "posts",
692
+ "post_collection_post_id_post_id_fk": {
693
+ "name": "post_collection_post_id_post_id_fk",
694
+ "tableFrom": "post_collection",
695
+ "tableTo": "post",
304
696
  "columnsFrom": ["post_id"],
305
697
  "columnsTo": ["id"],
306
- "onDelete": "no action",
698
+ "onDelete": "cascade",
307
699
  "onUpdate": "no action"
308
700
  },
309
- "post_collections_collection_id_collections_id_fk": {
310
- "name": "post_collections_collection_id_collections_id_fk",
311
- "tableFrom": "post_collections",
312
- "tableTo": "collections",
701
+ "post_collection_collection_id_collection_id_fk": {
702
+ "name": "post_collection_collection_id_collection_id_fk",
703
+ "tableFrom": "post_collection",
704
+ "tableTo": "collection",
313
705
  "columnsFrom": ["collection_id"],
314
706
  "columnsTo": ["id"],
315
- "onDelete": "no action",
707
+ "onDelete": "cascade",
316
708
  "onUpdate": "no action"
317
709
  }
318
710
  },
319
711
  "compositePrimaryKeys": {
320
- "post_collections_post_id_collection_id_pk": {
712
+ "post_collection_post_id_collection_id_pk": {
321
713
  "columns": ["post_id", "collection_id"],
322
- "name": "post_collections_post_id_collection_id_pk"
714
+ "name": "post_collection_post_id_collection_id_pk"
323
715
  }
324
716
  },
325
717
  "uniqueConstraints": {},
326
718
  "checkConstraints": {}
327
719
  },
328
- "posts": {
329
- "name": "posts",
720
+ "post": {
721
+ "name": "post",
330
722
  "columns": {
331
723
  "id": {
332
724
  "name": "id",
333
- "type": "integer",
725
+ "type": "text",
334
726
  "primaryKey": true,
335
727
  "notNull": true,
336
- "autoincrement": true
728
+ "autoincrement": false
337
729
  },
338
- "type": {
339
- "name": "type",
730
+ "format": {
731
+ "name": "format",
340
732
  "type": "text",
341
733
  "primaryKey": false,
342
734
  "notNull": true,
343
735
  "autoincrement": false
344
736
  },
737
+ "status": {
738
+ "name": "status",
739
+ "type": "text",
740
+ "primaryKey": false,
741
+ "notNull": true,
742
+ "autoincrement": false,
743
+ "default": "'published'"
744
+ },
345
745
  "visibility": {
346
746
  "name": "visibility",
347
747
  "type": "text",
348
748
  "primaryKey": false,
349
- "notNull": true,
749
+ "notNull": false,
350
750
  "autoincrement": false,
351
- "default": "'quiet'"
751
+ "default": "'public'"
752
+ },
753
+ "pinned_at": {
754
+ "name": "pinned_at",
755
+ "type": "integer",
756
+ "primaryKey": false,
757
+ "notNull": false,
758
+ "autoincrement": false
759
+ },
760
+ "featured_at": {
761
+ "name": "featured_at",
762
+ "type": "integer",
763
+ "primaryKey": false,
764
+ "notNull": false,
765
+ "autoincrement": false
352
766
  },
353
767
  "title": {
354
768
  "name": "title",
@@ -357,60 +771,67 @@
357
771
  "notNull": false,
358
772
  "autoincrement": false
359
773
  },
360
- "path": {
361
- "name": "path",
774
+ "url": {
775
+ "name": "url",
362
776
  "type": "text",
363
777
  "primaryKey": false,
364
778
  "notNull": false,
365
779
  "autoincrement": false
366
780
  },
367
- "content": {
368
- "name": "content",
781
+ "body": {
782
+ "name": "body",
369
783
  "type": "text",
370
784
  "primaryKey": false,
371
785
  "notNull": false,
372
786
  "autoincrement": false
373
787
  },
374
- "content_html": {
375
- "name": "content_html",
788
+ "body_html": {
789
+ "name": "body_html",
376
790
  "type": "text",
377
791
  "primaryKey": false,
378
792
  "notNull": false,
379
793
  "autoincrement": false
380
794
  },
381
- "source_url": {
382
- "name": "source_url",
795
+ "body_text": {
796
+ "name": "body_text",
383
797
  "type": "text",
384
798
  "primaryKey": false,
385
799
  "notNull": false,
386
800
  "autoincrement": false
387
801
  },
388
- "source_name": {
389
- "name": "source_name",
802
+ "quote_text": {
803
+ "name": "quote_text",
390
804
  "type": "text",
391
805
  "primaryKey": false,
392
806
  "notNull": false,
393
807
  "autoincrement": false
394
808
  },
395
- "source_domain": {
396
- "name": "source_domain",
809
+ "summary": {
810
+ "name": "summary",
397
811
  "type": "text",
398
812
  "primaryKey": false,
399
813
  "notNull": false,
400
814
  "autoincrement": false
401
815
  },
816
+ "rating": {
817
+ "name": "rating",
818
+ "type": "integer",
819
+ "primaryKey": false,
820
+ "notNull": false,
821
+ "autoincrement": false
822
+ },
402
823
  "reply_to_id": {
403
824
  "name": "reply_to_id",
404
- "type": "integer",
825
+ "type": "text",
405
826
  "primaryKey": false,
406
827
  "notNull": false,
407
828
  "autoincrement": false
408
829
  },
409
830
  "thread_id": {
410
831
  "name": "thread_id",
411
- "type": "integer",
832
+ "type": "text",
412
833
  "primaryKey": false,
413
- "notNull": false,
834
+ "notNull": true,
414
835
  "autoincrement": false
415
836
  },
416
837
  "deleted_at": {
@@ -424,7 +845,14 @@
424
845
  "name": "published_at",
425
846
  "type": "integer",
426
847
  "primaryKey": false,
427
- "notNull": true,
848
+ "notNull": false,
849
+ "autoincrement": false
850
+ },
851
+ "last_activity_at": {
852
+ "name": "last_activity_at",
853
+ "type": "integer",
854
+ "primaryKey": false,
855
+ "notNull": false,
428
856
  "autoincrement": false
429
857
  },
430
858
  "created_at": {
@@ -442,63 +870,125 @@
442
870
  "autoincrement": false
443
871
  }
444
872
  },
445
- "indexes": {},
446
- "foreignKeys": {},
447
- "compositePrimaryKeys": {},
448
- "uniqueConstraints": {},
449
- "checkConstraints": {}
450
- },
451
- "redirects": {
452
- "name": "redirects",
453
- "columns": {
454
- "id": {
455
- "name": "id",
456
- "type": "integer",
457
- "primaryKey": true,
458
- "notNull": true,
459
- "autoincrement": true
460
- },
461
- "from_path": {
462
- "name": "from_path",
463
- "type": "text",
464
- "primaryKey": false,
465
- "notNull": true,
466
- "autoincrement": false
467
- },
468
- "to_path": {
469
- "name": "to_path",
470
- "type": "text",
471
- "primaryKey": false,
472
- "notNull": true,
473
- "autoincrement": false
474
- },
475
- "type": {
476
- "name": "type",
477
- "type": "integer",
478
- "primaryKey": false,
479
- "notNull": true,
480
- "autoincrement": false,
481
- "default": 301
873
+ "indexes": {
874
+ "uq_post_id_thread_id": {
875
+ "name": "uq_post_id_thread_id",
876
+ "columns": ["id", "thread_id"],
877
+ "isUnique": true
482
878
  },
483
- "created_at": {
484
- "name": "created_at",
485
- "type": "integer",
486
- "primaryKey": false,
487
- "notNull": true,
488
- "autoincrement": false
879
+ "idx_post_thread_id": {
880
+ "name": "idx_post_thread_id",
881
+ "columns": ["thread_id"],
882
+ "isUnique": false
883
+ },
884
+ "idx_post_thread_live_created": {
885
+ "name": "idx_post_thread_live_created",
886
+ "columns": ["thread_id", "created_at", "id"],
887
+ "isUnique": false,
888
+ "where": "\"post\".\"deleted_at\" IS NULL"
889
+ },
890
+ "idx_post_status_deleted_published": {
891
+ "name": "idx_post_status_deleted_published",
892
+ "columns": ["status", "deleted_at", "published_at"],
893
+ "isUnique": false
894
+ },
895
+ "idx_post_status_deleted_activity": {
896
+ "name": "idx_post_status_deleted_activity",
897
+ "columns": ["status", "deleted_at", "last_activity_at"],
898
+ "isUnique": false
899
+ },
900
+ "idx_post_root_live_published_activity": {
901
+ "name": "idx_post_root_live_published_activity",
902
+ "columns": ["last_activity_at", "id"],
903
+ "isUnique": false,
904
+ "where": "\"post\".\"deleted_at\" IS NULL AND \"post\".\"reply_to_id\" IS NULL AND \"post\".\"status\" = 'published'"
905
+ },
906
+ "idx_post_root_live_draft_updated": {
907
+ "name": "idx_post_root_live_draft_updated",
908
+ "columns": ["updated_at", "id"],
909
+ "isUnique": false,
910
+ "where": "\"post\".\"deleted_at\" IS NULL AND \"post\".\"reply_to_id\" IS NULL AND \"post\".\"status\" = 'draft'"
911
+ },
912
+ "idx_post_reply_live_thread_created": {
913
+ "name": "idx_post_reply_live_thread_created",
914
+ "columns": ["thread_id", "created_at", "id"],
915
+ "isUnique": false,
916
+ "where": "\"post\".\"deleted_at\" IS NULL AND \"post\".\"reply_to_id\" IS NOT NULL AND \"post\".\"status\" = 'published'"
489
917
  }
490
918
  },
491
- "indexes": {
492
- "redirects_from_path_unique": {
493
- "name": "redirects_from_path_unique",
494
- "columns": ["from_path"],
495
- "isUnique": true
919
+ "foreignKeys": {
920
+ "post_reply_to_id_post_id_fk": {
921
+ "name": "post_reply_to_id_post_id_fk",
922
+ "tableFrom": "post",
923
+ "tableTo": "post",
924
+ "columnsFrom": ["reply_to_id"],
925
+ "columnsTo": ["id"],
926
+ "onDelete": "no action",
927
+ "onUpdate": "no action"
928
+ },
929
+ "post_thread_id_post_id_fk": {
930
+ "name": "post_thread_id_post_id_fk",
931
+ "tableFrom": "post",
932
+ "tableTo": "post",
933
+ "columnsFrom": ["thread_id"],
934
+ "columnsTo": ["id"],
935
+ "onDelete": "no action",
936
+ "onUpdate": "no action"
937
+ },
938
+ "post_reply_to_id_thread_id_post_id_thread_id_fk": {
939
+ "name": "post_reply_to_id_thread_id_post_id_thread_id_fk",
940
+ "tableFrom": "post",
941
+ "tableTo": "post",
942
+ "columnsFrom": ["reply_to_id", "thread_id"],
943
+ "columnsTo": ["id", "thread_id"],
944
+ "onDelete": "no action",
945
+ "onUpdate": "no action"
496
946
  }
497
947
  },
498
- "foreignKeys": {},
499
948
  "compositePrimaryKeys": {},
500
949
  "uniqueConstraints": {},
501
- "checkConstraints": {}
950
+ "checkConstraints": {
951
+ "chk_post_format": {
952
+ "name": "chk_post_format",
953
+ "value": "\"post\".\"format\" IN ('note', 'link', 'quote')"
954
+ },
955
+ "chk_post_status": {
956
+ "name": "chk_post_status",
957
+ "value": "\"post\".\"status\" IN ('draft', 'published')"
958
+ },
959
+ "chk_post_visibility": {
960
+ "name": "chk_post_visibility",
961
+ "value": "\"post\".\"visibility\" IN ('public', 'unlisted', 'private')"
962
+ },
963
+ "chk_post_root_visibility_present": {
964
+ "name": "chk_post_root_visibility_present",
965
+ "value": "(\n \"post\".\"reply_to_id\" IS NULL\n AND \"post\".\"visibility\" IS NOT NULL\n ) OR (\n \"post\".\"reply_to_id\" IS NOT NULL\n AND \"post\".\"visibility\" IS NULL\n )"
966
+ },
967
+ "chk_post_reply_to_not_self": {
968
+ "name": "chk_post_reply_to_not_self",
969
+ "value": "\"post\".\"reply_to_id\" IS NULL OR \"post\".\"reply_to_id\" <> \"post\".\"id\""
970
+ },
971
+ "chk_post_thread_shape": {
972
+ "name": "chk_post_thread_shape",
973
+ "value": "(\n \"post\".\"reply_to_id\" IS NULL\n AND \"post\".\"thread_id\" = \"post\".\"id\"\n ) OR (\n \"post\".\"reply_to_id\" IS NOT NULL\n AND \"post\".\"thread_id\" <> \"post\".\"id\"\n )"
974
+ },
975
+ "chk_post_reply_not_pinned": {
976
+ "name": "chk_post_reply_not_pinned",
977
+ "value": "\"post\".\"pinned_at\" IS NULL OR \"post\".\"reply_to_id\" IS NULL"
978
+ },
979
+ "chk_post_format_shape": {
980
+ "name": "chk_post_format_shape",
981
+ "value": "(\n \"post\".\"format\" = 'note'\n AND (\"post\".\"url\" IS NULL OR trim(\"post\".\"url\") = '')\n AND (\"post\".\"quote_text\" IS NULL OR trim(\"post\".\"quote_text\") = '')\n ) OR (\n \"post\".\"format\" = 'link'\n AND \"post\".\"url\" IS NOT NULL\n AND trim(\"post\".\"url\") <> ''\n AND (\"post\".\"quote_text\" IS NULL OR trim(\"post\".\"quote_text\") = '')\n ) OR (\n \"post\".\"format\" = 'quote'\n AND \"post\".\"quote_text\" IS NOT NULL\n AND trim(\"post\".\"quote_text\") <> ''\n )"
982
+ },
983
+ "chk_post_rating_range": {
984
+ "name": "chk_post_rating_range",
985
+ "value": "\"post\".\"rating\" IS NULL OR \"post\".\"rating\" BETWEEN 1 AND 5"
986
+ },
987
+ "chk_post_status_published_at": {
988
+ "name": "chk_post_status_published_at",
989
+ "value": "(\n \"post\".\"status\" = 'draft'\n AND \"post\".\"published_at\" IS NULL\n ) OR (\n \"post\".\"status\" = 'published'\n AND \"post\".\"published_at\" IS NOT NULL\n )"
990
+ }
991
+ }
502
992
  },
503
993
  "session": {
504
994
  "name": "session",
@@ -565,6 +1055,11 @@
565
1055
  "name": "session_token_unique",
566
1056
  "columns": ["token"],
567
1057
  "isUnique": true
1058
+ },
1059
+ "idx_session_user_id": {
1060
+ "name": "idx_session_user_id",
1061
+ "columns": ["user_id"],
1062
+ "isUnique": false
568
1063
  }
569
1064
  },
570
1065
  "foreignKeys": {
@@ -582,8 +1077,8 @@
582
1077
  "uniqueConstraints": {},
583
1078
  "checkConstraints": {}
584
1079
  },
585
- "settings": {
586
- "name": "settings",
1080
+ "setting": {
1081
+ "name": "setting",
587
1082
  "columns": {
588
1083
  "key": {
589
1084
  "name": "key",
@@ -613,6 +1108,95 @@
613
1108
  "uniqueConstraints": {},
614
1109
  "checkConstraints": {}
615
1110
  },
1111
+ "sidebar_item": {
1112
+ "name": "sidebar_item",
1113
+ "columns": {
1114
+ "id": {
1115
+ "name": "id",
1116
+ "type": "text",
1117
+ "primaryKey": true,
1118
+ "notNull": true,
1119
+ "autoincrement": false
1120
+ },
1121
+ "type": {
1122
+ "name": "type",
1123
+ "type": "text",
1124
+ "primaryKey": false,
1125
+ "notNull": true,
1126
+ "autoincrement": false
1127
+ },
1128
+ "collection_id": {
1129
+ "name": "collection_id",
1130
+ "type": "text",
1131
+ "primaryKey": false,
1132
+ "notNull": false,
1133
+ "autoincrement": false
1134
+ },
1135
+ "position": {
1136
+ "name": "position",
1137
+ "type": "text",
1138
+ "primaryKey": false,
1139
+ "notNull": true,
1140
+ "autoincrement": false,
1141
+ "default": "'a0'"
1142
+ },
1143
+ "created_at": {
1144
+ "name": "created_at",
1145
+ "type": "integer",
1146
+ "primaryKey": false,
1147
+ "notNull": true,
1148
+ "autoincrement": false
1149
+ },
1150
+ "updated_at": {
1151
+ "name": "updated_at",
1152
+ "type": "integer",
1153
+ "primaryKey": false,
1154
+ "notNull": true,
1155
+ "autoincrement": false
1156
+ }
1157
+ },
1158
+ "indexes": {
1159
+ "idx_sidebar_item_collection_id": {
1160
+ "name": "idx_sidebar_item_collection_id",
1161
+ "columns": ["collection_id"],
1162
+ "isUnique": false
1163
+ },
1164
+ "uq_sidebar_item_position": {
1165
+ "name": "uq_sidebar_item_position",
1166
+ "columns": ["position"],
1167
+ "isUnique": true
1168
+ },
1169
+ "uq_sidebar_item_collection_once": {
1170
+ "name": "uq_sidebar_item_collection_once",
1171
+ "columns": ["collection_id"],
1172
+ "isUnique": true,
1173
+ "where": "\"sidebar_item\".\"type\" = 'collection' AND \"sidebar_item\".\"collection_id\" IS NOT NULL"
1174
+ }
1175
+ },
1176
+ "foreignKeys": {
1177
+ "sidebar_item_collection_id_collection_id_fk": {
1178
+ "name": "sidebar_item_collection_id_collection_id_fk",
1179
+ "tableFrom": "sidebar_item",
1180
+ "tableTo": "collection",
1181
+ "columnsFrom": ["collection_id"],
1182
+ "columnsTo": ["id"],
1183
+ "onDelete": "cascade",
1184
+ "onUpdate": "no action"
1185
+ }
1186
+ },
1187
+ "compositePrimaryKeys": {},
1188
+ "uniqueConstraints": {},
1189
+ "checkConstraints": {
1190
+ "chk_sidebar_item_type": {
1191
+ "name": "chk_sidebar_item_type",
1192
+ "value": "\"sidebar_item\".\"type\" IN ('collection', 'divider')"
1193
+ },
1194
+ "chk_sidebar_item_shape": {
1195
+ "name": "chk_sidebar_item_shape",
1196
+ "value": "(\n \"sidebar_item\".\"type\" = 'collection' AND \"sidebar_item\".\"collection_id\" IS NOT NULL\n ) OR (\n \"sidebar_item\".\"type\" = 'divider' AND \"sidebar_item\".\"collection_id\" IS NULL\n )"
1197
+ }
1198
+ }
1199
+ },
616
1200
  "user": {
617
1201
  "name": "user",
618
1202
  "columns": {
@@ -658,7 +1242,7 @@
658
1242
  "primaryKey": false,
659
1243
  "notNull": false,
660
1244
  "autoincrement": false,
661
- "default": "'admin'"
1245
+ "default": "'member'"
662
1246
  },
663
1247
  "created_at": {
664
1248
  "name": "created_at",