dineway 0.2.39 → 0.2.41
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/dist/{activity-LXZdjKwI.mjs → activity-BuhkMdv8.mjs} +2 -2
- package/dist/{activity-events-DoqeOM8x.mjs → activity-events-DkHsy7Y0.mjs} +1 -1
- package/dist/{allowed-origins-DiVrMLxh.mjs → allowed-origins-Clitkhiv.mjs} +1 -1
- package/dist/api/route-utils.d.mts +15 -12
- package/dist/api/route-utils.mjs +27 -20
- package/dist/api/schemas/index.d.mts +1 -1
- package/dist/api/schemas/index.mjs +10 -5
- package/dist/{api-COSxvdOi.mjs → api-CMbsIQ46.mjs} +41 -13
- package/dist/{api-tokens-CNHnKO57.mjs → api-tokens-ciHNTdN2.mjs} +1 -1
- package/dist/{apply-D4rZHDyg.mjs → apply-B5qoX19G.mjs} +62 -18
- package/dist/astro/index.d.mts +16 -13
- package/dist/astro/index.mjs +31 -5
- package/dist/astro/middleware/auth.d.mts +14 -11
- package/dist/astro/middleware/auth.mjs +8 -8
- package/dist/astro/middleware/redirect.mjs +10 -6
- package/dist/astro/middleware/request-context.mjs +5 -5
- package/dist/astro/middleware/seed.d.mts +1 -1
- package/dist/astro/middleware/seed.mjs +2 -2
- package/dist/astro/middleware/setup.mjs +1 -1
- package/dist/astro/middleware.d.mts +2 -2
- package/dist/astro/middleware.mjs +266 -176
- package/dist/astro/routes/api/admin/allowed-domains/_domain_.mjs +12 -7
- package/dist/astro/routes/api/admin/allowed-domains/index.mjs +12 -7
- package/dist/astro/routes/api/admin/api-tokens/_id_.mjs +4 -4
- package/dist/astro/routes/api/admin/api-tokens/index.mjs +7 -7
- package/dist/astro/routes/api/admin/briefing.mjs +41 -22
- package/dist/astro/routes/api/admin/byline-fields/_slug_/usage.mjs +4 -4
- package/dist/astro/routes/api/admin/byline-fields/_slug_.mjs +14 -10
- package/dist/astro/routes/api/admin/byline-fields/index.mjs +14 -10
- package/dist/astro/routes/api/admin/byline-fields/reorder.mjs +14 -10
- package/dist/astro/routes/api/admin/bylines/_id_/index.mjs +25 -19
- package/dist/astro/routes/api/admin/bylines/_id_/translations.mjs +25 -19
- package/dist/astro/routes/api/admin/bylines/index.mjs +25 -19
- package/dist/astro/routes/api/admin/comments/_id_/status.mjs +20 -16
- package/dist/astro/routes/api/admin/comments/_id_.mjs +10 -7
- package/dist/astro/routes/api/admin/comments/bulk.mjs +18 -13
- package/dist/astro/routes/api/admin/comments/counts.mjs +10 -7
- package/dist/astro/routes/api/admin/comments/index.mjs +18 -13
- package/dist/astro/routes/api/admin/context/_id_/history.mjs +51 -39
- package/dist/astro/routes/api/admin/context/_id_/index.mjs +51 -39
- package/dist/astro/routes/api/admin/context/_id_/review.mjs +57 -44
- package/dist/astro/routes/api/admin/context/_id_/supersede.mjs +57 -44
- package/dist/astro/routes/api/admin/context/diff.mjs +56 -43
- package/dist/astro/routes/api/admin/context/index.mjs +57 -44
- package/dist/astro/routes/api/admin/context/stale.mjs +56 -43
- package/dist/astro/routes/api/admin/hitl-requests/_id_/index.mjs +51 -39
- package/dist/astro/routes/api/admin/hitl-requests/_id_/resolve.mjs +56 -43
- package/dist/astro/routes/api/admin/hitl-requests/index.mjs +56 -43
- package/dist/astro/routes/api/admin/hooks/exclusive/_hookName_.mjs +52 -40
- package/dist/astro/routes/api/admin/hooks/exclusive/index.mjs +3 -3
- package/dist/astro/routes/api/admin/oauth-clients/_id_.mjs +7 -7
- package/dist/astro/routes/api/admin/oauth-clients/index.mjs +7 -7
- package/dist/astro/routes/api/admin/plugins/_id_/disable.mjs +78 -68
- package/dist/astro/routes/api/admin/plugins/_id_/enable.mjs +78 -68
- package/dist/astro/routes/api/admin/plugins/_id_/index.mjs +71 -60
- package/dist/astro/routes/api/admin/plugins/_id_/uninstall.mjs +78 -67
- package/dist/astro/routes/api/admin/plugins/_id_/update.mjs +78 -67
- package/dist/astro/routes/api/admin/plugins/index.mjs +71 -60
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/icon.mjs +2 -2
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/index.mjs +71 -60
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/install.mjs +78 -67
- package/dist/astro/routes/api/admin/plugins/marketplace/index.mjs +71 -60
- package/dist/astro/routes/api/admin/plugins/updates.mjs +71 -60
- package/dist/astro/routes/api/admin/review-requests/_id_/image.mjs +38 -23
- package/dist/astro/routes/api/admin/review-requests/_id_/index.mjs +46 -36
- package/dist/astro/routes/api/admin/review-requests/_id_/resolve.mjs +63 -52
- package/dist/astro/routes/api/admin/review-requests/_id_/revoke.mjs +9 -9
- package/dist/astro/routes/api/admin/review-requests/index.mjs +61 -50
- package/dist/astro/routes/api/admin/themes/marketplace/_id_/index.mjs +71 -60
- package/dist/astro/routes/api/admin/themes/marketplace/_id_/thumbnail.mjs +2 -2
- package/dist/astro/routes/api/admin/themes/marketplace/index.mjs +71 -60
- package/dist/astro/routes/api/admin/users/_id_/disable.mjs +1 -1
- package/dist/astro/routes/api/admin/users/_id_/enable.mjs +1 -1
- package/dist/astro/routes/api/admin/users/_id_/index.mjs +11 -7
- package/dist/astro/routes/api/admin/users/_id_/send-recovery.mjs +3 -3
- package/dist/astro/routes/api/admin/users/index.mjs +12 -7
- package/dist/astro/routes/api/auth/dev-bypass.mjs +4 -4
- package/dist/astro/routes/api/auth/invite/accept.mjs +1 -1
- package/dist/astro/routes/api/auth/invite/complete.mjs +17 -12
- package/dist/astro/routes/api/auth/invite/index.mjs +14 -9
- package/dist/astro/routes/api/auth/invite/register-options.mjs +16 -11
- package/dist/astro/routes/api/auth/logout.mjs +2 -2
- package/dist/astro/routes/api/auth/magic-link/send.mjs +17 -12
- package/dist/astro/routes/api/auth/magic-link/verify.mjs +2 -2
- package/dist/astro/routes/api/auth/me.mjs +14 -11
- package/dist/astro/routes/api/auth/mode.mjs +1 -1
- package/dist/astro/routes/api/auth/oauth/_provider_/callback.mjs +3 -3
- package/dist/astro/routes/api/auth/oauth/_provider_.mjs +3 -3
- package/dist/astro/routes/api/auth/passkey/_id_.mjs +12 -7
- package/dist/astro/routes/api/auth/passkey/index.mjs +1 -1
- package/dist/astro/routes/api/auth/passkey/options.mjs +19 -14
- package/dist/astro/routes/api/auth/passkey/register/options.mjs +16 -11
- package/dist/astro/routes/api/auth/passkey/register/verify.mjs +17 -12
- package/dist/astro/routes/api/auth/passkey/verify.mjs +17 -12
- package/dist/astro/routes/api/auth/setup-token/index.mjs +6 -6
- package/dist/astro/routes/api/auth/setup-token/verify.mjs +2 -2
- package/dist/astro/routes/api/auth/signup/complete.mjs +17 -12
- package/dist/astro/routes/api/auth/signup/request.mjs +17 -12
- package/dist/astro/routes/api/auth/signup/verify.mjs +1 -1
- package/dist/astro/routes/api/comments/_collection_/_contentId_/index.d.mts +14 -11
- package/dist/astro/routes/api/comments/_collection_/_contentId_/index.mjs +23 -19
- package/dist/astro/routes/api/comments/_collection_/_contentId_/reactions.mjs +23 -18
- package/dist/astro/routes/api/content/_collection_/_id_/compare.mjs +2 -2
- package/dist/astro/routes/api/content/_collection_/_id_/discard-draft.mjs +8 -8
- package/dist/astro/routes/api/content/_collection_/_id_/duplicate.mjs +8 -8
- package/dist/astro/routes/api/content/_collection_/_id_/permanent.mjs +8 -8
- package/dist/astro/routes/api/content/_collection_/_id_/preview-url.mjs +25 -20
- package/dist/astro/routes/api/content/_collection_/_id_/publish.mjs +41 -31
- package/dist/astro/routes/api/content/_collection_/_id_/release-readiness.mjs +14 -9
- package/dist/astro/routes/api/content/_collection_/_id_/restore.mjs +8 -8
- package/dist/astro/routes/api/content/_collection_/_id_/revisions.mjs +2 -2
- package/dist/astro/routes/api/content/_collection_/_id_/schedule.mjs +41 -31
- package/dist/astro/routes/api/content/_collection_/_id_/terms/_taxonomy_.mjs +30 -20
- package/dist/astro/routes/api/content/_collection_/_id_/translations.mjs +2 -2
- package/dist/astro/routes/api/content/_collection_/_id_/unpublish.mjs +8 -8
- package/dist/astro/routes/api/content/_collection_/_id_.mjs +25 -14
- package/dist/astro/routes/api/content/_collection_/authors.mjs +2 -2
- package/dist/astro/routes/api/content/_collection_/index.mjs +25 -14
- package/dist/astro/routes/api/content/_collection_/trash.mjs +13 -8
- package/dist/astro/routes/api/dashboard.mjs +21 -13
- package/dist/astro/routes/api/dev/emails.mjs +2 -2
- package/dist/astro/routes/api/health.mjs +1 -1
- package/dist/astro/routes/api/import/probe.d.mts +3 -3
- package/dist/astro/routes/api/import/probe.mjs +30 -23
- package/dist/astro/routes/api/import/wordpress/analyze.mjs +13 -10
- package/dist/astro/routes/api/import/wordpress/execute.d.mts +14 -11
- package/dist/astro/routes/api/import/wordpress/execute.mjs +58 -47
- package/dist/astro/routes/api/import/wordpress/media.d.mts +14 -11
- package/dist/astro/routes/api/import/wordpress/media.mjs +17 -14
- package/dist/astro/routes/api/import/wordpress/prepare.mjs +61 -48
- package/dist/astro/routes/api/import/wordpress/rewrite-urls.d.mts +15 -12
- package/dist/astro/routes/api/import/wordpress/rewrite-urls.mjs +58 -45
- package/dist/astro/routes/api/import/wordpress-plugin/analyze.d.mts +1 -1
- package/dist/astro/routes/api/import/wordpress-plugin/analyze.mjs +32 -26
- package/dist/astro/routes/api/import/wordpress-plugin/callback.mjs +1 -1
- package/dist/astro/routes/api/import/wordpress-plugin/execute.d.mts +14 -11
- package/dist/astro/routes/api/import/wordpress-plugin/execute.mjs +63 -52
- package/dist/astro/routes/api/integration/artifact.mjs +9 -9
- package/dist/astro/routes/api/integration/dispatch.mjs +14 -14
- package/dist/astro/routes/api/integrations/_provider_.mjs +9 -9
- package/dist/astro/routes/api/integrations/index.mjs +8 -8
- package/dist/astro/routes/api/manifest.mjs +5 -5
- package/dist/astro/routes/api/mcp.mjs +141 -93
- package/dist/astro/routes/api/media/_id_/confirm.mjs +15 -12
- package/dist/astro/routes/api/media/_id_.mjs +14 -9
- package/dist/astro/routes/api/media/file/_...key_.mjs +1 -1
- package/dist/astro/routes/api/media/providers/_providerId_/_itemId_.mjs +2 -2
- package/dist/astro/routes/api/media/providers/_providerId_/index.mjs +2 -2
- package/dist/astro/routes/api/media/providers/index.mjs +2 -2
- package/dist/astro/routes/api/media/upload-url.mjs +16 -13
- package/dist/astro/routes/api/media.mjs +19 -16
- package/dist/astro/routes/api/menus/_name_/items/_id_.mjs +57 -44
- package/dist/astro/routes/api/menus/_name_/items.mjs +57 -44
- package/dist/astro/routes/api/menus/_name_/reorder.mjs +57 -44
- package/dist/astro/routes/api/menus/_name_/translations.mjs +57 -44
- package/dist/astro/routes/api/menus/_name_.mjs +57 -44
- package/dist/astro/routes/api/menus/index.mjs +57 -44
- package/dist/astro/routes/api/oauth/authorize.mjs +7 -7
- package/dist/astro/routes/api/oauth/device/authorize.mjs +5 -5
- package/dist/astro/routes/api/oauth/device/code.mjs +9 -9
- package/dist/astro/routes/api/oauth/device/token.mjs +8 -8
- package/dist/astro/routes/api/oauth/register.mjs +4 -4
- package/dist/astro/routes/api/oauth/token/refresh.mjs +5 -5
- package/dist/astro/routes/api/oauth/token/revoke.mjs +5 -5
- package/dist/astro/routes/api/oauth/token.mjs +6 -6
- package/dist/astro/routes/api/openapi.json.mjs +10 -5
- package/dist/astro/routes/api/plugins/_pluginId_/_...path_.mjs +4 -4
- package/dist/astro/routes/api/redirects/404s/index.mjs +15 -13
- package/dist/astro/routes/api/redirects/404s/summary.mjs +15 -13
- package/dist/astro/routes/api/redirects/_id_.mjs +57 -44
- package/dist/astro/routes/api/redirects/index.mjs +57 -44
- package/dist/astro/routes/api/revisions/_revisionId_/index.mjs +2 -2
- package/dist/astro/routes/api/revisions/_revisionId_/restore.mjs +2 -2
- package/dist/astro/routes/api/schema/collections/_slug_/fields/_fieldSlug_.mjs +73 -62
- package/dist/astro/routes/api/schema/collections/_slug_/fields/index.mjs +73 -62
- package/dist/astro/routes/api/schema/collections/_slug_/fields/reorder.mjs +73 -62
- package/dist/astro/routes/api/schema/collections/_slug_/index.mjs +73 -62
- package/dist/astro/routes/api/schema/collections/index.mjs +73 -62
- package/dist/astro/routes/api/schema/index.mjs +13 -10
- package/dist/astro/routes/api/schema/orphans/_slug_.mjs +71 -60
- package/dist/astro/routes/api/schema/orphans/index.mjs +71 -60
- package/dist/astro/routes/api/search/enable.mjs +20 -13
- package/dist/astro/routes/api/search/index.mjs +19 -12
- package/dist/astro/routes/api/search/rebuild.mjs +20 -13
- package/dist/astro/routes/api/search/stats.mjs +12 -7
- package/dist/astro/routes/api/search/suggest.mjs +19 -12
- package/dist/astro/routes/api/sections/_slug_.mjs +57 -44
- package/dist/astro/routes/api/sections/index.mjs +57 -44
- package/dist/astro/routes/api/settings/email.mjs +5 -5
- package/dist/astro/routes/api/settings/reviews.mjs +11 -11
- package/dist/astro/routes/api/settings.mjs +57 -44
- package/dist/astro/routes/api/setup/admin-verify.mjs +19 -14
- package/dist/astro/routes/api/setup/admin.mjs +17 -12
- package/dist/astro/routes/api/setup/dev-bypass.mjs +44 -32
- package/dist/astro/routes/api/setup/dev-reset.mjs +2 -2
- package/dist/astro/routes/api/setup/index.mjs +47 -34
- package/dist/astro/routes/api/setup/status.mjs +3 -3
- package/dist/astro/routes/api/snapshot.mjs +9 -9
- package/dist/astro/routes/api/system/heartbeat.mjs +2 -2
- package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_/translations.mjs +60 -47
- package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_.mjs +60 -47
- package/dist/astro/routes/api/taxonomies/_name_/terms/index.mjs +60 -47
- package/dist/astro/routes/api/taxonomies/index.mjs +60 -47
- package/dist/astro/routes/api/themes/preview.mjs +7 -7
- package/dist/astro/routes/api/typegen.mjs +4 -4
- package/dist/astro/routes/api/well-known/auth.mjs +3 -3
- package/dist/astro/routes/api/well-known/oauth-authorization-server.mjs +3 -3
- package/dist/astro/routes/api/well-known/oauth-protected-resource.mjs +3 -3
- package/dist/astro/routes/api/widget-areas/_name_/reorder.mjs +56 -43
- package/dist/astro/routes/api/widget-areas/_name_/widgets/_id_.mjs +57 -44
- package/dist/astro/routes/api/widget-areas/_name_/widgets.mjs +57 -44
- package/dist/astro/routes/api/widget-areas/_name_.mjs +53 -41
- package/dist/astro/routes/api/widget-areas/index.mjs +57 -44
- package/dist/astro/routes/api/widget-components.mjs +2 -2
- package/dist/astro/routes/robots.txt.mjs +14 -9
- package/dist/astro/routes/sitemap-_collection_.xml.mjs +20 -16
- package/dist/astro/routes/sitemap.xml.mjs +19 -15
- package/dist/astro/session-driver.d.mts +1 -1
- package/dist/astro/session-driver.mjs +8 -3
- package/dist/astro/types.d.mts +21 -14
- package/dist/{atomic-authority-CnBQJ14T.mjs → atomic-authority-Bf5QZboB.mjs} +2 -2
- package/dist/{audit-Cl495Ze3.mjs → audit-hXJBTPY0.mjs} +1 -1
- package/dist/auth/providers/github.d.mts +1 -1
- package/dist/auth/providers/google.d.mts +1 -1
- package/dist/{auth-control-guard-DbjgJdlo.mjs → auth-control-guard-DpUP6Fs_.mjs} +1 -1
- package/dist/{authorize-DDmgmnW-.mjs → authorize-DWNOqMKq.mjs} +1 -1
- package/dist/{briefing-DsD-Ouwc.mjs → briefing-BzvBeIJh.mjs} +1 -1
- package/dist/{briefing-COw-WcYz.mjs → briefing-DYiV93rg.mjs} +995 -7
- package/dist/{bundle-bhiszAui.mjs → bundle-DWn5eFKz.mjs} +2 -2
- package/dist/{byline-TYk2kad6.mjs → byline-3qjp1-oa.mjs} +65 -14
- package/dist/{byline-fields-CKhPED5o.d.mts → byline-fields-Bne2v0ti.d.mts} +42 -38
- package/dist/{byline-fields-BKj5f3Ub.mjs → byline-fields-DRMCc0V_.mjs} +1 -1
- package/dist/{byline-fields-DZ46DF10.mjs → byline-fields-wWu2Cb3l.mjs} +3 -3
- package/dist/{byline-registry-CJihchD1.mjs → byline-registry-Caj0_gbU.mjs} +1 -1
- package/dist/{bylines-6T9iVC9j.mjs → bylines-BSn9O1Wx.mjs} +3 -3
- package/dist/{bylines-CvTSCAw9.mjs → bylines-CGuJi-zu.mjs} +5 -5
- package/dist/{patterns-Ay-4KImK.mjs → cache-DsEbwFVE.mjs} +51 -1
- package/dist/{chunks-C8vSD_5L.mjs → chunks-Bb56aCtB.mjs} +1 -1
- package/dist/cli/index.mjs +488 -58
- package/dist/cli/plugin-kit.d.mts +14 -11
- package/dist/cli/plugin-kit.mjs +2 -2
- package/dist/client/external-auth-headers.d.mts +1 -1
- package/dist/client/index.d.mts +16 -13
- package/dist/client/index.mjs +2 -2
- package/dist/{client-factory-C1ZQCMog.mjs → client-factory-BLbm250o.mjs} +1 -1
- package/dist/{comment-DAQfUjqt.mjs → comment-BWDG1nQm.mjs} +2 -2
- package/dist/{comment-reaction-Dp3G7UZc.mjs → comment-reaction-B7pLTlQ7.mjs} +1 -1
- package/dist/{comments-BrvIaRAx.mjs → comments-xkten8nV.mjs} +1 -1
- package/dist/config-6R0bchVE.mjs +125 -0
- package/dist/{content-CIKsrvU9.mjs → content-BigS8BAv.mjs} +302 -45
- package/dist/content-Dr22fzA_.mjs +390 -0
- package/dist/{content-refresh-BilzqcLt.mjs → content-refresh-DJuFIqQ4.mjs} +14 -8
- package/dist/content-storage/index.d.mts +180 -0
- package/dist/content-storage/index.mjs +29 -0
- package/dist/content-storage/store.d.mts +3 -0
- package/dist/content-storage/store.mjs +5 -0
- package/dist/{review-payload-Bap86e75.mjs → content-write-DAZCNKWl.mjs} +838 -131
- package/dist/{context-DAs_MZjJ.mjs → context-0806nV9h.mjs} +292 -23
- package/dist/{context-DVTvucNb.mjs → context-CCsI5nTK.mjs} +2 -2
- package/dist/{context-route-helpers-BP-UJ4u8.mjs → context-route-helpers-TP3EqxRQ.mjs} +2 -2
- package/dist/{dashboard-BAjWCGCP.mjs → dashboard-CSrnhBO6.mjs} +4 -4
- package/dist/database/batch.d.mts +1 -1
- package/dist/database/batch.mjs +1 -1
- package/dist/database/d1/index.d.mts +14 -11
- package/dist/database/d1/index.mjs +4 -4
- package/dist/database/instrumentation.mjs +3 -2
- package/dist/db/index.d.mts +3 -3
- package/dist/db/index.mjs +1 -1
- package/dist/db/libsql.d.mts +1 -1
- package/dist/db/postgres.d.mts +1 -1
- package/dist/db/sqlite.d.mts +1 -1
- package/dist/{device-flow-Dh0rNlh1.mjs → device-flow-SoZh-HvN.mjs} +3 -3
- package/dist/{discovery-V0e0Gg8j.mjs → discovery-49qXmdwv.mjs} +4 -4
- package/dist/{enrich-B7PIJ8Iy.mjs → enrich-CAMsD1aT.mjs} +1 -1
- package/dist/{error-B5a45Tfb.mjs → error-sL4aemcW.mjs} +2 -0
- package/dist/{evidence-Vnp_fQbC.mjs → evidence-B3O9_VKm.mjs} +7 -7
- package/dist/{field-defs-cache-aXUeXJdC.mjs → field-defs-cache-dn5Tw79A.mjs} +4 -4
- package/dist/{fts-manager-BrPpYtK0.mjs → fts-manager-Zu5ITic0.mjs} +1 -1
- package/dist/{hitl-requests-BxMMON3s.mjs → hitl-requests-B5vOPseK.mjs} +2 -2
- package/dist/{hitl-route-helpers-sdnjpx2k.mjs → hitl-route-helpers-C3icmGdj.mjs} +5 -5
- package/dist/hook-events-BQw73jc7.d.mts +32 -0
- package/dist/{import-C2-v4FCs.mjs → import-CKnKQj3f.mjs} +9 -9
- package/dist/{index-BVGe04wF.d.mts → index-CLj17kW9.d.mts} +12 -5
- package/dist/index.d.mts +19 -16
- package/dist/index.mjs +107 -98
- package/dist/{integration-credentials-DMEXZU2J.mjs → integration-credentials-DpuRw1kx.mjs} +2 -2
- package/dist/{jsonld-XWmmAoVo.d.mts → jsonld-CN91qtDw.d.mts} +2 -2
- package/dist/{load-DvCVppOF.mjs → load-CiRTddkJ.mjs} +1 -1
- package/dist/{loader-Dp6zLmQm.mjs → loader-CCwWFQSh.mjs} +16 -5
- package/dist/{manifest-schema-CCvogfrP.mjs → manifest-schema-DaQpgyTB.mjs} +1 -1
- package/dist/{mcp-reviewed-executor-B8Gbin3T.mjs → mcp-reviewed-executor-DA6Q9sDc.mjs} +6 -6
- package/dist/media/image-endpoint.mjs +1 -1
- package/dist/media/index.d.mts +1 -1
- package/dist/media/index.mjs +2 -2
- package/dist/media/local-runtime.d.mts +16 -13
- package/dist/media/local-runtime.mjs +3 -3
- package/dist/{media-C5ba8fvI.mjs → media-BjH5OD-A.mjs} +1 -1
- package/dist/{media-allowlist-DQvscVkS.mjs → media-allowlist-C8HJ2O61.mjs} +1 -1
- package/dist/{menus-CyNpBQrX.mjs → menus-CbBi7Ad7.mjs} +2 -2
- package/dist/{menus-w5xwT-f5.mjs → menus-D0c8CeVg.mjs} +7 -7
- package/dist/migration-DJuj7ZwN.mjs +526 -0
- package/dist/{migrations-CLlX25HO.mjs → migrations-BAjF60cl.mjs} +1 -1
- package/dist/{oauth-authorization-CdqJZUMf.mjs → oauth-authorization-CSSRMOKn.mjs} +4 -4
- package/dist/{oauth-clients-CHNb9MAZ.mjs → oauth-clients-DX5HIJJv.mjs} +2 -2
- package/dist/object-cache/memory.d.mts +1 -1
- package/dist/{object-cache-mxCW-Rpt.mjs → object-cache-DyI1SOBK.mjs} +3 -1
- package/dist/owned-metadata-BPmUjZqI.mjs +69 -0
- package/dist/page/index.d.mts +15 -12
- package/dist/page/index.mjs +1 -1
- package/dist/{parse-THHCpJLB.mjs → parse-C6kCR1OT.mjs} +1 -1
- package/dist/plugin-utils.d.mts +14 -11
- package/dist/plugins/adapt-sandbox-entry.d.mts +14 -11
- package/dist/plugins/adapt-sandbox-entry.mjs +1 -1
- package/dist/{plugins-pfraURNp.mjs → plugins-V0W65r3v.mjs} +16 -962
- package/dist/{policy-B6mVa7ib.mjs → policy-DbceGc4P.mjs} +2 -2
- package/dist/{preview-Bh7D7F27.mjs → preview-CWiIjMDi.mjs} +2 -2
- package/dist/{provider-loader-DT7vQ5FI.d.mts → provider-loader-oLKm1AU8.d.mts} +1 -1
- package/dist/{public-url-Ccv0Xmue.d.mts → public-url-CEC1vj02.d.mts} +2 -2
- package/dist/{public-url-BvnTaacI.d.mts → public-url-CKrUov8D.d.mts} +1 -1
- package/dist/{publication-authorization-B_HJSnzR.mjs → publication-authorization-wMR-tEQ_.mjs} +43 -17
- package/dist/{query-xspvw7Ui.mjs → query-DDi367tF.mjs} +14 -14
- package/dist/{query-DLeahg3x.mjs → query-DLnnpEuf.mjs} +4 -4
- package/dist/{rate-limit-BsBr_U9g.mjs → rate-limit-DeVLLe4z.mjs} +2 -2
- package/dist/{redirect-BQFa1THe.mjs → redirect-CJ-FAbNK.mjs} +2 -2
- package/dist/{redirects-DJcsgz_X.mjs → redirects-BKi6mek4.mjs} +4 -5
- package/dist/{redirects-CVfxefrz.mjs → redirects-I78-ZYLV.mjs} +5 -386
- package/dist/{registry-Dclv9iHv.mjs → registry-zXXZezu-.mjs} +7 -7
- package/dist/{release-B3Q-9B7N.mjs → release-Cpi0-Bzq.mjs} +173 -22
- package/dist/request-context.d.mts +30 -0
- package/dist/{request-meta-CjORiJQ_.mjs → request-meta-DZYuLXx_.mjs} +1 -1
- package/dist/review-payload-Bhi52CbI.mjs +112 -0
- package/dist/{review-requests-CcSUTm_l.mjs → review-requests-C-ScxD9n.mjs} +2 -2
- package/dist/{review-requests-CUVn0RBl.mjs → review-requests-DZYM51yI.mjs} +2 -2
- package/dist/{review-route-helpers-CKBfGKCi.mjs → review-route-helpers-DXNDyx_q.mjs} +2 -2
- package/dist/{revision-W6FDfDqx.mjs → revision-B_HYO2AE.mjs} +42 -7
- package/dist/revisions-CQ7rMP5d.mjs +55 -0
- package/dist/{revocation-C_ZQvGRT.mjs → revocation-4we8kfBg.mjs} +2 -2
- package/dist/{runner-CRU7BXjr.mjs → runner-CuG8o1uW.mjs} +558 -487
- package/dist/{runner-SoP1rphP.d.mts → runner-DXQkyPeX.d.mts} +1 -1
- package/dist/{runs-BtaAiLTw.mjs → runs-BjgLfqCn.mjs} +5 -5
- package/dist/runtime-Bs2JMbb2.d.mts +45 -0
- package/dist/runtime-Ch5G-tnG.mjs +400 -0
- package/dist/runtime.d.mts +15 -12
- package/dist/runtime.mjs +9 -4
- package/dist/schema-BA05k0TN.mjs +8 -0
- package/dist/{search-BI9uKr7U.mjs → search-DMrzhfx_.mjs} +4 -98
- package/dist/{secrets-D_pergcD.mjs → secrets-CIYcw9T9.mjs} +4 -4
- package/dist/{sections-BqqYq9RW.mjs → sections-BTrSEhqB.mjs} +2 -2
- package/dist/seed/index.d.mts +2 -2
- package/dist/seed/index.mjs +38 -26
- package/dist/seo/index.d.mts +3 -3
- package/dist/seo/index.mjs +12 -9
- package/dist/{seo-Bs_DUxJf.mjs → seo-Cv7ud_m2.mjs} +44 -5
- package/dist/{seo-B-5PsaJO.mjs → seo-DkjtBh-y.mjs} +1 -1
- package/dist/{service-W2xuGLgw.mjs → service-BBJM08uD.mjs} +2 -2
- package/dist/{service-B65aJsN7.mjs → service-CkMuD5AE.mjs} +3 -3
- package/dist/{settings-DsBzKeUQ.mjs → settings-BUONaNnG.mjs} +7 -7
- package/dist/{settings-CyJ2-MKx.mjs → settings-CI-NtWEc.mjs} +2 -2
- package/dist/{setup-complete-DeivSVJi.mjs → setup-complete-DoVbVrHx.mjs} +1 -1
- package/dist/{site-activity-DU0UPDji.mjs → site-activity-hpfJkmxQ.mjs} +1 -1
- package/dist/{site-context-Dic2jHuw.mjs → site-context-BW3GRCJH.mjs} +15 -15
- package/dist/{site-url-Tw6CfBB2.mjs → site-url-CYatfe3q.mjs} +1 -1
- package/dist/{state-DM7blWfT.mjs → state-CKkqoA6i.mjs} +1 -1
- package/dist/storage/local.d.mts +1 -1
- package/dist/storage/local.mjs +1 -1
- package/dist/storage/s3.d.mts +1 -1
- package/dist/storage/s3.mjs +2 -2
- package/dist/{store-32e6dfD-.mjs → store-BzaAtszy.mjs} +3 -3
- package/dist/submission-DLgjQ_Ew.mjs +205 -0
- package/dist/{taxonomies-BFsUR7kc.mjs → taxonomies-C02-Vuh3.mjs} +3 -3
- package/dist/{taxonomies-lWGNLKgn.mjs → taxonomies-D5wO9zmB.mjs} +7 -7
- package/dist/{taxonomy-DN6i1upz.mjs → taxonomy-BK7JmHlo.mjs} +53 -3
- package/dist/terms-EskuqbKE.mjs +104 -0
- package/dist/text-extraction-CdqMGYQK.mjs +96 -0
- package/dist/{tokens-D-StaTAQ.mjs → tokens-D8HEH277.mjs} +1 -1
- package/dist/{trusted-proxy-hYufGFPK.mjs → trusted-proxy-Dg3U9Lrv.mjs} +1 -1
- package/dist/{types-RFzE_V1M.mjs → types-BI3ULB3A.mjs} +2 -2
- package/dist/{types-CJynaYg1.d.mts → types-C3jUu4Bc.d.mts} +90 -34
- package/dist/{types-B--VyN3n.d.mts → types-Dpv_MvwZ.d.mts} +1 -1
- package/dist/{types-CgcOeaiQ.d.mts → types-ex-UrNlz.d.mts} +1 -1
- package/dist/types-qOEot0UQ.d.mts +83 -0
- package/dist/ui/server-runtime.d.mts +18 -15
- package/dist/ui/server-runtime.mjs +29 -25
- package/dist/{user-Btai9rl3.mjs → user-Bl2_8rhJ.mjs} +2 -2
- package/dist/{utils-CYxGuO_P.mjs → utils-CklSLz9F.mjs} +2 -2
- package/dist/{validate-C05z0m7M.mjs → validate-C-yk7mmX.mjs} +3 -3
- package/dist/{validate-kmN2lS8H.d.mts → validate-DUscf6VG.d.mts} +3 -3
- package/dist/version-BlE1LEPb.mjs +6 -0
- package/dist/version-store-BXv2D0de.mjs +208 -0
- package/dist/version-store-B_THJCc0.d.mts +98 -0
- package/dist/{widgets-BOrDZdQ3.mjs → widgets-9xHBhL_L.mjs} +3 -3
- package/dist/{wordpress-slugs-ROzITIBK.mjs → wordpress-slugs-yaeD7cxn.mjs} +1 -1
- package/dist/{worker-Bg35R37I.mjs → worker-CC_Rt1pB.mjs} +10 -10
- package/dist/write-intent-DuHVqks9.mjs +108 -0
- package/dist/{zod-generator-DkrWuID7.mjs → zod-generator-B5Pt8fv0.mjs} +2 -2
- package/package.json +16 -4
- package/dist/cache-B5NSHhxG.mjs +0 -52
- package/dist/cron-C7HCJPPl.mjs +0 -271
- package/dist/schema-CosVhHJt.mjs +0 -8
- package/dist/submission-DJmRejGR.mjs +0 -411
- package/dist/version-BnLdwIT1.mjs +0 -6
- /package/dist/{actor-DxUAJgQX.mjs → actor-D0AW80ld.mjs} +0 -0
- /package/dist/{adapter-symbols-Bq3JsWGM.d.mts → adapter-symbols-B9mi-BUh.d.mts} +0 -0
- /package/dist/{adapters-C8nRpUuj.d.mts → adapters-lDnJjNDz.d.mts} +0 -0
- /package/dist/{api-tokens-0N3nafqZ.mjs → api-tokens-CdfsE9PL.mjs} +0 -0
- /package/dist/{base64-Cz-aU0X1.mjs → base64-qvSs0Gxy.mjs} +0 -0
- /package/dist/{challenge-store-BPn3goP9.mjs → challenge-store-7IZ_NqWg.mjs} +0 -0
- /package/dist/{components-rFN8NH3N.mjs → components-JA6tFHmE.mjs} +0 -0
- /package/dist/{context-types-CPWAJRs5.mjs → context-types-DDIJhGLs.mjs} +0 -0
- /package/dist/{default-BS6VQRkB.mjs → default-C2azCFSB.mjs} +0 -0
- /package/dist/{email-console-GqK6hgMJ.mjs → email-console-BYQp_5Qr.mjs} +0 -0
- /package/dist/{escape-CE7xOWzJ.mjs → escape-4_NNa6GR.mjs} +0 -0
- /package/dist/{experimental-workflows-BbxpWwBy.mjs → experimental-workflows-CPNiI2EL.mjs} +0 -0
- /package/dist/{forgeway-account-DcTxh3Gw.mjs → forgeway-account-YzraapbX.mjs} +0 -0
- /package/dist/{hash-D2Rqd2J2.mjs → hash-qSYPMJ8w.mjs} +0 -0
- /package/dist/{media-url-D9kdpoLS.mjs → media-url-D5E1a47B.mjs} +0 -0
- /package/dist/{mime-BnVhH671.mjs → mime-FkfazULS.mjs} +0 -0
- /package/dist/{mode-D0gePRtf.mjs → mode-C3RI5Z5t.mjs} +0 -0
- /package/dist/{normalize-aTwryvvi.mjs → normalize-DrmlLn40.mjs} +0 -0
- /package/dist/{oauth-authority-P5YMSk2z.mjs → oauth-authority-DVlLFhsZ.mjs} +0 -0
- /package/dist/{oauth-state-store-CMqLdo4I.mjs → oauth-state-store-nf-78RbK.mjs} +0 -0
- /package/dist/{options-JiLWB6Bt.mjs → options-yFkLUuTw.mjs} +0 -0
- /package/dist/{output-7HDrYTSQ.mjs → output-ljHaxIHX.mjs} +0 -0
- /package/dist/{parser-kettsjWc.mjs → parser-CTlxybRo.mjs} +0 -0
- /package/dist/{passkey-config-DVzQ3dv3.mjs → passkey-config-BLon3ct9.mjs} +0 -0
- /package/dist/{placeholder-DJLP_HY7.d.mts → placeholder-DdZV3I8x.d.mts} +0 -0
- /package/dist/{portable-text-tQhvPLf1.mjs → portable-text-CSbRjM-T.mjs} +0 -0
- /package/dist/{portable-text-BE7nszX6.d.mts → portable-text-HNmwL-7L.d.mts} +0 -0
- /package/dist/{process-cache-C19OA3am.mjs → process-cache-CMy5M80h.mjs} +0 -0
- /package/dist/{provider-loader-DERzBMUz.mjs → provider-loader-DlaT1usE.mjs} +0 -0
- /package/dist/{public-discovery-BGyhuD5U.mjs → public-discovery-BnqYofSK.mjs} +0 -0
- /package/dist/{public-url-DFXUU6Wp.mjs → public-url-BHjYWuaN.mjs} +0 -0
- /package/dist/{public-url-sR8SVmTt.mjs → public-url-GQygrYmg.mjs} +0 -0
- /package/dist/{redirect-BxacnBYL.mjs → redirect-CokmLN5o.mjs} +0 -0
- /package/dist/{request-cache-8_ifFzVw.mjs → request-cache-CizvDoxV.mjs} +0 -0
- /package/dist/{resolve-DEKC4qVa.mjs → resolve-BxFGSKYu.mjs} +0 -0
- /package/dist/{runtime-env-CPTzh0mZ.mjs → runtime-env-DpYGy4pT.mjs} +0 -0
- /package/dist/{scheduled-publish-BxdShRGs.d.mts → scheduled-publish-eCNGpvNm.d.mts} +0 -0
- /package/dist/{seo-contributions-LEFs1d7w.mjs → seo-contributions-ZKqrqsdT.mjs} +0 -0
- /package/dist/{service-kQ5ljRzX.mjs → service-DeX1PRNt.mjs} +0 -0
- /package/dist/{session-user-eweCNKzW.mjs → session-user-D36BRaZY.mjs} +0 -0
- /package/dist/{setup-nonce-B6A5Y1ea.mjs → setup-nonce-B9IO7PbK.mjs} +0 -0
- /package/dist/{sidecar-client-BwPhhz-F.mjs → sidecar-client-2hx5G46s.mjs} +0 -0
- /package/dist/{slugify-kD31VIv2.mjs → slugify-DvoaEPtL.mjs} +0 -0
- /package/dist/{ssrf-C9dyjU8O.mjs → ssrf-DcD8vn3E.mjs} +0 -0
- /package/dist/{stable-hash-B9Tbb2f_.mjs → stable-hash-9RDJgfif.mjs} +0 -0
- /package/dist/{status-Bjf_uSrW.mjs → status-B2xUokyJ.mjs} +0 -0
- /package/dist/{transport-BrU1aDY5.mjs → transport-BHYE4pox.mjs} +0 -0
- /package/dist/{transport-CZbtxgKZ.d.mts → transport-CVU5rp7W.d.mts} +0 -0
- /package/dist/{types-DNBL-4Sn.mjs → types-B3Uq7Czg.mjs} +0 -0
- /package/dist/{types-DsJTXStN.d.mts → types-BJztoTbF.d.mts} +0 -0
- /package/dist/{types-COvyXIp7.mjs → types-BgUxCuwu.mjs} +0 -0
- /package/dist/{types-KFzuijKE.d.mts → types-C0heD9oI.d.mts} +0 -0
- /package/dist/{types-B03h5jt_.d.mts → types-DheoByey.d.mts} +0 -0
- /package/dist/{types-SlLXjRpg.d.mts → types-I5LHzk_M.d.mts} +0 -0
- /package/dist/{types-PLJ9hlhh.mjs → types-Nm0cMxEh.mjs} +0 -0
- /package/dist/{types-CtGSEKEJ.d.mts → types-PxxPTFSl.d.mts} +0 -0
- /package/dist/{url-DGG3hw_h.mjs → url-Coamqvs4.mjs} +0 -0
- /package/dist/{url-DUz3LbCs.mjs → url-dn4mFfCI.mjs} +0 -0
- /package/dist/{workers-build-5UQ4j69Q.mjs → workers-build-4926MPc0.mjs} +0 -0
|
@@ -110,8 +110,8 @@ async function migrateD1(db, table, migrations, options = {}) {
|
|
|
110
110
|
//#endregion
|
|
111
111
|
//#region src/database/migrations/001_initial.ts
|
|
112
112
|
var _001_initial_exports = /* @__PURE__ */ __exportAll({
|
|
113
|
-
down: () => down$
|
|
114
|
-
up: () => up$
|
|
113
|
+
down: () => down$122,
|
|
114
|
+
up: () => up$122
|
|
115
115
|
});
|
|
116
116
|
/**
|
|
117
117
|
* Initial schema migration
|
|
@@ -120,7 +120,7 @@ var _001_initial_exports = /* @__PURE__ */ __exportAll({
|
|
|
120
120
|
* by the SchemaRegistry when collections are added via the admin UI.
|
|
121
121
|
* This migration only creates system tables.
|
|
122
122
|
*/
|
|
123
|
-
async function up$
|
|
123
|
+
async function up$122(db) {
|
|
124
124
|
await db.schema.createTable("revisions").ifNotExists().addColumn("id", "text", (col) => col.primaryKey()).addColumn("collection", "text", (col) => col.notNull()).addColumn("entry_id", "text", (col) => col.notNull()).addColumn("data", "text", (col) => col.notNull()).addColumn("author_id", "text").addColumn("created_at", "text", (col) => col.defaultTo(currentTimestamp$1(db))).execute();
|
|
125
125
|
await db.schema.createIndex("idx_revisions_entry").ifNotExists().on("revisions").columns(["collection", "entry_id"]).execute();
|
|
126
126
|
await db.schema.createTable("taxonomies").ifNotExists().addColumn("id", "text", (col) => col.primaryKey()).addColumn("name", "text", (col) => col.notNull()).addColumn("slug", "text", (col) => col.notNull()).addColumn("label", "text", (col) => col.notNull()).addColumn("parent_id", "text").addColumn("data", "text").addUniqueConstraint("taxonomies_name_slug_unique", ["name", "slug"]).addForeignKeyConstraint("taxonomies_parent_fk", ["parent_id"], "taxonomies", ["id"], (cb) => cb.onDelete("set null")).execute();
|
|
@@ -140,7 +140,7 @@ async function up$121(db) {
|
|
|
140
140
|
await db.schema.createIndex("idx_audit_action").ifNotExists().on("audit_logs").column("action").execute();
|
|
141
141
|
await db.schema.createIndex("idx_audit_timestamp").ifNotExists().on("audit_logs").column("timestamp").execute();
|
|
142
142
|
}
|
|
143
|
-
async function down$
|
|
143
|
+
async function down$122(db) {
|
|
144
144
|
await db.schema.dropTable("audit_logs").execute();
|
|
145
145
|
await db.schema.dropTable("options").execute();
|
|
146
146
|
await db.schema.dropTable("users").execute();
|
|
@@ -153,26 +153,26 @@ async function down$121(db) {
|
|
|
153
153
|
//#endregion
|
|
154
154
|
//#region src/database/migrations/002_media_status.ts
|
|
155
155
|
var _002_media_status_exports = /* @__PURE__ */ __exportAll({
|
|
156
|
-
down: () => down$
|
|
157
|
-
up: () => up$
|
|
156
|
+
down: () => down$121,
|
|
157
|
+
up: () => up$121
|
|
158
158
|
});
|
|
159
159
|
/**
|
|
160
160
|
* Add status column to media table for tracking upload state.
|
|
161
161
|
* Status values: 'pending' | 'ready' | 'failed'
|
|
162
162
|
*/
|
|
163
|
-
async function up$
|
|
163
|
+
async function up$121(db) {
|
|
164
164
|
await db.schema.alterTable("media").addColumn("status", "text", (col) => col.notNull().defaultTo("ready")).execute();
|
|
165
165
|
await db.schema.createIndex("idx_media_status").on("media").column("status").execute();
|
|
166
166
|
}
|
|
167
|
-
async function down$
|
|
167
|
+
async function down$121(db) {
|
|
168
168
|
await db.schema.dropIndex("idx_media_status").execute();
|
|
169
169
|
}
|
|
170
170
|
|
|
171
171
|
//#endregion
|
|
172
172
|
//#region src/database/migrations/003_schema_registry.ts
|
|
173
173
|
var _003_schema_registry_exports = /* @__PURE__ */ __exportAll({
|
|
174
|
-
down: () => down$
|
|
175
|
-
up: () => up$
|
|
174
|
+
down: () => down$120,
|
|
175
|
+
up: () => up$120
|
|
176
176
|
});
|
|
177
177
|
/**
|
|
178
178
|
* Migration: Schema Registry Tables
|
|
@@ -180,14 +180,14 @@ var _003_schema_registry_exports = /* @__PURE__ */ __exportAll({
|
|
|
180
180
|
* Creates the schema registry tables that store collection and field definitions.
|
|
181
181
|
* This enables dynamic schema management where the database is the source of truth.
|
|
182
182
|
*/
|
|
183
|
-
async function up$
|
|
183
|
+
async function up$120(db) {
|
|
184
184
|
await db.schema.createTable("_dineway_collections").addColumn("id", "text", (col) => col.primaryKey()).addColumn("slug", "text", (col) => col.notNull().unique()).addColumn("label", "text", (col) => col.notNull()).addColumn("label_singular", "text").addColumn("description", "text").addColumn("icon", "text").addColumn("supports", "text").addColumn("source", "text").addColumn("created_at", "text", (col) => col.defaultTo(currentTimestamp$1(db))).addColumn("updated_at", "text", (col) => col.defaultTo(currentTimestamp$1(db))).execute();
|
|
185
185
|
await db.schema.createTable("_dineway_fields").addColumn("id", "text", (col) => col.primaryKey()).addColumn("collection_id", "text", (col) => col.notNull()).addColumn("slug", "text", (col) => col.notNull()).addColumn("label", "text", (col) => col.notNull()).addColumn("type", "text", (col) => col.notNull()).addColumn("column_type", "text", (col) => col.notNull()).addColumn("required", "integer", (col) => col.defaultTo(0)).addColumn("unique", "integer", (col) => col.defaultTo(0)).addColumn("default_value", "text").addColumn("validation", "text").addColumn("widget", "text").addColumn("options", "text").addColumn("sort_order", "integer", (col) => col.defaultTo(0)).addColumn("created_at", "text", (col) => col.defaultTo(currentTimestamp$1(db))).addForeignKeyConstraint("fields_collection_fk", ["collection_id"], "_dineway_collections", ["id"], (cb) => cb.onDelete("cascade")).execute();
|
|
186
186
|
await db.schema.createIndex("idx_fields_collection_slug").on("_dineway_fields").columns(["collection_id", "slug"]).unique().execute();
|
|
187
187
|
await db.schema.createIndex("idx_fields_collection").on("_dineway_fields").column("collection_id").execute();
|
|
188
188
|
await db.schema.createIndex("idx_fields_sort").on("_dineway_fields").columns(["collection_id", "sort_order"]).execute();
|
|
189
189
|
}
|
|
190
|
-
async function down$
|
|
190
|
+
async function down$120(db) {
|
|
191
191
|
await db.schema.dropTable("_dineway_fields").execute();
|
|
192
192
|
await db.schema.dropTable("_dineway_collections").execute();
|
|
193
193
|
}
|
|
@@ -195,8 +195,8 @@ async function down$119(db) {
|
|
|
195
195
|
//#endregion
|
|
196
196
|
//#region src/database/migrations/004_plugins.ts
|
|
197
197
|
var _004_plugins_exports = /* @__PURE__ */ __exportAll({
|
|
198
|
-
down: () => down$
|
|
199
|
-
up: () => up$
|
|
198
|
+
down: () => down$119,
|
|
199
|
+
up: () => up$119
|
|
200
200
|
});
|
|
201
201
|
/**
|
|
202
202
|
* Migration: Plugin System Tables
|
|
@@ -206,7 +206,7 @@ var _004_plugins_exports = /* @__PURE__ */ __exportAll({
|
|
|
206
206
|
*
|
|
207
207
|
* @see PLUGIN-SYSTEM.md § Plugin Storage
|
|
208
208
|
*/
|
|
209
|
-
async function up$
|
|
209
|
+
async function up$119(db) {
|
|
210
210
|
await db.schema.createTable("_plugin_storage").addColumn("plugin_id", "text", (col) => col.notNull()).addColumn("collection", "text", (col) => col.notNull()).addColumn("id", "text", (col) => col.notNull()).addColumn("data", "text", (col) => col.notNull()).addColumn("created_at", "text", (col) => col.defaultTo(currentTimestamp$1(db))).addColumn("updated_at", "text", (col) => col.defaultTo(currentTimestamp$1(db))).addPrimaryKeyConstraint("pk_plugin_storage", [
|
|
211
211
|
"plugin_id",
|
|
212
212
|
"collection",
|
|
@@ -224,7 +224,7 @@ async function up$118(db) {
|
|
|
224
224
|
"index_name"
|
|
225
225
|
]).execute();
|
|
226
226
|
}
|
|
227
|
-
async function down$
|
|
227
|
+
async function down$119(db) {
|
|
228
228
|
await db.schema.dropTable("_plugin_indexes").execute();
|
|
229
229
|
await db.schema.dropTable("_plugin_state").execute();
|
|
230
230
|
await db.schema.dropTable("_plugin_storage").execute();
|
|
@@ -233,8 +233,8 @@ async function down$118(db) {
|
|
|
233
233
|
//#endregion
|
|
234
234
|
//#region src/database/migrations/005_menus.ts
|
|
235
235
|
var _005_menus_exports = /* @__PURE__ */ __exportAll({
|
|
236
|
-
down: () => down$
|
|
237
|
-
up: () => up$
|
|
236
|
+
down: () => down$118,
|
|
237
|
+
up: () => up$118
|
|
238
238
|
});
|
|
239
239
|
/**
|
|
240
240
|
* Navigation Menus migration
|
|
@@ -242,13 +242,13 @@ var _005_menus_exports = /* @__PURE__ */ __exportAll({
|
|
|
242
242
|
* Creates tables for admin-editable navigation menus.
|
|
243
243
|
* Menu items can reference content entries, taxonomy terms, or custom URLs.
|
|
244
244
|
*/
|
|
245
|
-
async function up$
|
|
245
|
+
async function up$118(db) {
|
|
246
246
|
await db.schema.createTable("_dineway_menus").addColumn("id", "text", (col) => col.primaryKey()).addColumn("name", "text", (col) => col.notNull().unique()).addColumn("label", "text", (col) => col.notNull()).addColumn("created_at", "text", (col) => col.defaultTo(currentTimestamp$1(db))).addColumn("updated_at", "text", (col) => col.defaultTo(currentTimestamp$1(db))).execute();
|
|
247
247
|
await db.schema.createTable("_dineway_menu_items").addColumn("id", "text", (col) => col.primaryKey()).addColumn("menu_id", "text", (col) => col.notNull()).addColumn("parent_id", "text").addColumn("sort_order", "integer", (col) => col.notNull().defaultTo(0)).addColumn("type", "text", (col) => col.notNull()).addColumn("reference_collection", "text").addColumn("reference_id", "text").addColumn("custom_url", "text").addColumn("label", "text", (col) => col.notNull()).addColumn("title_attr", "text").addColumn("target", "text").addColumn("css_classes", "text").addColumn("created_at", "text", (col) => col.defaultTo(currentTimestamp$1(db))).addForeignKeyConstraint("menu_items_menu_fk", ["menu_id"], "_dineway_menus", ["id"], (cb) => cb.onDelete("cascade")).addForeignKeyConstraint("menu_items_parent_fk", ["parent_id"], "_dineway_menu_items", ["id"], (cb) => cb.onDelete("cascade")).execute();
|
|
248
248
|
await db.schema.createIndex("idx_menu_items_menu").on("_dineway_menu_items").columns(["menu_id", "sort_order"]).execute();
|
|
249
249
|
await db.schema.createIndex("idx_menu_items_parent").on("_dineway_menu_items").column("parent_id").execute();
|
|
250
250
|
}
|
|
251
|
-
async function down$
|
|
251
|
+
async function down$118(db) {
|
|
252
252
|
await db.schema.dropTable("_dineway_menu_items").execute();
|
|
253
253
|
await db.schema.dropTable("_dineway_menus").execute();
|
|
254
254
|
}
|
|
@@ -256,8 +256,8 @@ async function down$117(db) {
|
|
|
256
256
|
//#endregion
|
|
257
257
|
//#region src/database/migrations/006_taxonomy_defs.ts
|
|
258
258
|
var _006_taxonomy_defs_exports = /* @__PURE__ */ __exportAll({
|
|
259
|
-
down: () => down$
|
|
260
|
-
up: () => up$
|
|
259
|
+
down: () => down$117,
|
|
260
|
+
up: () => up$117
|
|
261
261
|
});
|
|
262
262
|
/**
|
|
263
263
|
* Taxonomy definitions migration
|
|
@@ -265,7 +265,7 @@ var _006_taxonomy_defs_exports = /* @__PURE__ */ __exportAll({
|
|
|
265
265
|
* Adds _dineway_taxonomy_defs table to store taxonomy definitions (category, tag, custom)
|
|
266
266
|
* and seeds default category and tag taxonomies.
|
|
267
267
|
*/
|
|
268
|
-
async function up$
|
|
268
|
+
async function up$117(db) {
|
|
269
269
|
await db.schema.createTable("_dineway_taxonomy_defs").addColumn("id", "text", (col) => col.primaryKey()).addColumn("name", "text", (col) => col.notNull().unique()).addColumn("label", "text", (col) => col.notNull()).addColumn("label_singular", "text").addColumn("hierarchical", "integer", (col) => col.defaultTo(0)).addColumn("collections", "text").addColumn("created_at", "text", (col) => col.defaultTo(currentTimestamp$1(db))).execute();
|
|
270
270
|
await db.insertInto("_dineway_taxonomy_defs").values([{
|
|
271
271
|
id: "taxdef_category",
|
|
@@ -283,22 +283,22 @@ async function up$116(db) {
|
|
|
283
283
|
collections: JSON.stringify(["posts"])
|
|
284
284
|
}]).execute();
|
|
285
285
|
}
|
|
286
|
-
async function down$
|
|
286
|
+
async function down$117(db) {
|
|
287
287
|
await db.schema.dropTable("_dineway_taxonomy_defs").execute();
|
|
288
288
|
}
|
|
289
289
|
|
|
290
290
|
//#endregion
|
|
291
291
|
//#region src/database/migrations/007_widgets.ts
|
|
292
292
|
var _007_widgets_exports = /* @__PURE__ */ __exportAll({
|
|
293
|
-
down: () => down$
|
|
294
|
-
up: () => up$
|
|
293
|
+
down: () => down$116,
|
|
294
|
+
up: () => up$116
|
|
295
295
|
});
|
|
296
|
-
async function up$
|
|
296
|
+
async function up$116(db) {
|
|
297
297
|
await db.schema.createTable("_dineway_widget_areas").addColumn("id", "text", (col) => col.primaryKey()).addColumn("name", "text", (col) => col.notNull().unique()).addColumn("label", "text", (col) => col.notNull()).addColumn("description", "text").addColumn("created_at", "text", (col) => col.defaultTo(sql`CURRENT_TIMESTAMP`)).execute();
|
|
298
298
|
await db.schema.createTable("_dineway_widgets").addColumn("id", "text", (col) => col.primaryKey()).addColumn("area_id", "text", (col) => col.notNull().references("_dineway_widget_areas.id").onDelete("cascade")).addColumn("sort_order", "integer", (col) => col.notNull().defaultTo(0)).addColumn("type", "text", (col) => col.notNull()).addColumn("title", "text").addColumn("content", "text").addColumn("menu_name", "text").addColumn("component_id", "text").addColumn("component_props", "text").addColumn("created_at", "text", (col) => col.defaultTo(sql`CURRENT_TIMESTAMP`)).execute();
|
|
299
299
|
await db.schema.createIndex("idx_widgets_area").on("_dineway_widgets").columns(["area_id", "sort_order"]).execute();
|
|
300
300
|
}
|
|
301
|
-
async function down$
|
|
301
|
+
async function down$116(db) {
|
|
302
302
|
await db.schema.dropTable("_dineway_widgets").execute();
|
|
303
303
|
await db.schema.dropTable("_dineway_widget_areas").execute();
|
|
304
304
|
}
|
|
@@ -306,8 +306,8 @@ async function down$115(db) {
|
|
|
306
306
|
//#endregion
|
|
307
307
|
//#region src/database/migrations/008_auth.ts
|
|
308
308
|
var _008_auth_exports = /* @__PURE__ */ __exportAll({
|
|
309
|
-
down: () => down$
|
|
310
|
-
up: () => up$
|
|
309
|
+
down: () => down$115,
|
|
310
|
+
up: () => up$115
|
|
311
311
|
});
|
|
312
312
|
/**
|
|
313
313
|
* Auth migration - passkey-first authentication
|
|
@@ -321,7 +321,7 @@ var _008_auth_exports = /* @__PURE__ */ __exportAll({
|
|
|
321
321
|
* - Creates oauth_accounts table (external provider links)
|
|
322
322
|
* - Creates allowed_domains table (self-signup)
|
|
323
323
|
*/
|
|
324
|
-
async function up$
|
|
324
|
+
async function up$115(db) {
|
|
325
325
|
await db.schema.createTable("users_new").addColumn("id", "text", (col) => col.primaryKey()).addColumn("email", "text", (col) => col.notNull().unique()).addColumn("name", "text").addColumn("avatar_url", "text").addColumn("role", "integer", (col) => col.notNull().defaultTo(10)).addColumn("email_verified", "integer", (col) => col.notNull().defaultTo(0)).addColumn("data", "text").addColumn("created_at", "text", (col) => col.defaultTo(currentTimestamp$1(db))).addColumn("updated_at", "text", (col) => col.defaultTo(currentTimestamp$1(db))).execute();
|
|
326
326
|
await sql`
|
|
327
327
|
INSERT INTO users_new (id, email, name, role, data, created_at, updated_at)
|
|
@@ -354,7 +354,7 @@ async function up$114(db) {
|
|
|
354
354
|
await db.schema.createTable("auth_challenges").addColumn("challenge", "text", (col) => col.primaryKey()).addColumn("type", "text", (col) => col.notNull()).addColumn("user_id", "text").addColumn("data", "text").addColumn("expires_at", "text", (col) => col.notNull()).addColumn("created_at", "text", (col) => col.defaultTo(currentTimestamp$1(db))).execute();
|
|
355
355
|
await db.schema.createIndex("idx_auth_challenges_expires").on("auth_challenges").column("expires_at").execute();
|
|
356
356
|
}
|
|
357
|
-
async function down$
|
|
357
|
+
async function down$115(db) {
|
|
358
358
|
await db.schema.dropTable("auth_challenges").execute();
|
|
359
359
|
await db.schema.dropTable("allowed_domains").execute();
|
|
360
360
|
await db.schema.dropTable("oauth_accounts").execute();
|
|
@@ -387,8 +387,8 @@ async function down$114(db) {
|
|
|
387
387
|
//#endregion
|
|
388
388
|
//#region src/database/migrations/009_user_disabled.ts
|
|
389
389
|
var _009_user_disabled_exports = /* @__PURE__ */ __exportAll({
|
|
390
|
-
down: () => down$
|
|
391
|
-
up: () => up$
|
|
390
|
+
down: () => down$114,
|
|
391
|
+
up: () => up$114
|
|
392
392
|
});
|
|
393
393
|
/**
|
|
394
394
|
* User disabled column - for soft-disabling users
|
|
@@ -397,19 +397,19 @@ var _009_user_disabled_exports = /* @__PURE__ */ __exportAll({
|
|
|
397
397
|
* - Adds disabled column to users table (INTEGER, default 0)
|
|
398
398
|
* - Disabled users cannot log in
|
|
399
399
|
*/
|
|
400
|
-
async function up$
|
|
400
|
+
async function up$114(db) {
|
|
401
401
|
await sql`ALTER TABLE users ADD COLUMN disabled INTEGER NOT NULL DEFAULT 0`.execute(db);
|
|
402
402
|
await db.schema.createIndex("idx_users_disabled").on("users").column("disabled").execute();
|
|
403
403
|
}
|
|
404
|
-
async function down$
|
|
404
|
+
async function down$114(db) {
|
|
405
405
|
await db.schema.dropIndex("idx_users_disabled").execute();
|
|
406
406
|
}
|
|
407
407
|
|
|
408
408
|
//#endregion
|
|
409
409
|
//#region src/database/migrations/011_sections.ts
|
|
410
410
|
var _011_sections_exports = /* @__PURE__ */ __exportAll({
|
|
411
|
-
down: () => down$
|
|
412
|
-
up: () => up$
|
|
411
|
+
down: () => down$113,
|
|
412
|
+
up: () => up$113
|
|
413
413
|
});
|
|
414
414
|
/**
|
|
415
415
|
* Migration: Add sections tables and performance indexes
|
|
@@ -418,13 +418,13 @@ var _011_sections_exports = /* @__PURE__ */ __exportAll({
|
|
|
418
418
|
* They provide a library of pre-built page sections (heroes, CTAs, testimonials, etc.)
|
|
419
419
|
* that content authors can browse and insert with a single click.
|
|
420
420
|
*/
|
|
421
|
-
async function up$
|
|
421
|
+
async function up$113(db) {
|
|
422
422
|
await db.schema.createTable("_dineway_section_categories").addColumn("id", "text", (col) => col.primaryKey()).addColumn("slug", "text", (col) => col.notNull().unique()).addColumn("label", "text", (col) => col.notNull()).addColumn("sort_order", "integer", (col) => col.defaultTo(0)).addColumn("created_at", "text", (col) => col.defaultTo(sql`CURRENT_TIMESTAMP`)).execute();
|
|
423
423
|
await db.schema.createTable("_dineway_sections").addColumn("id", "text", (col) => col.primaryKey()).addColumn("slug", "text", (col) => col.notNull().unique()).addColumn("title", "text", (col) => col.notNull()).addColumn("description", "text").addColumn("category_id", "text", (col) => col.references("_dineway_section_categories.id").onDelete("set null")).addColumn("keywords", "text").addColumn("content", "text", (col) => col.notNull()).addColumn("preview_media_id", "text").addColumn("source", "text", (col) => col.notNull().defaultTo("user")).addColumn("theme_id", "text").addColumn("created_at", "text", (col) => col.defaultTo(sql`CURRENT_TIMESTAMP`)).addColumn("updated_at", "text", (col) => col.defaultTo(sql`CURRENT_TIMESTAMP`)).execute();
|
|
424
424
|
await db.schema.createIndex("idx_sections_category").on("_dineway_sections").columns(["category_id"]).execute();
|
|
425
425
|
await db.schema.createIndex("idx_sections_source").on("_dineway_sections").columns(["source"]).execute();
|
|
426
426
|
}
|
|
427
|
-
async function down$
|
|
427
|
+
async function down$113(db) {
|
|
428
428
|
await db.schema.dropIndex("idx_sections_source").execute();
|
|
429
429
|
await db.schema.dropIndex("idx_sections_category").execute();
|
|
430
430
|
await db.schema.dropTable("_dineway_sections").execute();
|
|
@@ -434,8 +434,8 @@ async function down$112(db) {
|
|
|
434
434
|
//#endregion
|
|
435
435
|
//#region src/database/migrations/012_search.ts
|
|
436
436
|
var _012_search_exports = /* @__PURE__ */ __exportAll({
|
|
437
|
-
down: () => down$
|
|
438
|
-
up: () => up$
|
|
437
|
+
down: () => down$112,
|
|
438
|
+
up: () => up$112
|
|
439
439
|
});
|
|
440
440
|
/**
|
|
441
441
|
* Migration: Search Support
|
|
@@ -443,11 +443,11 @@ var _012_search_exports = /* @__PURE__ */ __exportAll({
|
|
|
443
443
|
* Adds search configuration to collections and searchable flag to fields.
|
|
444
444
|
* FTS5 tables are created dynamically when search is enabled for a collection.
|
|
445
445
|
*/
|
|
446
|
-
async function up$
|
|
446
|
+
async function up$112(db) {
|
|
447
447
|
await db.schema.alterTable("_dineway_collections").addColumn("search_config", "text").execute();
|
|
448
448
|
await db.schema.alterTable("_dineway_fields").addColumn("searchable", "integer", (col) => col.defaultTo(0)).execute();
|
|
449
449
|
}
|
|
450
|
-
async function down$
|
|
450
|
+
async function down$112(db) {
|
|
451
451
|
await db.schema.alterTable("_dineway_fields").dropColumn("searchable").execute();
|
|
452
452
|
await db.schema.alterTable("_dineway_collections").dropColumn("search_config").execute();
|
|
453
453
|
}
|
|
@@ -455,8 +455,8 @@ async function down$111(db) {
|
|
|
455
455
|
//#endregion
|
|
456
456
|
//#region src/database/migrations/013_scheduled_publishing.ts
|
|
457
457
|
var _013_scheduled_publishing_exports = /* @__PURE__ */ __exportAll({
|
|
458
|
-
down: () => down$
|
|
459
|
-
up: () => up$
|
|
458
|
+
down: () => down$111,
|
|
459
|
+
up: () => up$111
|
|
460
460
|
});
|
|
461
461
|
/**
|
|
462
462
|
* Migration: Add scheduled publishing support
|
|
@@ -465,7 +465,7 @@ var _013_scheduled_publishing_exports = /* @__PURE__ */ __exportAll({
|
|
|
465
465
|
* When scheduled_at is set and status is 'scheduled', the content
|
|
466
466
|
* will be auto-published when the scheduled time is reached.
|
|
467
467
|
*/
|
|
468
|
-
async function up$
|
|
468
|
+
async function up$111(db) {
|
|
469
469
|
const tableNames = await listTablesLike(db, "ec_%");
|
|
470
470
|
for (const tableName of tableNames) {
|
|
471
471
|
const table = { name: tableName };
|
|
@@ -480,7 +480,7 @@ async function up$110(db) {
|
|
|
480
480
|
`.execute(db);
|
|
481
481
|
}
|
|
482
482
|
}
|
|
483
|
-
async function down$
|
|
483
|
+
async function down$111(db) {
|
|
484
484
|
const tableNames = await listTablesLike(db, "ec_%");
|
|
485
485
|
for (const tableName of tableNames) {
|
|
486
486
|
const table = { name: tableName };
|
|
@@ -497,10 +497,10 @@ async function down$110(db) {
|
|
|
497
497
|
//#endregion
|
|
498
498
|
//#region src/database/migrations/014_draft_revisions.ts
|
|
499
499
|
var _014_draft_revisions_exports = /* @__PURE__ */ __exportAll({
|
|
500
|
-
down: () => down$
|
|
501
|
-
up: () => up$
|
|
500
|
+
down: () => down$110,
|
|
501
|
+
up: () => up$110
|
|
502
502
|
});
|
|
503
|
-
async function up$
|
|
503
|
+
async function up$110(db) {
|
|
504
504
|
const tables = await db.selectFrom("_dineway_collections").select("slug").execute();
|
|
505
505
|
for (const row of tables) {
|
|
506
506
|
const tableName = `ec_${row.slug}`;
|
|
@@ -522,7 +522,7 @@ async function up$109(db) {
|
|
|
522
522
|
`.execute(db);
|
|
523
523
|
}
|
|
524
524
|
}
|
|
525
|
-
async function down$
|
|
525
|
+
async function down$110(db) {
|
|
526
526
|
const tables = await db.selectFrom("_dineway_collections").select("slug").execute();
|
|
527
527
|
for (const row of tables) {
|
|
528
528
|
const tableName = `ec_${row.slug}`;
|
|
@@ -546,8 +546,8 @@ async function down$109(db) {
|
|
|
546
546
|
//#endregion
|
|
547
547
|
//#region src/database/migrations/015_indexes.ts
|
|
548
548
|
var _015_indexes_exports = /* @__PURE__ */ __exportAll({
|
|
549
|
-
down: () => down$
|
|
550
|
-
up: () => up$
|
|
549
|
+
down: () => down$109,
|
|
550
|
+
up: () => up$109
|
|
551
551
|
});
|
|
552
552
|
/**
|
|
553
553
|
* Add performance indexes for common query patterns.
|
|
@@ -560,7 +560,7 @@ var _015_indexes_exports = /* @__PURE__ */ __exportAll({
|
|
|
560
560
|
* 5. Retroactive author_id + updated_at on existing ec_* content tables
|
|
561
561
|
* (new tables get these from createContentTable() in registry.ts)
|
|
562
562
|
*/
|
|
563
|
-
async function up$
|
|
563
|
+
async function up$109(db) {
|
|
564
564
|
await db.schema.createIndex("idx_media_mime_type").on("media").column("mime_type").execute();
|
|
565
565
|
await db.schema.createIndex("idx_media_filename").on("media").column("filename").execute();
|
|
566
566
|
await db.schema.createIndex("idx_media_created_at").on("media").column("created_at").execute();
|
|
@@ -580,7 +580,7 @@ async function up$108(db) {
|
|
|
580
580
|
`.execute(db);
|
|
581
581
|
}
|
|
582
582
|
}
|
|
583
|
-
async function down$
|
|
583
|
+
async function down$109(db) {
|
|
584
584
|
const tableNames = await listTablesLike(db, "ec_%");
|
|
585
585
|
for (const tableName of tableNames) {
|
|
586
586
|
const table = { name: tableName };
|
|
@@ -598,8 +598,8 @@ async function down$108(db) {
|
|
|
598
598
|
//#endregion
|
|
599
599
|
//#region src/database/migrations/016_api_tokens.ts
|
|
600
600
|
var _016_api_tokens_exports = /* @__PURE__ */ __exportAll({
|
|
601
|
-
down: () => down$
|
|
602
|
-
up: () => up$
|
|
601
|
+
down: () => down$108,
|
|
602
|
+
up: () => up$108
|
|
603
603
|
});
|
|
604
604
|
/**
|
|
605
605
|
* API token tables for programmatic access.
|
|
@@ -613,7 +613,7 @@ var _016_api_tokens_exports = /* @__PURE__ */ __exportAll({
|
|
|
613
613
|
* created only part of the schema before failing and never recorded the
|
|
614
614
|
* migration as applied.
|
|
615
615
|
*/
|
|
616
|
-
async function up$
|
|
616
|
+
async function up$108(db) {
|
|
617
617
|
await db.schema.createTable("_dineway_api_tokens").ifNotExists().addColumn("id", "text", (col) => col.primaryKey()).addColumn("name", "text", (col) => col.notNull()).addColumn("token_hash", "text", (col) => col.notNull().unique()).addColumn("prefix", "text", (col) => col.notNull()).addColumn("user_id", "text", (col) => col.notNull()).addColumn("scopes", "text", (col) => col.notNull()).addColumn("expires_at", "text").addColumn("last_used_at", "text").addColumn("created_at", "text", (col) => col.defaultTo(currentTimestamp$1(db))).addForeignKeyConstraint("api_tokens_user_fk", ["user_id"], "users", ["id"], (cb) => cb.onDelete("cascade")).execute();
|
|
618
618
|
await db.schema.createIndex("idx_api_tokens_token_hash").ifNotExists().on("_dineway_api_tokens").column("token_hash").execute();
|
|
619
619
|
await db.schema.createIndex("idx_api_tokens_user_id").ifNotExists().on("_dineway_api_tokens").column("user_id").execute();
|
|
@@ -622,7 +622,7 @@ async function up$107(db) {
|
|
|
622
622
|
await db.schema.createIndex("idx_oauth_tokens_expires").ifNotExists().on("_dineway_oauth_tokens").column("expires_at").execute();
|
|
623
623
|
await db.schema.createTable("_dineway_device_codes").ifNotExists().addColumn("device_code", "text", (col) => col.primaryKey()).addColumn("user_code", "text", (col) => col.notNull().unique()).addColumn("scopes", "text", (col) => col.notNull()).addColumn("user_id", "text").addColumn("status", "text", (col) => col.notNull().defaultTo("pending")).addColumn("expires_at", "text", (col) => col.notNull()).addColumn("interval", "integer", (col) => col.notNull().defaultTo(5)).addColumn("created_at", "text", (col) => col.defaultTo(currentTimestamp$1(db))).execute();
|
|
624
624
|
}
|
|
625
|
-
async function down$
|
|
625
|
+
async function down$108(db) {
|
|
626
626
|
await db.schema.dropTable("_dineway_device_codes").ifExists().execute();
|
|
627
627
|
await db.schema.dropTable("_dineway_oauth_tokens").ifExists().execute();
|
|
628
628
|
await db.schema.dropTable("_dineway_api_tokens").ifExists().execute();
|
|
@@ -631,8 +631,8 @@ async function down$107(db) {
|
|
|
631
631
|
//#endregion
|
|
632
632
|
//#region src/database/migrations/017_authorization_codes.ts
|
|
633
633
|
var _017_authorization_codes_exports = /* @__PURE__ */ __exportAll({
|
|
634
|
-
down: () => down$
|
|
635
|
-
up: () => up$
|
|
634
|
+
down: () => down$107,
|
|
635
|
+
up: () => up$107
|
|
636
636
|
});
|
|
637
637
|
/**
|
|
638
638
|
* Authorization codes for OAuth 2.1 Authorization Code + PKCE flow.
|
|
@@ -642,20 +642,20 @@ var _017_authorization_codes_exports = /* @__PURE__ */ __exportAll({
|
|
|
642
642
|
*
|
|
643
643
|
* Also adds client_id tracking to oauth_tokens for per-client revocation.
|
|
644
644
|
*/
|
|
645
|
-
async function up$
|
|
645
|
+
async function up$107(db) {
|
|
646
646
|
await db.schema.createTable("_dineway_authorization_codes").addColumn("code_hash", "text", (col) => col.primaryKey()).addColumn("client_id", "text", (col) => col.notNull()).addColumn("redirect_uri", "text", (col) => col.notNull()).addColumn("user_id", "text", (col) => col.notNull()).addColumn("scopes", "text", (col) => col.notNull()).addColumn("code_challenge", "text", (col) => col.notNull()).addColumn("code_challenge_method", "text", (col) => col.notNull().defaultTo("S256")).addColumn("resource", "text").addColumn("expires_at", "text", (col) => col.notNull()).addColumn("created_at", "text", (col) => col.defaultTo(currentTimestamp$1(db))).addForeignKeyConstraint("auth_codes_user_fk", ["user_id"], "users", ["id"], (cb) => cb.onDelete("cascade")).execute();
|
|
647
647
|
await db.schema.createIndex("idx_auth_codes_expires").on("_dineway_authorization_codes").column("expires_at").execute();
|
|
648
648
|
await sql`ALTER TABLE _dineway_oauth_tokens ADD COLUMN client_id TEXT`.execute(db);
|
|
649
649
|
}
|
|
650
|
-
async function down$
|
|
650
|
+
async function down$107(db) {
|
|
651
651
|
await db.schema.dropTable("_dineway_authorization_codes").execute();
|
|
652
652
|
}
|
|
653
653
|
|
|
654
654
|
//#endregion
|
|
655
655
|
//#region src/database/migrations/018_seo.ts
|
|
656
656
|
var _018_seo_exports = /* @__PURE__ */ __exportAll({
|
|
657
|
-
down: () => down$
|
|
658
|
-
up: () => up$
|
|
657
|
+
down: () => down$106,
|
|
658
|
+
up: () => up$106
|
|
659
659
|
});
|
|
660
660
|
/**
|
|
661
661
|
* Migration: SEO support
|
|
@@ -668,7 +668,7 @@ var _018_seo_exports = /* @__PURE__ */ __exportAll({
|
|
|
668
668
|
* need it. The `has_seo` flag controls whether the admin shows SEO fields
|
|
669
669
|
* and whether the collection's content appears in sitemaps.
|
|
670
670
|
*/
|
|
671
|
-
async function up$
|
|
671
|
+
async function up$106(db) {
|
|
672
672
|
await db.schema.createTable("_dineway_seo").addColumn("collection", "text", (col) => col.notNull()).addColumn("content_id", "text", (col) => col.notNull()).addColumn("seo_title", "text").addColumn("seo_description", "text").addColumn("seo_image", "text").addColumn("seo_canonical", "text").addColumn("seo_no_index", "integer", (col) => col.notNull().defaultTo(0)).addColumn("created_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).addColumn("updated_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).addPrimaryKeyConstraint("_dineway_seo_pk", ["collection", "content_id"]).execute();
|
|
673
673
|
await sql`
|
|
674
674
|
CREATE INDEX idx_dineway_seo_collection
|
|
@@ -679,7 +679,7 @@ async function up$105(db) {
|
|
|
679
679
|
ADD COLUMN has_seo INTEGER NOT NULL DEFAULT 0
|
|
680
680
|
`.execute(db);
|
|
681
681
|
}
|
|
682
|
-
async function down$
|
|
682
|
+
async function down$106(db) {
|
|
683
683
|
await sql`DROP TABLE IF EXISTS _dineway_seo`.execute(db);
|
|
684
684
|
await sql`
|
|
685
685
|
ALTER TABLE _dineway_collections
|
|
@@ -690,8 +690,8 @@ async function down$105(db) {
|
|
|
690
690
|
//#endregion
|
|
691
691
|
//#region src/database/migrations/019_i18n.ts
|
|
692
692
|
var _019_i18n_exports = /* @__PURE__ */ __exportAll({
|
|
693
|
-
down: () => down$
|
|
694
|
-
up: () => up$
|
|
693
|
+
down: () => down$105,
|
|
694
|
+
up: () => up$105
|
|
695
695
|
});
|
|
696
696
|
/**
|
|
697
697
|
* Quote an identifier for use in raw SQL. Escapes embedded double-quotes
|
|
@@ -804,7 +804,7 @@ async function upPostgres(db) {
|
|
|
804
804
|
ADD COLUMN translatable INTEGER NOT NULL DEFAULT 1
|
|
805
805
|
`.execute(db);
|
|
806
806
|
}
|
|
807
|
-
async function up$
|
|
807
|
+
async function up$105(db) {
|
|
808
808
|
if (!isSqlite(db)) return upPostgres(db);
|
|
809
809
|
const orphanedTmps = await listTablesLike(db, "ec_%_i18n_tmp");
|
|
810
810
|
for (const tmpName of orphanedTmps) {
|
|
@@ -921,7 +921,7 @@ async function downPostgres(db) {
|
|
|
921
921
|
await sql`ALTER TABLE ${sql.ref(t)} DROP COLUMN translation_group`.execute(db);
|
|
922
922
|
}
|
|
923
923
|
}
|
|
924
|
-
async function down$
|
|
924
|
+
async function down$105(db) {
|
|
925
925
|
if (!isSqlite(db)) return downPostgres(db);
|
|
926
926
|
await sql`
|
|
927
927
|
ALTER TABLE _dineway_fields
|
|
@@ -1028,8 +1028,8 @@ async function down$104(db) {
|
|
|
1028
1028
|
//#endregion
|
|
1029
1029
|
//#region src/database/migrations/020_collection_url_pattern.ts
|
|
1030
1030
|
var _020_collection_url_pattern_exports = /* @__PURE__ */ __exportAll({
|
|
1031
|
-
down: () => down$
|
|
1032
|
-
up: () => up$
|
|
1031
|
+
down: () => down$104,
|
|
1032
|
+
up: () => up$104
|
|
1033
1033
|
});
|
|
1034
1034
|
/**
|
|
1035
1035
|
* Migration: URL pattern for collections
|
|
@@ -1038,13 +1038,13 @@ var _020_collection_url_pattern_exports = /* @__PURE__ */ __exportAll({
|
|
|
1038
1038
|
* can declare its own URL structure (e.g. "/{slug}" for pages, "/blog/{slug}"
|
|
1039
1039
|
* for posts). Used for menu URL resolution, sitemaps, and path-based lookups.
|
|
1040
1040
|
*/
|
|
1041
|
-
async function up$
|
|
1041
|
+
async function up$104(db) {
|
|
1042
1042
|
await sql`
|
|
1043
1043
|
ALTER TABLE _dineway_collections
|
|
1044
1044
|
ADD COLUMN url_pattern TEXT
|
|
1045
1045
|
`.execute(db);
|
|
1046
1046
|
}
|
|
1047
|
-
async function down$
|
|
1047
|
+
async function down$104(db) {
|
|
1048
1048
|
await sql`
|
|
1049
1049
|
ALTER TABLE _dineway_collections
|
|
1050
1050
|
DROP COLUMN url_pattern
|
|
@@ -1054,8 +1054,8 @@ async function down$103(db) {
|
|
|
1054
1054
|
//#endregion
|
|
1055
1055
|
//#region src/database/migrations/021_remove_section_categories.ts
|
|
1056
1056
|
var _021_remove_section_categories_exports = /* @__PURE__ */ __exportAll({
|
|
1057
|
-
down: () => down$
|
|
1058
|
-
up: () => up$
|
|
1057
|
+
down: () => down$103,
|
|
1058
|
+
up: () => up$103
|
|
1059
1059
|
});
|
|
1060
1060
|
/**
|
|
1061
1061
|
* Migration: Remove section categories
|
|
@@ -1064,12 +1064,12 @@ var _021_remove_section_categories_exports = /* @__PURE__ */ __exportAll({
|
|
|
1064
1064
|
* Rather than building the missing UI for a feature with very little need at this stage,
|
|
1065
1065
|
* we're removing the feature entirely.
|
|
1066
1066
|
*/
|
|
1067
|
-
async function up$
|
|
1067
|
+
async function up$103(db) {
|
|
1068
1068
|
await db.schema.dropIndex("idx_sections_category").ifExists().execute();
|
|
1069
1069
|
await db.schema.alterTable("_dineway_sections").dropColumn("category_id").execute();
|
|
1070
1070
|
await db.schema.dropTable("_dineway_section_categories").execute();
|
|
1071
1071
|
}
|
|
1072
|
-
async function down$
|
|
1072
|
+
async function down$103(db) {
|
|
1073
1073
|
await db.schema.createTable("_dineway_section_categories").addColumn("id", "text", (col) => col.primaryKey()).addColumn("slug", "text", (col) => col.notNull().unique()).addColumn("label", "text", (col) => col.notNull()).addColumn("sort_order", "integer", (col) => col.defaultTo(0)).addColumn("created_at", "text", (col) => col.defaultTo(sql`CURRENT_TIMESTAMP`)).execute();
|
|
1074
1074
|
await db.schema.alterTable("_dineway_sections").addColumn("category_id", "text", (col) => col.references("_dineway_section_categories.id").onDelete("set null")).execute();
|
|
1075
1075
|
await db.schema.createIndex("idx_sections_category").on("_dineway_sections").columns(["category_id"]).execute();
|
|
@@ -1078,8 +1078,8 @@ async function down$102(db) {
|
|
|
1078
1078
|
//#endregion
|
|
1079
1079
|
//#region src/database/migrations/022_marketplace_plugin_state.ts
|
|
1080
1080
|
var _022_marketplace_plugin_state_exports = /* @__PURE__ */ __exportAll({
|
|
1081
|
-
down: () => down$
|
|
1082
|
-
up: () => up$
|
|
1081
|
+
down: () => down$102,
|
|
1082
|
+
up: () => up$102
|
|
1083
1083
|
});
|
|
1084
1084
|
/**
|
|
1085
1085
|
* Migration: Add marketplace fields to _plugin_state
|
|
@@ -1088,7 +1088,7 @@ var _022_marketplace_plugin_state_exports = /* @__PURE__ */ __exportAll({
|
|
|
1088
1088
|
* whether a plugin was installed from config or marketplace,
|
|
1089
1089
|
* and which marketplace version is installed.
|
|
1090
1090
|
*/
|
|
1091
|
-
async function up$
|
|
1091
|
+
async function up$102(db) {
|
|
1092
1092
|
await sql`
|
|
1093
1093
|
ALTER TABLE _plugin_state
|
|
1094
1094
|
ADD COLUMN source TEXT NOT NULL DEFAULT 'config'
|
|
@@ -1103,7 +1103,7 @@ async function up$101(db) {
|
|
|
1103
1103
|
WHERE source = 'marketplace'
|
|
1104
1104
|
`.execute(db);
|
|
1105
1105
|
}
|
|
1106
|
-
async function down$
|
|
1106
|
+
async function down$102(db) {
|
|
1107
1107
|
await sql`
|
|
1108
1108
|
DROP INDEX IF EXISTS idx_plugin_state_source
|
|
1109
1109
|
`.execute(db);
|
|
@@ -1120,8 +1120,8 @@ async function down$101(db) {
|
|
|
1120
1120
|
//#endregion
|
|
1121
1121
|
//#region src/database/migrations/023_plugin_metadata.ts
|
|
1122
1122
|
var _023_plugin_metadata_exports = /* @__PURE__ */ __exportAll({
|
|
1123
|
-
down: () => down$
|
|
1124
|
-
up: () => up$
|
|
1123
|
+
down: () => down$101,
|
|
1124
|
+
up: () => up$101
|
|
1125
1125
|
});
|
|
1126
1126
|
/**
|
|
1127
1127
|
* Migration: Add display metadata to _plugin_state
|
|
@@ -1130,7 +1130,7 @@ var _023_plugin_metadata_exports = /* @__PURE__ */ __exportAll({
|
|
|
1130
1130
|
* so the admin UI can show meaningful info without re-fetching
|
|
1131
1131
|
* from the marketplace on every page load.
|
|
1132
1132
|
*/
|
|
1133
|
-
async function up$
|
|
1133
|
+
async function up$101(db) {
|
|
1134
1134
|
await sql`
|
|
1135
1135
|
ALTER TABLE _plugin_state
|
|
1136
1136
|
ADD COLUMN display_name TEXT
|
|
@@ -1140,7 +1140,7 @@ async function up$100(db) {
|
|
|
1140
1140
|
ADD COLUMN description TEXT
|
|
1141
1141
|
`.execute(db);
|
|
1142
1142
|
}
|
|
1143
|
-
async function down$
|
|
1143
|
+
async function down$101(db) {
|
|
1144
1144
|
await sql`
|
|
1145
1145
|
ALTER TABLE _plugin_state
|
|
1146
1146
|
DROP COLUMN description
|
|
@@ -1154,8 +1154,8 @@ async function down$100(db) {
|
|
|
1154
1154
|
//#endregion
|
|
1155
1155
|
//#region src/database/migrations/024_media_placeholders.ts
|
|
1156
1156
|
var _024_media_placeholders_exports = /* @__PURE__ */ __exportAll({
|
|
1157
|
-
down: () => down$
|
|
1158
|
-
up: () => up$
|
|
1157
|
+
down: () => down$100,
|
|
1158
|
+
up: () => up$100
|
|
1159
1159
|
});
|
|
1160
1160
|
/**
|
|
1161
1161
|
* Migration: Add placeholder columns to media table
|
|
@@ -1163,7 +1163,7 @@ var _024_media_placeholders_exports = /* @__PURE__ */ __exportAll({
|
|
|
1163
1163
|
* Stores blurhash and dominant_color for LQIP (Low Quality Image Placeholder)
|
|
1164
1164
|
* support. Generated at upload time from image pixel data.
|
|
1165
1165
|
*/
|
|
1166
|
-
async function up$
|
|
1166
|
+
async function up$100(db) {
|
|
1167
1167
|
await sql`
|
|
1168
1168
|
ALTER TABLE media
|
|
1169
1169
|
ADD COLUMN blurhash TEXT
|
|
@@ -1173,7 +1173,7 @@ async function up$99(db) {
|
|
|
1173
1173
|
ADD COLUMN dominant_color TEXT
|
|
1174
1174
|
`.execute(db);
|
|
1175
1175
|
}
|
|
1176
|
-
async function down$
|
|
1176
|
+
async function down$100(db) {
|
|
1177
1177
|
await sql`
|
|
1178
1178
|
ALTER TABLE media
|
|
1179
1179
|
DROP COLUMN dominant_color
|
|
@@ -1187,8 +1187,8 @@ async function down$99(db) {
|
|
|
1187
1187
|
//#endregion
|
|
1188
1188
|
//#region src/database/migrations/025_oauth_clients.ts
|
|
1189
1189
|
var _025_oauth_clients_exports = /* @__PURE__ */ __exportAll({
|
|
1190
|
-
down: () => down$
|
|
1191
|
-
up: () => up$
|
|
1190
|
+
down: () => down$99,
|
|
1191
|
+
up: () => up$99
|
|
1192
1192
|
});
|
|
1193
1193
|
/**
|
|
1194
1194
|
* Migration: Create OAuth clients table
|
|
@@ -1199,18 +1199,18 @@ var _025_oauth_clients_exports = /* @__PURE__ */ __exportAll({
|
|
|
1199
1199
|
* Each client has a set of pre-registered redirect URIs (JSON array).
|
|
1200
1200
|
* The authorize endpoint rejects any redirect_uri not in the client's list.
|
|
1201
1201
|
*/
|
|
1202
|
-
async function up$
|
|
1202
|
+
async function up$99(db) {
|
|
1203
1203
|
await db.schema.createTable("_dineway_oauth_clients").addColumn("id", "text", (col) => col.primaryKey()).addColumn("name", "text", (col) => col.notNull()).addColumn("redirect_uris", "text", (col) => col.notNull()).addColumn("scopes", "text").addColumn("created_at", "text", (col) => col.defaultTo(currentTimestamp$1(db))).addColumn("updated_at", "text", (col) => col.defaultTo(currentTimestamp$1(db))).execute();
|
|
1204
1204
|
}
|
|
1205
|
-
async function down$
|
|
1205
|
+
async function down$99(db) {
|
|
1206
1206
|
await db.schema.dropTable("_dineway_oauth_clients").execute();
|
|
1207
1207
|
}
|
|
1208
1208
|
|
|
1209
1209
|
//#endregion
|
|
1210
1210
|
//#region src/database/migrations/026_cron_tasks.ts
|
|
1211
1211
|
var _026_cron_tasks_exports = /* @__PURE__ */ __exportAll({
|
|
1212
|
-
down: () => down$
|
|
1213
|
-
up: () => up$
|
|
1212
|
+
down: () => down$98,
|
|
1213
|
+
up: () => up$98
|
|
1214
1214
|
});
|
|
1215
1215
|
/**
|
|
1216
1216
|
* Migration: Create cron tasks table for plugin scheduled tasks.
|
|
@@ -1221,7 +1221,7 @@ var _026_cron_tasks_exports = /* @__PURE__ */ __exportAll({
|
|
|
1221
1221
|
* The `next_run_at` + `status` + `enabled` index drives the "find overdue
|
|
1222
1222
|
* tasks" query used by CronExecutor.tick().
|
|
1223
1223
|
*/
|
|
1224
|
-
async function up$
|
|
1224
|
+
async function up$98(db) {
|
|
1225
1225
|
await db.schema.createTable("_dineway_cron_tasks").addColumn("id", "text", (col) => col.primaryKey()).addColumn("plugin_id", "text", (col) => col.notNull()).addColumn("task_name", "text", (col) => col.notNull()).addColumn("schedule", "text", (col) => col.notNull()).addColumn("is_oneshot", "integer", (col) => col.notNull().defaultTo(0)).addColumn("data", "text").addColumn("next_run_at", "text", (col) => col.notNull()).addColumn("last_run_at", "text").addColumn("status", "text", (col) => col.notNull().defaultTo("idle")).addColumn("locked_at", "text").addColumn("enabled", "integer", (col) => col.notNull().defaultTo(1)).addColumn("created_at", "text", (col) => col.defaultTo(currentTimestamp$1(db))).addUniqueConstraint("uq_cron_tasks_plugin_task", ["plugin_id", "task_name"]).execute();
|
|
1226
1226
|
await db.schema.createIndex("idx_cron_tasks_due").on("_dineway_cron_tasks").columns([
|
|
1227
1227
|
"enabled",
|
|
@@ -1230,17 +1230,17 @@ async function up$97(db) {
|
|
|
1230
1230
|
]).execute();
|
|
1231
1231
|
await db.schema.createIndex("idx_cron_tasks_plugin").on("_dineway_cron_tasks").column("plugin_id").execute();
|
|
1232
1232
|
}
|
|
1233
|
-
async function down$
|
|
1233
|
+
async function down$98(db) {
|
|
1234
1234
|
await db.schema.dropTable("_dineway_cron_tasks").execute();
|
|
1235
1235
|
}
|
|
1236
1236
|
|
|
1237
1237
|
//#endregion
|
|
1238
1238
|
//#region src/database/migrations/027_comments.ts
|
|
1239
1239
|
var _027_comments_exports = /* @__PURE__ */ __exportAll({
|
|
1240
|
-
down: () => down$
|
|
1241
|
-
up: () => up$
|
|
1240
|
+
down: () => down$97,
|
|
1241
|
+
up: () => up$97
|
|
1242
1242
|
});
|
|
1243
|
-
async function up$
|
|
1243
|
+
async function up$97(db) {
|
|
1244
1244
|
await db.schema.createTable("_dineway_comments").addColumn("id", "text", (col) => col.primaryKey()).addColumn("collection", "text", (col) => col.notNull()).addColumn("content_id", "text", (col) => col.notNull()).addColumn("parent_id", "text", (col) => col.references("_dineway_comments.id").onDelete("cascade")).addColumn("author_name", "text", (col) => col.notNull()).addColumn("author_email", "text", (col) => col.notNull()).addColumn("author_url", "text").addColumn("author_user_id", "text", (col) => col.references("users.id").onDelete("set null")).addColumn("body", "text", (col) => col.notNull()).addColumn("status", "text", (col) => col.notNull().defaultTo("pending")).addColumn("ip_hash", "text").addColumn("user_agent", "text").addColumn("moderation_metadata", "text").addColumn("created_at", "text", (col) => col.defaultTo(currentTimestamp$1(db))).addColumn("updated_at", "text", (col) => col.defaultTo(currentTimestamp$1(db))).execute();
|
|
1245
1245
|
await db.schema.createIndex("idx_comments_content").on("_dineway_comments").columns([
|
|
1246
1246
|
"collection",
|
|
@@ -1256,30 +1256,30 @@ async function up$96(db) {
|
|
|
1256
1256
|
await db.schema.alterTable("_dineway_collections").addColumn("comments_closed_after_days", "integer", (col) => col.defaultTo(90)).execute();
|
|
1257
1257
|
await db.schema.alterTable("_dineway_collections").addColumn("comments_auto_approve_users", "integer", (col) => col.defaultTo(1)).execute();
|
|
1258
1258
|
}
|
|
1259
|
-
async function down$
|
|
1259
|
+
async function down$97(db) {
|
|
1260
1260
|
await db.schema.dropTable("_dineway_comments").execute();
|
|
1261
1261
|
}
|
|
1262
1262
|
|
|
1263
1263
|
//#endregion
|
|
1264
1264
|
//#region src/database/migrations/028_drop_author_url.ts
|
|
1265
1265
|
var _028_drop_author_url_exports = /* @__PURE__ */ __exportAll({
|
|
1266
|
-
down: () => down$
|
|
1267
|
-
up: () => up$
|
|
1266
|
+
down: () => down$96,
|
|
1267
|
+
up: () => up$96
|
|
1268
1268
|
});
|
|
1269
|
-
async function up$
|
|
1269
|
+
async function up$96(db) {
|
|
1270
1270
|
await sql`ALTER TABLE _dineway_comments DROP COLUMN author_url`.execute(db);
|
|
1271
1271
|
}
|
|
1272
|
-
async function down$
|
|
1272
|
+
async function down$96(db) {
|
|
1273
1273
|
await db.schema.alterTable("_dineway_comments").addColumn("author_url", "text").execute();
|
|
1274
1274
|
}
|
|
1275
1275
|
|
|
1276
1276
|
//#endregion
|
|
1277
1277
|
//#region src/database/migrations/029_redirects.ts
|
|
1278
1278
|
var _029_redirects_exports = /* @__PURE__ */ __exportAll({
|
|
1279
|
-
down: () => down$
|
|
1280
|
-
up: () => up$
|
|
1279
|
+
down: () => down$95,
|
|
1280
|
+
up: () => up$95
|
|
1281
1281
|
});
|
|
1282
|
-
async function up$
|
|
1282
|
+
async function up$95(db) {
|
|
1283
1283
|
await db.schema.createTable("_dineway_redirects").addColumn("id", "text", (col) => col.primaryKey()).addColumn("source", "text", (col) => col.notNull()).addColumn("destination", "text", (col) => col.notNull()).addColumn("type", "integer", (col) => col.notNull().defaultTo(301)).addColumn("is_pattern", "integer", (col) => col.notNull().defaultTo(0)).addColumn("enabled", "integer", (col) => col.notNull().defaultTo(1)).addColumn("hits", "integer", (col) => col.notNull().defaultTo(0)).addColumn("last_hit_at", "text").addColumn("group_name", "text").addColumn("auto", "integer", (col) => col.notNull().defaultTo(0)).addColumn("created_at", "text", (col) => col.defaultTo(currentTimestamp$1(db))).addColumn("updated_at", "text", (col) => col.defaultTo(currentTimestamp$1(db))).execute();
|
|
1284
1284
|
await db.schema.createIndex("idx_redirects_source").on("_dineway_redirects").column("source").execute();
|
|
1285
1285
|
await db.schema.createIndex("idx_redirects_enabled").on("_dineway_redirects").column("enabled").execute();
|
|
@@ -1288,7 +1288,7 @@ async function up$94(db) {
|
|
|
1288
1288
|
await db.schema.createIndex("idx_404_log_path").on("_dineway_404_log").column("path").execute();
|
|
1289
1289
|
await db.schema.createIndex("idx_404_log_created").on("_dineway_404_log").column("created_at").execute();
|
|
1290
1290
|
}
|
|
1291
|
-
async function down$
|
|
1291
|
+
async function down$95(db) {
|
|
1292
1292
|
await db.schema.dropTable("_dineway_404_log").execute();
|
|
1293
1293
|
await db.schema.dropTable("_dineway_redirects").execute();
|
|
1294
1294
|
}
|
|
@@ -1296,8 +1296,8 @@ async function down$94(db) {
|
|
|
1296
1296
|
//#endregion
|
|
1297
1297
|
//#region src/database/migrations/030_widen_scheduled_index.ts
|
|
1298
1298
|
var _030_widen_scheduled_index_exports = /* @__PURE__ */ __exportAll({
|
|
1299
|
-
down: () => down$
|
|
1300
|
-
up: () => up$
|
|
1299
|
+
down: () => down$94,
|
|
1300
|
+
up: () => up$94
|
|
1301
1301
|
});
|
|
1302
1302
|
/**
|
|
1303
1303
|
* Migration: Widen scheduled publishing index
|
|
@@ -1306,7 +1306,7 @@ var _030_widen_scheduled_index_exports = /* @__PURE__ */ __exportAll({
|
|
|
1306
1306
|
* Published posts can now have scheduled draft changes, so widen the
|
|
1307
1307
|
* index to cover all rows where scheduled_at IS NOT NULL.
|
|
1308
1308
|
*/
|
|
1309
|
-
async function up$
|
|
1309
|
+
async function up$94(db) {
|
|
1310
1310
|
const tableNames = await listTablesLike(db, "ec_%");
|
|
1311
1311
|
for (const tableName of tableNames) {
|
|
1312
1312
|
const table = { name: tableName };
|
|
@@ -1320,7 +1320,7 @@ async function up$93(db) {
|
|
|
1320
1320
|
`.execute(db);
|
|
1321
1321
|
}
|
|
1322
1322
|
}
|
|
1323
|
-
async function down$
|
|
1323
|
+
async function down$94(db) {
|
|
1324
1324
|
const tableNames = await listTablesLike(db, "ec_%");
|
|
1325
1325
|
for (const tableName of tableNames) {
|
|
1326
1326
|
const table = { name: tableName };
|
|
@@ -1338,10 +1338,10 @@ async function down$93(db) {
|
|
|
1338
1338
|
//#endregion
|
|
1339
1339
|
//#region src/database/migrations/031_bylines.ts
|
|
1340
1340
|
var _031_bylines_exports = /* @__PURE__ */ __exportAll({
|
|
1341
|
-
down: () => down$
|
|
1342
|
-
up: () => up$
|
|
1341
|
+
down: () => down$93,
|
|
1342
|
+
up: () => up$93
|
|
1343
1343
|
});
|
|
1344
|
-
async function up$
|
|
1344
|
+
async function up$93(db) {
|
|
1345
1345
|
await db.schema.createTable("_dineway_bylines").addColumn("id", "text", (col) => col.primaryKey()).addColumn("slug", "text", (col) => col.notNull().unique()).addColumn("display_name", "text", (col) => col.notNull()).addColumn("bio", "text").addColumn("avatar_media_id", "text", (col) => col.references("media.id").onDelete("set null")).addColumn("website_url", "text").addColumn("user_id", "text", (col) => col.references("users.id").onDelete("set null")).addColumn("is_guest", "integer", (col) => col.notNull().defaultTo(0)).addColumn("created_at", "text", (col) => col.defaultTo(currentTimestamp$1(db))).addColumn("updated_at", "text", (col) => col.defaultTo(currentTimestamp$1(db))).execute();
|
|
1346
1346
|
await sql`
|
|
1347
1347
|
CREATE UNIQUE INDEX ${sql.ref("idx_bylines_user_id_unique")}
|
|
@@ -1373,7 +1373,7 @@ async function up$92(db) {
|
|
|
1373
1373
|
`.execute(db);
|
|
1374
1374
|
}
|
|
1375
1375
|
}
|
|
1376
|
-
async function down$
|
|
1376
|
+
async function down$93(db) {
|
|
1377
1377
|
const tableNames = await listTablesLike(db, "ec_%");
|
|
1378
1378
|
for (const tableName of tableNames) {
|
|
1379
1379
|
await sql`
|
|
@@ -1391,8 +1391,8 @@ async function down$92(db) {
|
|
|
1391
1391
|
//#endregion
|
|
1392
1392
|
//#region src/database/migrations/032_rate_limits.ts
|
|
1393
1393
|
var _032_rate_limits_exports = /* @__PURE__ */ __exportAll({
|
|
1394
|
-
down: () => down$
|
|
1395
|
-
up: () => up$
|
|
1394
|
+
down: () => down$92,
|
|
1395
|
+
up: () => up$92
|
|
1396
1396
|
});
|
|
1397
1397
|
/**
|
|
1398
1398
|
* Migration: Rate limits table + device code polling tracking.
|
|
@@ -1403,12 +1403,12 @@ var _032_rate_limits_exports = /* @__PURE__ */ __exportAll({
|
|
|
1403
1403
|
* 2. Add last_polled_at column to _dineway_device_codes for
|
|
1404
1404
|
* RFC 8628 slow_down enforcement.
|
|
1405
1405
|
*/
|
|
1406
|
-
async function up$
|
|
1406
|
+
async function up$92(db) {
|
|
1407
1407
|
await db.schema.createTable("_dineway_rate_limits").addColumn("key", "text", (col) => col.notNull()).addColumn("window", "text", (col) => col.notNull()).addColumn("count", "integer", (col) => col.notNull().defaultTo(1)).addPrimaryKeyConstraint("pk_rate_limits", ["key", "window"]).execute();
|
|
1408
1408
|
await db.schema.createIndex("idx_rate_limits_window").on("_dineway_rate_limits").column("window").execute();
|
|
1409
1409
|
await db.schema.alterTable("_dineway_device_codes").addColumn("last_polled_at", "text").execute();
|
|
1410
1410
|
}
|
|
1411
|
-
async function down$
|
|
1411
|
+
async function down$92(db) {
|
|
1412
1412
|
await db.schema.dropTable("_dineway_rate_limits").execute();
|
|
1413
1413
|
await db.schema.alterTable("_dineway_device_codes").dropColumn("last_polled_at").execute();
|
|
1414
1414
|
}
|
|
@@ -1416,8 +1416,8 @@ async function down$91(db) {
|
|
|
1416
1416
|
//#endregion
|
|
1417
1417
|
//#region src/database/migrations/033_optimize_content_indexes.ts
|
|
1418
1418
|
var _033_optimize_content_indexes_exports = /* @__PURE__ */ __exportAll({
|
|
1419
|
-
down: () => down$
|
|
1420
|
-
up: () => up$
|
|
1419
|
+
down: () => down$91,
|
|
1420
|
+
up: () => up$91
|
|
1421
1421
|
});
|
|
1422
1422
|
/**
|
|
1423
1423
|
* Migration: Optimize content table indexes for SQLite-compatible performance
|
|
@@ -1430,7 +1430,7 @@ var _033_optimize_content_indexes_exports = /* @__PURE__ */ __exportAll({
|
|
|
1430
1430
|
*
|
|
1431
1431
|
* Impact: Reduces row reads by 90%+ for admin panel operations on SQLite-compatible adapters.
|
|
1432
1432
|
*/
|
|
1433
|
-
async function up$
|
|
1433
|
+
async function up$91(db) {
|
|
1434
1434
|
const tableNames = await listTablesLike(db, "ec_%");
|
|
1435
1435
|
for (const tableName of tableNames) {
|
|
1436
1436
|
const table = { name: tableName };
|
|
@@ -1472,7 +1472,7 @@ async function up$90(db) {
|
|
|
1472
1472
|
WHERE status = 'trash'
|
|
1473
1473
|
`.execute(db);
|
|
1474
1474
|
}
|
|
1475
|
-
async function down$
|
|
1475
|
+
async function down$91(db) {
|
|
1476
1476
|
const tableNames = await listTablesLike(db, "ec_%");
|
|
1477
1477
|
for (const tableName of tableNames) {
|
|
1478
1478
|
const table = { name: tableName };
|
|
@@ -1505,10 +1505,10 @@ async function down$90(db) {
|
|
|
1505
1505
|
//#endregion
|
|
1506
1506
|
//#region src/database/migrations/034_published_at_index.ts
|
|
1507
1507
|
var _034_published_at_index_exports = /* @__PURE__ */ __exportAll({
|
|
1508
|
-
down: () => down$
|
|
1509
|
-
up: () => up$
|
|
1508
|
+
down: () => down$90,
|
|
1509
|
+
up: () => up$90
|
|
1510
1510
|
});
|
|
1511
|
-
async function up$
|
|
1511
|
+
async function up$90(db) {
|
|
1512
1512
|
const tableNames = await listTablesLike(db, "ec_%");
|
|
1513
1513
|
for (const tableName of tableNames) {
|
|
1514
1514
|
const table = { name: tableName };
|
|
@@ -1518,7 +1518,7 @@ async function up$89(db) {
|
|
|
1518
1518
|
`.execute(db);
|
|
1519
1519
|
}
|
|
1520
1520
|
}
|
|
1521
|
-
async function down$
|
|
1521
|
+
async function down$90(db) {
|
|
1522
1522
|
const tableNames = await listTablesLike(db, "ec_%");
|
|
1523
1523
|
for (const tableName of tableNames) {
|
|
1524
1524
|
const table = { name: tableName };
|
|
@@ -1529,15 +1529,15 @@ async function down$89(db) {
|
|
|
1529
1529
|
//#endregion
|
|
1530
1530
|
//#region src/database/migrations/035_backfill_url_patterns.ts
|
|
1531
1531
|
var _035_backfill_url_patterns_exports = /* @__PURE__ */ __exportAll({
|
|
1532
|
-
down: () => down$
|
|
1533
|
-
up: () => up$
|
|
1532
|
+
down: () => down$89,
|
|
1533
|
+
up: () => up$89
|
|
1534
1534
|
});
|
|
1535
1535
|
/**
|
|
1536
1536
|
* Backfill default URL patterns for the built-in posts and pages collections.
|
|
1537
1537
|
*
|
|
1538
1538
|
* Existing rows keep custom patterns; only missing defaults are filled.
|
|
1539
1539
|
*/
|
|
1540
|
-
async function up$
|
|
1540
|
+
async function up$89(db) {
|
|
1541
1541
|
await sql`
|
|
1542
1542
|
UPDATE _dineway_collections
|
|
1543
1543
|
SET url_pattern = '/posts/{slug}'
|
|
@@ -1549,7 +1549,7 @@ async function up$88(db) {
|
|
|
1549
1549
|
WHERE slug = 'pages' AND url_pattern IS NULL
|
|
1550
1550
|
`.execute(db);
|
|
1551
1551
|
}
|
|
1552
|
-
async function down$
|
|
1552
|
+
async function down$89(db) {
|
|
1553
1553
|
await sql`
|
|
1554
1554
|
UPDATE _dineway_collections
|
|
1555
1555
|
SET url_pattern = NULL
|
|
@@ -1565,8 +1565,8 @@ async function down$88(db) {
|
|
|
1565
1565
|
//#endregion
|
|
1566
1566
|
//#region src/database/migrations/036_activity_log.ts
|
|
1567
1567
|
var _036_activity_log_exports = /* @__PURE__ */ __exportAll({
|
|
1568
|
-
down: () => down$
|
|
1569
|
-
up: () => up$
|
|
1568
|
+
down: () => down$88,
|
|
1569
|
+
up: () => up$88
|
|
1570
1570
|
});
|
|
1571
1571
|
/**
|
|
1572
1572
|
* Site Context Engine activity foundation.
|
|
@@ -1575,7 +1575,7 @@ var _036_activity_log_exports = /* @__PURE__ */ __exportAll({
|
|
|
1575
1575
|
* not a request log. Actor IDs intentionally have no foreign key because the
|
|
1576
1576
|
* actor source can be users, API tokens, or a stable system actor.
|
|
1577
1577
|
*/
|
|
1578
|
-
async function up$
|
|
1578
|
+
async function up$88(db) {
|
|
1579
1579
|
await db.schema.createTable("_dineway_activity_log").addColumn("id", "text", (col) => col.primaryKey()).addColumn("actor_type", "text", (col) => col.notNull().check(sql`actor_type in ('user', 'api_token', 'system')`)).addColumn("actor_id", "text", (col) => col.notNull()).addColumn("auth_metadata", "text").addColumn("action_type", "text", (col) => col.notNull()).addColumn("subject_type", "text", (col) => col.notNull()).addColumn("subject_id", "text").addColumn("related_subject_type", "text").addColumn("related_subject_id", "text").addColumn("source_type", "text", (col) => col.check(sql`source_type is null or source_type in ('api_route', 'mcp_tool', 'system', 'plugin', 'unknown')`)).addColumn("source_name", "text").addColumn("result_status", "text", (col) => col.notNull().defaultTo("succeeded").check(sql`result_status in ('succeeded', 'pending', 'failed', 'blocked')`)).addColumn("scope", "text", (col) => col.notNull()).addColumn("summary", "text", (col) => col.notNull()).addColumn("detail", "text").addColumn("created_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).execute();
|
|
1580
1580
|
await db.schema.createIndex("idx_dineway_activity_actor").on("_dineway_activity_log").columns([
|
|
1581
1581
|
"actor_type",
|
|
@@ -1602,15 +1602,15 @@ async function up$87(db) {
|
|
|
1602
1602
|
await db.schema.createIndex("idx_dineway_activity_result_status").on("_dineway_activity_log").columns(["result_status", "created_at"]).execute();
|
|
1603
1603
|
await db.schema.createIndex("idx_dineway_activity_created_at").on("_dineway_activity_log").column("created_at").execute();
|
|
1604
1604
|
}
|
|
1605
|
-
async function down$
|
|
1605
|
+
async function down$88(db) {
|
|
1606
1606
|
await db.schema.dropTable("_dineway_activity_log").execute();
|
|
1607
1607
|
}
|
|
1608
1608
|
|
|
1609
1609
|
//#endregion
|
|
1610
1610
|
//#region src/database/migrations/037_context_entries.ts
|
|
1611
1611
|
var _037_context_entries_exports = /* @__PURE__ */ __exportAll({
|
|
1612
|
-
down: () => down$
|
|
1613
|
-
up: () => up$
|
|
1612
|
+
down: () => down$87,
|
|
1613
|
+
up: () => up$87
|
|
1614
1614
|
});
|
|
1615
1615
|
const CONTEXT_TYPE_SQL = [
|
|
1616
1616
|
"brand_voice",
|
|
@@ -1635,7 +1635,7 @@ const CONTEXT_TYPE_SQL = [
|
|
|
1635
1635
|
* marking old entries non-current and linking replacements through
|
|
1636
1636
|
* `supersedes_id`.
|
|
1637
1637
|
*/
|
|
1638
|
-
async function up$
|
|
1638
|
+
async function up$87(db) {
|
|
1639
1639
|
await db.schema.createTable("_dineway_context_entries").addColumn("id", "text", (col) => col.primaryKey()).addColumn("scope", "text", (col) => col.notNull()).addColumn("context_type", "text", (col) => col.notNull().check(sql`context_type in (${sql.raw(CONTEXT_TYPE_SQL)})`)).addColumn("title", "text", (col) => col.notNull()).addColumn("body", "text", (col) => col.notNull()).addColumn("policy_key", "text").addColumn("source_activity_id", "text").addColumn("created_by_actor_type", "text", (col) => col.notNull().check(sql`created_by_actor_type in ('user', 'api_token', 'system')`)).addColumn("created_by_actor_id", "text", (col) => col.notNull()).addColumn("created_auth_metadata", "text").addColumn("supersedes_id", "text").addColumn("version", "integer", (col) => col.notNull().defaultTo(1)).addColumn("is_current", "integer", (col) => col.notNull().defaultTo(1).check(sql`is_current in (0, 1)`)).addColumn("valid_until", "text").addColumn("reviewed_at", "text").addColumn("reviewed_by_actor_type", "text", (col) => col.check(sql`reviewed_by_actor_type is null or reviewed_by_actor_type in ('user', 'api_token', 'system')`)).addColumn("reviewed_by_actor_id", "text").addColumn("review_note", "text").addColumn("created_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).addColumn("updated_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).addForeignKeyConstraint("fk_dineway_context_source_activity", ["source_activity_id"], "_dineway_activity_log", ["id"], (cb) => cb.onDelete("set null")).addForeignKeyConstraint("fk_dineway_context_supersedes", ["supersedes_id"], "_dineway_context_entries", ["id"], (cb) => cb.onDelete("set null")).execute();
|
|
1640
1640
|
await db.schema.createTable("_dineway_context_tags").addColumn("context_entry_id", "text", (col) => col.notNull()).addColumn("tag", "text", (col) => col.notNull()).addPrimaryKeyConstraint("pk_dineway_context_tags", ["context_entry_id", "tag"]).addForeignKeyConstraint("fk_dineway_context_tags_entry", ["context_entry_id"], "_dineway_context_entries", ["id"], (cb) => cb.onDelete("cascade")).execute();
|
|
1641
1641
|
await db.schema.createIndex("idx_dineway_context_scope_current").on("_dineway_context_entries").columns([
|
|
@@ -1660,7 +1660,7 @@ async function up$86(db) {
|
|
|
1660
1660
|
await db.schema.createIndex("idx_dineway_context_created_at").on("_dineway_context_entries").column("created_at").execute();
|
|
1661
1661
|
await db.schema.createIndex("idx_dineway_context_tags_tag").on("_dineway_context_tags").columns(["tag", "context_entry_id"]).execute();
|
|
1662
1662
|
}
|
|
1663
|
-
async function down$
|
|
1663
|
+
async function down$87(db) {
|
|
1664
1664
|
await db.schema.dropTable("_dineway_context_tags").execute();
|
|
1665
1665
|
await db.schema.dropTable("_dineway_context_entries").execute();
|
|
1666
1666
|
}
|
|
@@ -1668,8 +1668,8 @@ async function down$86(db) {
|
|
|
1668
1668
|
//#endregion
|
|
1669
1669
|
//#region src/database/migrations/038_review_requests.ts
|
|
1670
1670
|
var _038_review_requests_exports = /* @__PURE__ */ __exportAll({
|
|
1671
|
-
down: () => down$
|
|
1672
|
-
up: () => up$
|
|
1671
|
+
down: () => down$86,
|
|
1672
|
+
up: () => up$86
|
|
1673
1673
|
});
|
|
1674
1674
|
/**
|
|
1675
1675
|
* Lightweight content review requests for Phase 5a.
|
|
@@ -1677,7 +1677,7 @@ var _038_review_requests_exports = /* @__PURE__ */ __exportAll({
|
|
|
1677
1677
|
* Review requests bind human approval to immutable content revision/action
|
|
1678
1678
|
* identifiers so an approval cannot be reused after the draft or action changes.
|
|
1679
1679
|
*/
|
|
1680
|
-
async function up$
|
|
1680
|
+
async function up$86(db) {
|
|
1681
1681
|
await db.schema.createTable("_dineway_review_requests").addColumn("id", "text", (col) => col.primaryKey()).addColumn("status", "text", (col) => col.notNull().defaultTo("pending").check(sql`status in ('pending', 'approved', 'rejected')`)).addColumn("collection", "text", (col) => col.notNull()).addColumn("entry_id", "text", (col) => col.notNull()).addColumn("scope", "text", (col) => col.notNull()).addColumn("live_revision_id", "text").addColumn("draft_revision_id", "text").addColumn("reviewed_rev", "text", (col) => col.notNull()).addColumn("action_type", "text", (col) => col.notNull()).addColumn("action_hash", "text", (col) => col.notNull()).addColumn("risk_reason", "text").addColumn("review_payload", "text", (col) => col.notNull()).addColumn("requested_by_actor_type", "text", (col) => col.notNull().check(sql`requested_by_actor_type in ('user', 'api_token', 'system')`)).addColumn("requested_by_actor_id", "text", (col) => col.notNull()).addColumn("requested_auth_metadata", "text").addColumn("resolved_by_actor_type", "text", (col) => col.check(sql`resolved_by_actor_type is null or resolved_by_actor_type in ('user', 'api_token', 'system')`)).addColumn("resolved_by_actor_id", "text").addColumn("resolved_auth_metadata", "text").addColumn("review_note", "text").addColumn("created_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).addColumn("updated_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).addColumn("resolved_at", "text").execute();
|
|
1682
1682
|
await db.schema.createIndex("idx_dineway_review_status_created").on("_dineway_review_requests").columns(["status", "created_at"]).execute();
|
|
1683
1683
|
await db.schema.createIndex("idx_dineway_review_target").on("_dineway_review_requests").columns([
|
|
@@ -1698,15 +1698,15 @@ async function up$85(db) {
|
|
|
1698
1698
|
]).execute();
|
|
1699
1699
|
await db.schema.createIndex("idx_dineway_review_resolved_at").on("_dineway_review_requests").column("resolved_at").execute();
|
|
1700
1700
|
}
|
|
1701
|
-
async function down$
|
|
1701
|
+
async function down$86(db) {
|
|
1702
1702
|
await db.schema.dropTable("_dineway_review_requests").execute();
|
|
1703
1703
|
}
|
|
1704
1704
|
|
|
1705
1705
|
//#endregion
|
|
1706
1706
|
//#region src/database/migrations/039_entity_aliases.ts
|
|
1707
1707
|
var _039_entity_aliases_exports = /* @__PURE__ */ __exportAll({
|
|
1708
|
-
down: () => down$
|
|
1709
|
-
up: () => up$
|
|
1708
|
+
down: () => down$85,
|
|
1709
|
+
up: () => up$85
|
|
1710
1710
|
});
|
|
1711
1711
|
const ENTITY_ALIAS_TYPES = [
|
|
1712
1712
|
"content",
|
|
@@ -1721,7 +1721,7 @@ const ENTITY_ALIAS_TYPES = [
|
|
|
1721
1721
|
* This replaces CRMy's PostgreSQL-specific alias arrays with a normalized
|
|
1722
1722
|
* mapping table that works across SQLite/libSQL and PostgreSQL.
|
|
1723
1723
|
*/
|
|
1724
|
-
async function up$
|
|
1724
|
+
async function up$85(db) {
|
|
1725
1725
|
const entityTypesSql = sql.join(ENTITY_ALIAS_TYPES.map((value) => sql.lit(value)), sql`, `);
|
|
1726
1726
|
await db.schema.createTable("_dineway_entity_aliases").addColumn("id", "text", (col) => col.primaryKey()).addColumn("entity_type", "text", (col) => col.notNull().check(sql`entity_type in (${entityTypesSql})`)).addColumn("collection_slug", "text").addColumn("entity_id", "text", (col) => col.notNull()).addColumn("alias", "text", (col) => col.notNull()).addColumn("normalized_alias", "text", (col) => col.notNull()).addColumn("created_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).execute();
|
|
1727
1727
|
await db.schema.createIndex("idx_dineway_entity_alias_lookup").on("_dineway_entity_aliases").columns(["entity_type", "normalized_alias"]).execute();
|
|
@@ -1738,15 +1738,15 @@ async function up$84(db) {
|
|
|
1738
1738
|
"normalized_alias"
|
|
1739
1739
|
]).unique().execute();
|
|
1740
1740
|
}
|
|
1741
|
-
async function down$
|
|
1741
|
+
async function down$85(db) {
|
|
1742
1742
|
await db.schema.dropTable("_dineway_entity_aliases").execute();
|
|
1743
1743
|
}
|
|
1744
1744
|
|
|
1745
1745
|
//#endregion
|
|
1746
1746
|
//#region src/database/migrations/040_handoff_snapshots.ts
|
|
1747
1747
|
var _040_handoff_snapshots_exports = /* @__PURE__ */ __exportAll({
|
|
1748
|
-
down: () => down$
|
|
1749
|
-
up: () => up$
|
|
1748
|
+
down: () => down$84,
|
|
1749
|
+
up: () => up$84
|
|
1750
1750
|
});
|
|
1751
1751
|
const ACTOR_TYPES$4 = [
|
|
1752
1752
|
"user",
|
|
@@ -1759,7 +1759,7 @@ const HANDOFF_KINDS = [
|
|
|
1759
1759
|
"assignment"
|
|
1760
1760
|
];
|
|
1761
1761
|
const REFERENCE_TYPES = ["review_request", "assignment"];
|
|
1762
|
-
async function up$
|
|
1762
|
+
async function up$84(db) {
|
|
1763
1763
|
const actorTypesSql = sql.join(ACTOR_TYPES$4.map((value) => sql.lit(value)), sql`, `);
|
|
1764
1764
|
const handoffKindsSql = sql.join(HANDOFF_KINDS.map((value) => sql.lit(value)), sql`, `);
|
|
1765
1765
|
const referenceTypesSql = sql.join(REFERENCE_TYPES.map((value) => sql.lit(value)), sql`, `);
|
|
@@ -1773,15 +1773,15 @@ async function up$83(db) {
|
|
|
1773
1773
|
await db.schema.createIndex("idx_dineway_handoff_kind_created").on("_dineway_handoff_snapshots").columns(["handoff_kind", "created_at"]).execute();
|
|
1774
1774
|
await db.schema.createIndex("idx_dineway_handoff_reference").on("_dineway_handoff_snapshots").columns(["reference_type", "reference_id"]).execute();
|
|
1775
1775
|
}
|
|
1776
|
-
async function down$
|
|
1776
|
+
async function down$84(db) {
|
|
1777
1777
|
await db.schema.dropTable("_dineway_handoff_snapshots").execute();
|
|
1778
1778
|
}
|
|
1779
1779
|
|
|
1780
1780
|
//#endregion
|
|
1781
1781
|
//#region src/database/migrations/041_assignments.ts
|
|
1782
1782
|
var _041_assignments_exports = /* @__PURE__ */ __exportAll({
|
|
1783
|
-
down: () => down$
|
|
1784
|
-
up: () => up$
|
|
1783
|
+
down: () => down$83,
|
|
1784
|
+
up: () => up$83
|
|
1785
1785
|
});
|
|
1786
1786
|
const ACTOR_TYPES$3 = [
|
|
1787
1787
|
"user",
|
|
@@ -1803,7 +1803,7 @@ const ASSIGNMENT_PRIORITIES = [
|
|
|
1803
1803
|
"high",
|
|
1804
1804
|
"urgent"
|
|
1805
1805
|
];
|
|
1806
|
-
async function up$
|
|
1806
|
+
async function up$83(db) {
|
|
1807
1807
|
const actorTypesSql = sql.join(ACTOR_TYPES$3.map((value) => sql.lit(value)), sql`, `);
|
|
1808
1808
|
const statusesSql = sql.join(ASSIGNMENT_STATUSES.map((value) => sql.lit(value)), sql`, `);
|
|
1809
1809
|
const prioritiesSql = sql.join(ASSIGNMENT_PRIORITIES.map((value) => sql.lit(value)), sql`, `);
|
|
@@ -1835,15 +1835,15 @@ async function up$82(db) {
|
|
|
1835
1835
|
await db.schema.createIndex("idx_dineway_assignment_due_at").on("_dineway_assignments").column("due_at").execute();
|
|
1836
1836
|
await db.schema.createIndex("idx_dineway_assignment_handoff").on("_dineway_assignments").column("related_handoff_snapshot_id").execute();
|
|
1837
1837
|
}
|
|
1838
|
-
async function down$
|
|
1838
|
+
async function down$83(db) {
|
|
1839
1839
|
await db.schema.dropTable("_dineway_assignments").execute();
|
|
1840
1840
|
}
|
|
1841
1841
|
|
|
1842
1842
|
//#endregion
|
|
1843
1843
|
//#region src/database/migrations/042_hitl_requests.ts
|
|
1844
1844
|
var _042_hitl_requests_exports = /* @__PURE__ */ __exportAll({
|
|
1845
|
-
down: () => down$
|
|
1846
|
-
up: () => up$
|
|
1845
|
+
down: () => down$82,
|
|
1846
|
+
up: () => up$82
|
|
1847
1847
|
});
|
|
1848
1848
|
const ACTOR_TYPES$2 = [
|
|
1849
1849
|
"user",
|
|
@@ -1861,7 +1861,7 @@ const HITL_PRIORITIES = [
|
|
|
1861
1861
|
"high",
|
|
1862
1862
|
"urgent"
|
|
1863
1863
|
];
|
|
1864
|
-
async function up$
|
|
1864
|
+
async function up$82(db) {
|
|
1865
1865
|
const actorTypesSql = sql.join(ACTOR_TYPES$2.map((value) => sql.lit(value)), sql`, `);
|
|
1866
1866
|
const statusesSql = sql.join(HITL_STATUSES.map((value) => sql.lit(value)), sql`, `);
|
|
1867
1867
|
const prioritiesSql = sql.join(HITL_PRIORITIES.map((value) => sql.lit(value)), sql`, `);
|
|
@@ -1896,7 +1896,7 @@ async function up$81(db) {
|
|
|
1896
1896
|
await db.schema.createIndex("idx_dineway_hitl_sla_due_at").on("_dineway_hitl_requests").column("sla_due_at").execute();
|
|
1897
1897
|
await db.schema.createIndex("idx_dineway_assignment_hitl").on("_dineway_assignments").column("related_hitl_request_id").execute();
|
|
1898
1898
|
}
|
|
1899
|
-
async function down$
|
|
1899
|
+
async function down$82(db) {
|
|
1900
1900
|
await db.schema.dropIndex("idx_dineway_assignment_hitl").execute();
|
|
1901
1901
|
await db.schema.alterTable("_dineway_assignments").dropColumn("related_hitl_request_id").execute();
|
|
1902
1902
|
await db.schema.dropTable("_dineway_hitl_requests").execute();
|
|
@@ -1905,8 +1905,8 @@ async function down$81(db) {
|
|
|
1905
1905
|
//#endregion
|
|
1906
1906
|
//#region src/database/migrations/043_bounded_404_log.ts
|
|
1907
1907
|
var _043_bounded_404_log_exports = /* @__PURE__ */ __exportAll({
|
|
1908
|
-
down: () => down$
|
|
1909
|
-
up: () => up$
|
|
1908
|
+
down: () => down$81,
|
|
1909
|
+
up: () => up$81
|
|
1910
1910
|
});
|
|
1911
1911
|
/**
|
|
1912
1912
|
* Migration: Bounded 404 logging
|
|
@@ -1915,7 +1915,7 @@ var _043_bounded_404_log_exports = /* @__PURE__ */ __exportAll({
|
|
|
1915
1915
|
* Previously every 404 inserted a new row, so a requester could grow the
|
|
1916
1916
|
* table without bound by hitting unique URLs.
|
|
1917
1917
|
*/
|
|
1918
|
-
async function up$
|
|
1918
|
+
async function up$81(db) {
|
|
1919
1919
|
await db.schema.alterTable("_dineway_404_log").addColumn("hits", "integer", (col) => col.notNull().defaultTo(1)).execute();
|
|
1920
1920
|
await db.schema.alterTable("_dineway_404_log").addColumn("last_seen_at", "text").execute();
|
|
1921
1921
|
await sql`
|
|
@@ -1961,7 +1961,7 @@ async function up$80(db) {
|
|
|
1961
1961
|
await db.schema.dropIndex("idx_404_log_path").execute();
|
|
1962
1962
|
await db.schema.createIndex("idx_404_log_last_seen").on("_dineway_404_log").column("last_seen_at").execute();
|
|
1963
1963
|
}
|
|
1964
|
-
async function down$
|
|
1964
|
+
async function down$81(db) {
|
|
1965
1965
|
await db.schema.dropIndex("idx_404_log_last_seen").execute();
|
|
1966
1966
|
await db.schema.dropIndex("idx_404_log_path_unique").execute();
|
|
1967
1967
|
await db.schema.createIndex("idx_404_log_path").on("_dineway_404_log").column("path").execute();
|
|
@@ -1972,21 +1972,21 @@ async function down$80(db) {
|
|
|
1972
1972
|
//#endregion
|
|
1973
1973
|
//#region src/database/migrations/044_credential_algorithm.ts
|
|
1974
1974
|
var _044_credential_algorithm_exports = /* @__PURE__ */ __exportAll({
|
|
1975
|
-
down: () => down$
|
|
1976
|
-
up: () => up$
|
|
1975
|
+
down: () => down$80,
|
|
1976
|
+
up: () => up$80
|
|
1977
1977
|
});
|
|
1978
|
-
async function up$
|
|
1978
|
+
async function up$80(db) {
|
|
1979
1979
|
if (!await columnExists(db, "credentials", "algorithm")) await db.schema.alterTable("credentials").addColumn("algorithm", "integer", (col) => col.notNull().defaultTo(-7)).execute();
|
|
1980
1980
|
}
|
|
1981
|
-
async function down$
|
|
1981
|
+
async function down$80(db) {
|
|
1982
1982
|
if (await columnExists(db, "credentials", "algorithm")) await db.schema.alterTable("credentials").dropColumn("algorithm").execute();
|
|
1983
1983
|
}
|
|
1984
1984
|
|
|
1985
1985
|
//#endregion
|
|
1986
1986
|
//#region src/database/migrations/045_i18n_menus_and_taxonomies.ts
|
|
1987
1987
|
var _045_i18n_menus_and_taxonomies_exports = /* @__PURE__ */ __exportAll({
|
|
1988
|
-
down: () => down$
|
|
1989
|
-
up: () => up$
|
|
1988
|
+
down: () => down$79,
|
|
1989
|
+
up: () => up$79
|
|
1990
1990
|
});
|
|
1991
1991
|
/**
|
|
1992
1992
|
* i18n for menus + taxonomies. Adds `locale` + `translation_group` to system
|
|
@@ -1997,7 +1997,7 @@ var _045_i18n_menus_and_taxonomies_exports = /* @__PURE__ */ __exportAll({
|
|
|
1997
1997
|
function getDefaultLocale$1() {
|
|
1998
1998
|
return getI18nConfig()?.defaultLocale ?? "en";
|
|
1999
1999
|
}
|
|
2000
|
-
async function up$
|
|
2000
|
+
async function up$79(db) {
|
|
2001
2001
|
const defaultLocale = getDefaultLocale$1();
|
|
2002
2002
|
if (isSqlite(db)) {
|
|
2003
2003
|
await sql.raw(`PRAGMA foreign_keys = OFF`).execute(db);
|
|
@@ -2188,7 +2188,7 @@ async function assertSingleLocale$1(db, defaultLocale) {
|
|
|
2188
2188
|
if (count > 0) throw new Error(`Cannot revert migration 045_i18n_menus_and_taxonomies: ${count} row(s) in "${table}" use a non-default locale (defaultLocale="${defaultLocale}"). Reverting would drop them silently. Export translations first (or delete them) and re-run the rollback. See packages/core/src/database/migrations/045_i18n_menus_and_taxonomies.ts.`);
|
|
2189
2189
|
}
|
|
2190
2190
|
}
|
|
2191
|
-
async function down$
|
|
2191
|
+
async function down$79(db) {
|
|
2192
2192
|
const defaultLocale = getDefaultLocale$1();
|
|
2193
2193
|
await assertSingleLocale$1(db, defaultLocale);
|
|
2194
2194
|
const widenedTables = [
|
|
@@ -2282,21 +2282,21 @@ async function rebuildTaxonomyDefsDown(db) {
|
|
|
2282
2282
|
//#endregion
|
|
2283
2283
|
//#region src/database/migrations/046_astro_sessions.ts
|
|
2284
2284
|
var _046_astro_sessions_exports = /* @__PURE__ */ __exportAll({
|
|
2285
|
-
down: () => down$
|
|
2286
|
-
up: () => up$
|
|
2285
|
+
down: () => down$78,
|
|
2286
|
+
up: () => up$78
|
|
2287
2287
|
});
|
|
2288
|
-
async function up$
|
|
2288
|
+
async function up$78(db) {
|
|
2289
2289
|
await db.schema.createTable("_dineway_sessions").ifNotExists().addColumn("id", "text", (col) => col.primaryKey()).addColumn("value", "text", (col) => col.notNull()).addColumn("updated_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).execute();
|
|
2290
2290
|
}
|
|
2291
|
-
async function down$
|
|
2291
|
+
async function down$78(db) {
|
|
2292
2292
|
await db.schema.dropTable("_dineway_sessions").ifExists().execute();
|
|
2293
2293
|
}
|
|
2294
2294
|
|
|
2295
2295
|
//#endregion
|
|
2296
2296
|
//#region src/database/migrations/047_content_locale_list_index.ts
|
|
2297
2297
|
var _047_content_locale_list_index_exports = /* @__PURE__ */ __exportAll({
|
|
2298
|
-
down: () => down$
|
|
2299
|
-
up: () => up$
|
|
2298
|
+
down: () => down$77,
|
|
2299
|
+
up: () => up$77
|
|
2300
2300
|
});
|
|
2301
2301
|
/**
|
|
2302
2302
|
* Add locale-aware composite indexes for content list queries.
|
|
@@ -2306,7 +2306,7 @@ var _047_content_locale_list_index_exports = /* @__PURE__ */ __exportAll({
|
|
|
2306
2306
|
* path but omit locale, so locale-filtered lists cannot be served by one index
|
|
2307
2307
|
* on large tables.
|
|
2308
2308
|
*/
|
|
2309
|
-
async function up$
|
|
2309
|
+
async function up$77(db) {
|
|
2310
2310
|
const tableNames = await listTablesLike(db, "ec_%");
|
|
2311
2311
|
for (const tableName of tableNames) {
|
|
2312
2312
|
await sql`
|
|
@@ -2319,7 +2319,7 @@ async function up$76(db) {
|
|
|
2319
2319
|
`.execute(db);
|
|
2320
2320
|
}
|
|
2321
2321
|
}
|
|
2322
|
-
async function down$
|
|
2322
|
+
async function down$77(db) {
|
|
2323
2323
|
const tableNames = await listTablesLike(db, "ec_%");
|
|
2324
2324
|
for (const tableName of tableNames) {
|
|
2325
2325
|
await sql`DROP INDEX IF EXISTS ${sql.ref(contentLocaleUpdatedIndexName(tableName))}`.execute(db);
|
|
@@ -2330,8 +2330,8 @@ async function down$76(db) {
|
|
|
2330
2330
|
//#endregion
|
|
2331
2331
|
//#region src/database/migrations/048_byline_i18n.ts
|
|
2332
2332
|
var _048_byline_i18n_exports = /* @__PURE__ */ __exportAll({
|
|
2333
|
-
down: () => down$
|
|
2334
|
-
up: () => up$
|
|
2333
|
+
down: () => down$76,
|
|
2334
|
+
up: () => up$76
|
|
2335
2335
|
});
|
|
2336
2336
|
/**
|
|
2337
2337
|
* Adds row-per-locale bylines.
|
|
@@ -2344,7 +2344,7 @@ var _048_byline_i18n_exports = /* @__PURE__ */ __exportAll({
|
|
|
2344
2344
|
function getDefaultLocale() {
|
|
2345
2345
|
return getI18nConfig()?.defaultLocale ?? "en";
|
|
2346
2346
|
}
|
|
2347
|
-
async function up$
|
|
2347
|
+
async function up$76(db) {
|
|
2348
2348
|
const defaultLocale = getDefaultLocale();
|
|
2349
2349
|
if (isSqlite(db)) {
|
|
2350
2350
|
await rebuildContentBylines(db);
|
|
@@ -2503,7 +2503,7 @@ async function assertSingleLocale(db, defaultLocale) {
|
|
|
2503
2503
|
const count = Number(result.rows[0]?.count ?? 0);
|
|
2504
2504
|
if (count > 0) throw new Error(`Cannot revert migration 048_byline_i18n: ${count} row(s) in "_dineway_bylines" use a non-default locale (defaultLocale="${defaultLocale}").`);
|
|
2505
2505
|
}
|
|
2506
|
-
async function down$
|
|
2506
|
+
async function down$76(db) {
|
|
2507
2507
|
const defaultLocale = getDefaultLocale();
|
|
2508
2508
|
await assertSingleLocale(db, defaultLocale);
|
|
2509
2509
|
await assertContentBylinesResolve(db, defaultLocale);
|
|
@@ -2625,10 +2625,10 @@ async function restoreContentBylinesFk(db) {
|
|
|
2625
2625
|
//#endregion
|
|
2626
2626
|
//#region src/database/migrations/049_byline_fields.ts
|
|
2627
2627
|
var _049_byline_fields_exports = /* @__PURE__ */ __exportAll({
|
|
2628
|
-
down: () => down$
|
|
2629
|
-
up: () => up$
|
|
2628
|
+
down: () => down$75,
|
|
2629
|
+
up: () => up$75
|
|
2630
2630
|
});
|
|
2631
|
-
async function up$
|
|
2631
|
+
async function up$75(db) {
|
|
2632
2632
|
await db.schema.createTable("_dineway_byline_fields").ifNotExists().addColumn("id", "text", (col) => col.primaryKey()).addColumn("slug", "text", (col) => col.notNull().unique()).addColumn("label", "text", (col) => col.notNull()).addColumn("type", "text", (col) => col.notNull()).addColumn("required", "integer", (col) => col.notNull().defaultTo(0)).addColumn("translatable", "integer", (col) => col.notNull().defaultTo(1)).addColumn("validation", "text").addColumn("sort_order", "integer", (col) => col.notNull().defaultTo(0)).addColumn("created_at", "text", (col) => col.defaultTo(currentTimestamp$1(db))).addColumn("updated_at", "text", (col) => col.defaultTo(currentTimestamp$1(db))).execute();
|
|
2633
2633
|
await db.schema.createIndex("idx__dineway_byline_fields_sort_order").ifNotExists().on("_dineway_byline_fields").column("sort_order").execute();
|
|
2634
2634
|
await db.schema.createTable("_dineway_byline_field_values").ifNotExists().addColumn("byline_id", "text", (col) => col.notNull().references("_dineway_bylines.id").onDelete("cascade")).addColumn("field_id", "text", (col) => col.notNull().references("_dineway_byline_fields.id").onDelete("cascade")).addColumn("value", "text").addColumn("created_at", "text", (col) => col.defaultTo(currentTimestamp$1(db))).addColumn("updated_at", "text", (col) => col.defaultTo(currentTimestamp$1(db))).addPrimaryKeyConstraint("_dineway_byline_field_values_pk", ["byline_id", "field_id"]).execute();
|
|
@@ -2642,7 +2642,7 @@ async function up$74(db) {
|
|
|
2642
2642
|
ON CONFLICT (name) DO NOTHING
|
|
2643
2643
|
`.execute(db);
|
|
2644
2644
|
}
|
|
2645
|
-
async function down$
|
|
2645
|
+
async function down$75(db) {
|
|
2646
2646
|
await db.schema.dropTable("_dineway_byline_field_group_values").ifExists().execute();
|
|
2647
2647
|
await db.schema.dropTable("_dineway_byline_field_values").ifExists().execute();
|
|
2648
2648
|
await db.schema.dropTable("_dineway_byline_fields").ifExists().execute();
|
|
@@ -2652,8 +2652,8 @@ async function down$74(db) {
|
|
|
2652
2652
|
//#endregion
|
|
2653
2653
|
//#region src/database/migrations/050_content_references.ts
|
|
2654
2654
|
var _050_content_references_exports = /* @__PURE__ */ __exportAll({
|
|
2655
|
-
down: () => down$
|
|
2656
|
-
up: () => up$
|
|
2655
|
+
down: () => down$74,
|
|
2656
|
+
up: () => up$74
|
|
2657
2657
|
});
|
|
2658
2658
|
/**
|
|
2659
2659
|
* Content references.
|
|
@@ -2662,7 +2662,7 @@ var _050_content_references_exports = /* @__PURE__ */ __exportAll({
|
|
|
2662
2662
|
* with one localized row per locale. `_dineway_content_references` stores
|
|
2663
2663
|
* parent -> child edges keyed by translation groups so edges are locale-agnostic.
|
|
2664
2664
|
*/
|
|
2665
|
-
async function up$
|
|
2665
|
+
async function up$74(db) {
|
|
2666
2666
|
const defaultLocale = getI18nConfig()?.defaultLocale ?? "en";
|
|
2667
2667
|
await db.schema.createTable("_dineway_relations").ifNotExists().addColumn("id", "text", (col) => col.primaryKey()).addColumn("name", "text", (col) => col.notNull()).addColumn("parent_collection", "text", (col) => col.notNull()).addColumn("child_collection", "text", (col) => col.notNull()).addColumn("parent_label", "text", (col) => col.notNull()).addColumn("child_label", "text", (col) => col.notNull()).addColumn("locale", "text", (col) => col.notNull().defaultTo(defaultLocale)).addColumn("translation_group", "text", (col) => col.notNull()).addColumn("created_at", "text", (col) => col.defaultTo(currentTimestamp$1(db))).addColumn("updated_at", "text", (col) => col.defaultTo(currentTimestamp$1(db))).addUniqueConstraint("_dineway_relations_name_locale_unique", ["name", "locale"]).execute();
|
|
2668
2668
|
await db.schema.createIndex("idx__dineway_relations_locale").ifNotExists().on("_dineway_relations").column("locale").execute();
|
|
@@ -2683,7 +2683,7 @@ async function up$73(db) {
|
|
|
2683
2683
|
await db.schema.createIndex("idx__dineway_content_references_child").ifNotExists().on("_dineway_content_references").columns(["child_group", "relation_group"]).execute();
|
|
2684
2684
|
await db.schema.createIndex("idx__dineway_content_references_relation").ifNotExists().on("_dineway_content_references").column("relation_group").execute();
|
|
2685
2685
|
}
|
|
2686
|
-
async function down$
|
|
2686
|
+
async function down$74(db) {
|
|
2687
2687
|
await db.schema.dropTable("_dineway_content_references").ifExists().execute();
|
|
2688
2688
|
await db.schema.dropTable("_dineway_relations").ifExists().execute();
|
|
2689
2689
|
}
|
|
@@ -2691,8 +2691,8 @@ async function down$73(db) {
|
|
|
2691
2691
|
//#endregion
|
|
2692
2692
|
//#region src/database/migrations/051_dineway_web_plugin.ts
|
|
2693
2693
|
var _051_dineway_web_plugin_exports = /* @__PURE__ */ __exportAll({
|
|
2694
|
-
down: () => down$
|
|
2695
|
-
up: () => up$
|
|
2694
|
+
down: () => down$73,
|
|
2695
|
+
up: () => up$73
|
|
2696
2696
|
});
|
|
2697
2697
|
const SESSION_STATUSES = [
|
|
2698
2698
|
"active",
|
|
@@ -2727,7 +2727,7 @@ const HANDOFF_AUDIT_EVENTS = [
|
|
|
2727
2727
|
function enumValues(values) {
|
|
2728
2728
|
return sql.join(values.map((value) => sql.lit(value)), sql`, `);
|
|
2729
2729
|
}
|
|
2730
|
-
async function up$
|
|
2730
|
+
async function up$73(db) {
|
|
2731
2731
|
const sessionStatuses = enumValues(SESSION_STATUSES);
|
|
2732
2732
|
const onboardingStatuses = enumValues(ONBOARDING_STATUSES);
|
|
2733
2733
|
const checkoutStatuses = enumValues(CHECKOUT_STATUSES);
|
|
@@ -2770,7 +2770,7 @@ async function up$72(db) {
|
|
|
2770
2770
|
await db.schema.createIndex("idx_dineway_web_handoff_audit_handoff").ifNotExists().on("_dineway_dineway_web_handoff_audit").column("handoff_id").execute();
|
|
2771
2771
|
await db.schema.createIndex("idx_dineway_web_handoff_audit_event").ifNotExists().on("_dineway_dineway_web_handoff_audit").column("event").execute();
|
|
2772
2772
|
}
|
|
2773
|
-
async function down$
|
|
2773
|
+
async function down$73(db) {
|
|
2774
2774
|
await db.schema.dropTable("_dineway_dineway_web_handoff_audit").ifExists().execute();
|
|
2775
2775
|
await db.schema.dropTable("_dineway_dineway_web_handoffs").ifExists().execute();
|
|
2776
2776
|
await db.schema.dropTable("_dineway_dineway_web_sites_projections").ifExists().execute();
|
|
@@ -2785,19 +2785,19 @@ async function down$72(db) {
|
|
|
2785
2785
|
//#endregion
|
|
2786
2786
|
//#region src/database/migrations/052_taxonomies_name_locale_index.ts
|
|
2787
2787
|
var _052_taxonomies_name_locale_index_exports = /* @__PURE__ */ __exportAll({
|
|
2788
|
-
down: () => down$
|
|
2789
|
-
up: () => up$
|
|
2788
|
+
down: () => down$72,
|
|
2789
|
+
up: () => up$72
|
|
2790
2790
|
});
|
|
2791
2791
|
/**
|
|
2792
2792
|
* Add a composite taxonomy lookup index for queries that filter by name and locale.
|
|
2793
2793
|
* The composite's leftmost prefix covers name-only lookups, so it replaces the
|
|
2794
2794
|
* older single-column name index while preserving the locale-only index.
|
|
2795
2795
|
*/
|
|
2796
|
-
async function up$
|
|
2796
|
+
async function up$72(db) {
|
|
2797
2797
|
await db.schema.createIndex("idx_taxonomies_name_locale").ifNotExists().on("taxonomies").columns(["name", "locale"]).execute();
|
|
2798
2798
|
await db.schema.dropIndex("idx_taxonomies_name").ifExists().execute();
|
|
2799
2799
|
}
|
|
2800
|
-
async function down$
|
|
2800
|
+
async function down$72(db) {
|
|
2801
2801
|
await db.schema.createIndex("idx_taxonomies_name").ifNotExists().on("taxonomies").column("name").execute();
|
|
2802
2802
|
await db.schema.dropIndex("idx_taxonomies_name_locale").ifExists().execute();
|
|
2803
2803
|
}
|
|
@@ -2805,8 +2805,8 @@ async function down$71(db) {
|
|
|
2805
2805
|
//#endregion
|
|
2806
2806
|
//#region src/database/migrations/053_restore_content_taxonomies_term_index.ts
|
|
2807
2807
|
var _053_restore_content_taxonomies_term_index_exports = /* @__PURE__ */ __exportAll({
|
|
2808
|
-
down: () => down$
|
|
2809
|
-
up: () => up$
|
|
2808
|
+
down: () => down$71,
|
|
2809
|
+
up: () => up$71
|
|
2810
2810
|
});
|
|
2811
2811
|
/**
|
|
2812
2812
|
* Restore the reverse lookup index on content taxonomy assignments.
|
|
@@ -2815,16 +2815,16 @@ var _053_restore_content_taxonomies_term_index_exports = /* @__PURE__ */ __expor
|
|
|
2815
2815
|
* covers upgraded SQLite databases that already recorded the table rebuild but
|
|
2816
2816
|
* ended up missing only this index.
|
|
2817
2817
|
*/
|
|
2818
|
-
async function up$
|
|
2818
|
+
async function up$71(db) {
|
|
2819
2819
|
await db.schema.createIndex("idx_content_taxonomies_term").ifNotExists().on("content_taxonomies").column("taxonomy_id").execute();
|
|
2820
2820
|
}
|
|
2821
|
-
async function down$
|
|
2821
|
+
async function down$71(db) {}
|
|
2822
2822
|
|
|
2823
2823
|
//#endregion
|
|
2824
2824
|
//#region src/database/migrations/054_restore_taxonomy_parent_index.ts
|
|
2825
2825
|
var _054_restore_taxonomy_parent_index_exports = /* @__PURE__ */ __exportAll({
|
|
2826
|
-
down: () => down$
|
|
2827
|
-
up: () => up$
|
|
2826
|
+
down: () => down$70,
|
|
2827
|
+
up: () => up$70
|
|
2828
2828
|
});
|
|
2829
2829
|
/**
|
|
2830
2830
|
* Restore the parent lookup index on hierarchical taxonomy terms.
|
|
@@ -2833,16 +2833,16 @@ var _054_restore_taxonomy_parent_index_exports = /* @__PURE__ */ __exportAll({
|
|
|
2833
2833
|
* could drop it on upgraded databases. Fresh installs recreate it in the
|
|
2834
2834
|
* rebuild path; this forward repair covers already-migrated databases.
|
|
2835
2835
|
*/
|
|
2836
|
-
async function up$
|
|
2836
|
+
async function up$70(db) {
|
|
2837
2837
|
await db.schema.createIndex("idx_taxonomies_parent").ifNotExists().on("taxonomies").column("parent_id").execute();
|
|
2838
2838
|
}
|
|
2839
|
-
async function down$
|
|
2839
|
+
async function down$70(db) {}
|
|
2840
2840
|
|
|
2841
2841
|
//#endregion
|
|
2842
2842
|
//#region src/database/migrations/055_taxonomy_parent_group.ts
|
|
2843
2843
|
var _055_taxonomy_parent_group_exports = /* @__PURE__ */ __exportAll({
|
|
2844
|
-
down: () => down$
|
|
2845
|
-
up: () => up$
|
|
2844
|
+
down: () => down$69,
|
|
2845
|
+
up: () => up$69
|
|
2846
2846
|
});
|
|
2847
2847
|
/**
|
|
2848
2848
|
* Store the parent's `translation_group` in `taxonomies.parent_id` instead of a
|
|
@@ -2857,7 +2857,7 @@ var _055_taxonomy_parent_group_exports = /* @__PURE__ */ __exportAll({
|
|
|
2857
2857
|
* anchor row's id. Only rewrite when that anchor row exists; otherwise keep the
|
|
2858
2858
|
* existing row id rather than writing a dangling FK value.
|
|
2859
2859
|
*/
|
|
2860
|
-
async function up$
|
|
2860
|
+
async function up$69(db) {
|
|
2861
2861
|
await sql`
|
|
2862
2862
|
UPDATE taxonomies
|
|
2863
2863
|
SET parent_id = (
|
|
@@ -2884,7 +2884,7 @@ async function up$68(db) {
|
|
|
2884
2884
|
* Rows with no same-locale parent are left as-is so rollback does not silently
|
|
2885
2885
|
* detach a subtree.
|
|
2886
2886
|
*/
|
|
2887
|
-
async function down$
|
|
2887
|
+
async function down$69(db) {
|
|
2888
2888
|
await sql`
|
|
2889
2889
|
UPDATE taxonomies
|
|
2890
2890
|
SET parent_id = COALESCE(
|
|
@@ -2903,8 +2903,8 @@ async function down$68(db) {
|
|
|
2903
2903
|
//#endregion
|
|
2904
2904
|
//#region src/database/migrations/056_media_usage_index.ts
|
|
2905
2905
|
var _056_media_usage_index_exports = /* @__PURE__ */ __exportAll({
|
|
2906
|
-
down: () => down$
|
|
2907
|
-
up: () => up$
|
|
2906
|
+
down: () => down$68,
|
|
2907
|
+
up: () => up$68
|
|
2908
2908
|
});
|
|
2909
2909
|
/**
|
|
2910
2910
|
* Internal media usage projection tables.
|
|
@@ -2913,7 +2913,7 @@ var _056_media_usage_index_exports = /* @__PURE__ */ __exportAll({
|
|
|
2913
2913
|
* imports, and no content-table scans. Production rows are introduced by later
|
|
2914
2914
|
* phases once the central snapshot/indexer path is reviewed.
|
|
2915
2915
|
*/
|
|
2916
|
-
async function up$
|
|
2916
|
+
async function up$68(db) {
|
|
2917
2917
|
await db.schema.createTable("_dineway_media_usage_sources").ifNotExists().addColumn("source_key", "text", (col) => col.primaryKey()).addColumn("source_type", "text", (col) => col.notNull()).addColumn("collection_slug", "text").addColumn("content_id", "text").addColumn("source_variant", "text", (col) => col.notNull()).addColumn("locale", "text").addColumn("translation_group", "text").addColumn("content_slug", "text").addColumn("content_title", "text").addColumn("content_status", "text").addColumn("content_scheduled_at", "text").addColumn("content_deleted_at", "text").addColumn("revision_id", "text").addColumn("current_generation", "text", (col) => col.notNull()).addColumn("schema_version", "integer", (col) => col.notNull().defaultTo(1)).addColumn("indexed_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).addColumn("created_at", "text", (col) => col.defaultTo(currentTimestamp$1(db))).addColumn("updated_at", "text", (col) => col.defaultTo(currentTimestamp$1(db))).execute();
|
|
2918
2918
|
await db.schema.createIndex("idx__dineway_media_usage_sources_content").ifNotExists().on("_dineway_media_usage_sources").columns([
|
|
2919
2919
|
"source_type",
|
|
@@ -2935,7 +2935,7 @@ async function up$67(db) {
|
|
|
2935
2935
|
await db.schema.createIndex("idx__dineway_media_usage_provider_asset").ifNotExists().on("_dineway_media_usage").columns(["provider", "provider_asset_id"]).execute();
|
|
2936
2936
|
await db.schema.createIndex("idx__dineway_media_usage_source_generation").ifNotExists().on("_dineway_media_usage").columns(["source_key", "generation"]).execute();
|
|
2937
2937
|
}
|
|
2938
|
-
async function down$
|
|
2938
|
+
async function down$68(db) {
|
|
2939
2939
|
await db.schema.dropTable("_dineway_media_usage").ifExists().execute();
|
|
2940
2940
|
await db.schema.dropTable("_dineway_media_usage_sources").ifExists().execute();
|
|
2941
2941
|
}
|
|
@@ -2943,8 +2943,8 @@ async function down$67(db) {
|
|
|
2943
2943
|
//#endregion
|
|
2944
2944
|
//#region src/database/migrations/057_media_usage_index_status.ts
|
|
2945
2945
|
var _057_media_usage_index_status_exports = /* @__PURE__ */ __exportAll({
|
|
2946
|
-
down: () => down$
|
|
2947
|
-
up: () => up$
|
|
2946
|
+
down: () => down$67,
|
|
2947
|
+
up: () => up$67
|
|
2948
2948
|
});
|
|
2949
2949
|
const SOURCE_TABLE = "_dineway_media_usage_sources";
|
|
2950
2950
|
const DUPLICATE_COLUMN_RE = /(?:duplicate column|column .* already exists|already exists.*column)/i;
|
|
@@ -2954,7 +2954,7 @@ const DUPLICATE_COLUMN_RE = /(?:duplicate column|column .* already exists|alread
|
|
|
2954
2954
|
* DDL-only by design: adds source metadata and adapter-scope status tracking
|
|
2955
2955
|
* without scanning content tables or importing runtime code.
|
|
2956
2956
|
*/
|
|
2957
|
-
async function up$
|
|
2957
|
+
async function up$67(db) {
|
|
2958
2958
|
await addSourceMetadataColumns(db);
|
|
2959
2959
|
await db.schema.createTable("_dineway_media_usage_index_status").ifNotExists().addColumn("adapter_id", "text", (col) => col.notNull()).addColumn("scope_type", "text", (col) => col.notNull()).addColumn("scope_key", "text", (col) => col.notNull()).addColumn("status", "text", (col) => col.notNull()).addColumn("schema_version", "integer", (col) => col.notNull().defaultTo(1)).addColumn("started_at", "text").addColumn("completed_at", "text").addColumn("cursor", "text").addColumn("indexed_source_count", "integer", (col) => col.notNull().defaultTo(0)).addColumn("failed_source_count", "integer", (col) => col.notNull().defaultTo(0)).addColumn("last_error_code", "text").addColumn("updated_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).addPrimaryKeyConstraint("_dineway_media_usage_index_status_pk", [
|
|
2960
2960
|
"adapter_id",
|
|
@@ -2969,7 +2969,7 @@ async function up$66(db) {
|
|
|
2969
2969
|
await db.schema.createIndex("idx__dineway_media_usage_sources_fingerprint").ifNotExists().on("_dineway_media_usage_sources").column("source_fingerprint").execute();
|
|
2970
2970
|
await db.schema.createIndex("idx__dineway_media_usage_index_status_status").ifNotExists().on("_dineway_media_usage_index_status").columns(["adapter_id", "status"]).execute();
|
|
2971
2971
|
}
|
|
2972
|
-
async function down$
|
|
2972
|
+
async function down$67(db) {
|
|
2973
2973
|
await db.schema.dropIndex("idx__dineway_media_usage_index_status_status").ifExists().execute();
|
|
2974
2974
|
await db.schema.dropIndex("idx__dineway_media_usage_sources_fingerprint").ifExists().execute();
|
|
2975
2975
|
await db.schema.dropIndex("idx__dineway_media_usage_sources_completeness").ifExists().execute();
|
|
@@ -3025,10 +3025,10 @@ async function dropSourceMetadataColumns(db) {
|
|
|
3025
3025
|
//#endregion
|
|
3026
3026
|
//#region src/database/migrations/058_comment_reactions.ts
|
|
3027
3027
|
var _058_comment_reactions_exports = /* @__PURE__ */ __exportAll({
|
|
3028
|
-
down: () => down$
|
|
3029
|
-
up: () => up$
|
|
3028
|
+
down: () => down$66,
|
|
3029
|
+
up: () => up$66
|
|
3030
3030
|
});
|
|
3031
|
-
async function up$
|
|
3031
|
+
async function up$66(db) {
|
|
3032
3032
|
await db.schema.createTable("_dineway_comment_reactions").addColumn("id", "text", (col) => col.primaryKey()).addColumn("comment_id", "text", (col) => col.notNull().references("_dineway_comments.id").onDelete("cascade")).addColumn("reaction", "text", (col) => col.notNull().defaultTo("like")).addColumn("voter_hash", "text", (col) => col.notNull()).addColumn("created_at", "text", (col) => col.defaultTo(currentTimestamp$1(db))).execute();
|
|
3033
3033
|
await db.schema.createIndex("idx_dineway_comment_reactions_unique").on("_dineway_comment_reactions").columns([
|
|
3034
3034
|
"comment_id",
|
|
@@ -3038,15 +3038,15 @@ async function up$65(db) {
|
|
|
3038
3038
|
await db.schema.createIndex("idx_dineway_comment_reactions_comment_id").on("_dineway_comment_reactions").column("comment_id").execute();
|
|
3039
3039
|
await db.schema.createIndex("idx_dineway_comment_reactions_voter_recent").on("_dineway_comment_reactions").columns(["voter_hash", "created_at"]).execute();
|
|
3040
3040
|
}
|
|
3041
|
-
async function down$
|
|
3041
|
+
async function down$66(db) {
|
|
3042
3042
|
await db.schema.dropTable("_dineway_comment_reactions").execute();
|
|
3043
3043
|
}
|
|
3044
3044
|
|
|
3045
3045
|
//#endregion
|
|
3046
3046
|
//#region src/database/migrations/059_hitl_executions.ts
|
|
3047
3047
|
var _059_hitl_executions_exports = /* @__PURE__ */ __exportAll({
|
|
3048
|
-
down: () => down$
|
|
3049
|
-
up: () => up$
|
|
3048
|
+
down: () => down$65,
|
|
3049
|
+
up: () => up$65
|
|
3050
3050
|
});
|
|
3051
3051
|
const ACTOR_TYPES$1 = [
|
|
3052
3052
|
"user",
|
|
@@ -3060,7 +3060,7 @@ const EXECUTION_STATUSES = [
|
|
|
3060
3060
|
"failed",
|
|
3061
3061
|
"indeterminate"
|
|
3062
3062
|
];
|
|
3063
|
-
async function up$
|
|
3063
|
+
async function up$65(db) {
|
|
3064
3064
|
const actorTypesSql = sql.join(ACTOR_TYPES$1.map((value) => sql.lit(value)), sql`, `);
|
|
3065
3065
|
const reviewModesSql = sql.join(REVIEW_MODES.map((value) => sql.lit(value)), sql`, `);
|
|
3066
3066
|
const statusesSql = sql.join(EXECUTION_STATUSES.map((value) => sql.lit(value)), sql`, `);
|
|
@@ -3085,31 +3085,31 @@ async function up$64(db) {
|
|
|
3085
3085
|
"created_at"
|
|
3086
3086
|
]).execute();
|
|
3087
3087
|
}
|
|
3088
|
-
async function down$
|
|
3088
|
+
async function down$65(db) {
|
|
3089
3089
|
await db.schema.dropTable("_dineway_hitl_executions").ifExists().execute();
|
|
3090
3090
|
}
|
|
3091
3091
|
|
|
3092
3092
|
//#endregion
|
|
3093
3093
|
//#region src/database/migrations/060_plugin_secrets.ts
|
|
3094
3094
|
var _060_plugin_secrets_exports = /* @__PURE__ */ __exportAll({
|
|
3095
|
-
down: () => down$
|
|
3096
|
-
up: () => up$
|
|
3095
|
+
down: () => down$64,
|
|
3096
|
+
up: () => up$64
|
|
3097
3097
|
});
|
|
3098
|
-
async function up$
|
|
3098
|
+
async function up$64(db) {
|
|
3099
3099
|
await db.schema.createTable("_dineway_plugin_secrets").addColumn("plugin_id", "text", (col) => col.notNull()).addColumn("secret_name", "text", (col) => col.notNull()).addColumn("encryption_version", "integer", (col) => col.notNull()).addColumn("key_id", "text", (col) => col.notNull()).addColumn("nonce", "text", (col) => col.notNull()).addColumn("ciphertext", "text", (col) => col.notNull()).addColumn("fingerprint", "text", (col) => col.notNull()).addColumn("created_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).addColumn("updated_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).addPrimaryKeyConstraint("pk_dineway_plugin_secrets", ["plugin_id", "secret_name"]).execute();
|
|
3100
3100
|
await db.schema.createIndex("idx_dineway_plugin_secrets_plugin_updated").on("_dineway_plugin_secrets").columns(["plugin_id", "updated_at"]).execute();
|
|
3101
3101
|
}
|
|
3102
|
-
async function down$
|
|
3102
|
+
async function down$64(db) {
|
|
3103
3103
|
await db.schema.dropTable("_dineway_plugin_secrets").execute();
|
|
3104
3104
|
}
|
|
3105
3105
|
|
|
3106
3106
|
//#endregion
|
|
3107
3107
|
//#region src/database/migrations/061_restaurant_locations.ts
|
|
3108
3108
|
var _061_restaurant_locations_exports = /* @__PURE__ */ __exportAll({
|
|
3109
|
-
down: () => down$
|
|
3110
|
-
up: () => up$
|
|
3109
|
+
down: () => down$63,
|
|
3110
|
+
up: () => up$63
|
|
3111
3111
|
});
|
|
3112
|
-
async function up$
|
|
3112
|
+
async function up$63(db) {
|
|
3113
3113
|
await db.schema.createTable("restaurant_locations").addColumn("id", "text", (col) => col.primaryKey()).addColumn("slug", "text", (col) => col.notNull().unique()).addColumn("name", "text", (col) => col.notNull()).addColumn("status", "text", (col) => col.notNull().check(sql`status in ('active', 'archived')`).defaultTo("active")).addColumn("active_slot", "integer", (col) => col.unique().check(sql`active_slot between 1 and 5`)).addColumn("default_key", "text", (col) => col.unique().check(sql`default_key = 'default'`)).addColumn("timezone", "text", (col) => col.notNull()).addColumn("currency", "text", (col) => col.notNull()).addColumn("address_line1", "text").addColumn("address_line2", "text").addColumn("city", "text").addColumn("region", "text").addColumn("postal_code", "text").addColumn("country_code", "text").addColumn("latitude", "real").addColumn("longitude", "real").addColumn("phone", "text").addColumn("email", "text").addColumn("service_modes_json", "text", (col) => col.notNull().defaultTo("[]")).addColumn("version", "integer", (col) => col.notNull().defaultTo(1)).addColumn("created_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).addColumn("updated_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).addCheckConstraint("ck_restaurant_locations_active_slot", sql`(status = 'active' and active_slot is not null) or (status = 'archived' and active_slot is null)`).addCheckConstraint("ck_restaurant_locations_default_active", sql`default_key is null or status = 'active'`).execute();
|
|
3114
3114
|
await db.schema.createIndex("idx_restaurant_locations_status").on("restaurant_locations").column("status").execute();
|
|
3115
3115
|
await db.schema.createIndex("idx_restaurant_locations_created_at").on("restaurant_locations").column("created_at").execute();
|
|
@@ -3118,7 +3118,7 @@ async function up$62(db) {
|
|
|
3118
3118
|
await db.schema.createIndex("idx_restaurant_location_memberships_user_id").on("restaurant_location_memberships").column("user_id").execute();
|
|
3119
3119
|
await db.schema.createIndex("idx_restaurant_location_memberships_location_id").on("restaurant_location_memberships").column("location_id").execute();
|
|
3120
3120
|
}
|
|
3121
|
-
async function down$
|
|
3121
|
+
async function down$63(db) {
|
|
3122
3122
|
await db.schema.dropTable("restaurant_location_memberships").execute();
|
|
3123
3123
|
await db.schema.dropTable("restaurant_locations").execute();
|
|
3124
3124
|
}
|
|
@@ -3126,10 +3126,10 @@ async function down$62(db) {
|
|
|
3126
3126
|
//#endregion
|
|
3127
3127
|
//#region src/database/migrations/062_restaurant_menus.ts
|
|
3128
3128
|
var _062_restaurant_menus_exports = /* @__PURE__ */ __exportAll({
|
|
3129
|
-
down: () => down$
|
|
3130
|
-
up: () => up$
|
|
3129
|
+
down: () => down$62,
|
|
3130
|
+
up: () => up$62
|
|
3131
3131
|
});
|
|
3132
|
-
async function up$
|
|
3132
|
+
async function up$62(db) {
|
|
3133
3133
|
await db.schema.createTable("restaurant_menus").addColumn("id", "text", (col) => col.primaryKey()).addColumn("slug", "text", (col) => col.notNull().unique()).addColumn("name", "text", (col) => col.notNull()).addColumn("description", "text").addColumn("status", "text", (col) => col.notNull().check(sql`status in ('active', 'archived')`).defaultTo("active")).addColumn("is_published", "integer", (col) => col.notNull().check(sql`is_published in (0, 1)`).defaultTo(0)).addColumn("version", "integer", (col) => col.notNull().defaultTo(1)).addColumn("created_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).addColumn("updated_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).execute();
|
|
3134
3134
|
await db.schema.createTable("restaurant_menu_location_assignments").addColumn("id", "text", (col) => col.primaryKey()).addColumn("menu_id", "text", (col) => col.notNull().references("restaurant_menus.id").onDelete("cascade")).addColumn("location_id", "text", (col) => col.notNull().references("restaurant_locations.id").onDelete("cascade")).addColumn("is_active", "integer", (col) => col.notNull().check(sql`is_active in (0, 1)`).defaultTo(1)).addColumn("sort_order", "integer", (col) => col.notNull().check(sql`sort_order >= 0`).defaultTo(0)).addColumn("schedule_json", "text", (col) => col.notNull().defaultTo("[]")).addColumn("service_modes_json", "text", (col) => col.notNull().defaultTo("[]")).addColumn("version", "integer", (col) => col.notNull().defaultTo(1)).addColumn("created_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).addColumn("updated_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).addUniqueConstraint("uq_restaurant_menu_location_assignment", ["menu_id", "location_id"]).execute();
|
|
3135
3135
|
await db.schema.createTable("restaurant_menu_sections").addColumn("id", "text", (col) => col.primaryKey()).addColumn("menu_id", "text", (col) => col.notNull().references("restaurant_menus.id").onDelete("cascade")).addColumn("slug", "text", (col) => col.notNull()).addColumn("name", "text", (col) => col.notNull()).addColumn("description", "text").addColumn("status", "text", (col) => col.notNull().check(sql`status in ('active', 'archived')`).defaultTo("active")).addColumn("is_visible", "integer", (col) => col.notNull().check(sql`is_visible in (0, 1)`).defaultTo(1)).addColumn("available_hours_json", "text", (col) => col.notNull().defaultTo("[]")).addColumn("sort_order", "integer", (col) => col.notNull().check(sql`sort_order >= 0`).defaultTo(0)).addColumn("version", "integer", (col) => col.notNull().defaultTo(1)).addColumn("created_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).addColumn("updated_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).addUniqueConstraint("uq_restaurant_menu_section_slug", ["menu_id", "slug"]).execute();
|
|
@@ -3372,7 +3372,7 @@ async function createIndexes$9(db) {
|
|
|
3372
3372
|
]
|
|
3373
3373
|
]) await db.schema.createIndex(name).on(table).columns([...columns]).execute();
|
|
3374
3374
|
}
|
|
3375
|
-
async function down$
|
|
3375
|
+
async function down$62(db) {
|
|
3376
3376
|
await db.schema.dropTable("restaurant_menu_overrides").execute();
|
|
3377
3377
|
await db.schema.dropTable("restaurant_menu_item_translations").execute();
|
|
3378
3378
|
await db.schema.dropTable("restaurant_menu_item_modifier_groups").execute();
|
|
@@ -3388,11 +3388,11 @@ async function down$61(db) {
|
|
|
3388
3388
|
//#endregion
|
|
3389
3389
|
//#region src/database/migrations/063_restaurant_hours.ts
|
|
3390
3390
|
var _063_restaurant_hours_exports = /* @__PURE__ */ __exportAll({
|
|
3391
|
-
down: () => down$
|
|
3392
|
-
up: () => up$
|
|
3391
|
+
down: () => down$61,
|
|
3392
|
+
up: () => up$61
|
|
3393
3393
|
});
|
|
3394
3394
|
const SERVICE_SCOPE_CHECK = sql`service_scope in ('all', 'dine_in', 'pickup', 'delivery', 'reservations')`;
|
|
3395
|
-
async function up$
|
|
3395
|
+
async function up$61(db) {
|
|
3396
3396
|
await db.schema.createTable("restaurant_hours").addColumn("id", "text", (col) => col.primaryKey()).addColumn("weekday", "integer", (col) => col.notNull().check(sql`weekday between 0 and 6`)).addColumn("service_scope", "text", (col) => col.notNull().check(SERVICE_SCOPE_CHECK)).addColumn("windows_json", "text", (col) => col.notNull().defaultTo("[]")).addColumn("version", "integer", (col) => col.notNull().defaultTo(1)).addColumn("created_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).addColumn("updated_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).addUniqueConstraint("uq_restaurant_hours_day_scope", ["weekday", "service_scope"]).execute();
|
|
3397
3397
|
await db.schema.createTable("restaurant_hours_overrides").addColumn("id", "text", (col) => col.primaryKey()).addColumn("location_id", "text", (col) => col.notNull().references("restaurant_locations.id").onDelete("cascade")).addColumn("weekday", "integer", (col) => col.notNull().check(sql`weekday between 0 and 6`)).addColumn("service_scope", "text", (col) => col.notNull().check(SERVICE_SCOPE_CHECK)).addColumn("windows_json", "text", (col) => col.notNull().defaultTo("[]")).addColumn("version", "integer", (col) => col.notNull().defaultTo(1)).addColumn("created_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).addColumn("updated_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).addUniqueConstraint("uq_restaurant_hours_override_day_scope", [
|
|
3398
3398
|
"location_id",
|
|
@@ -3521,7 +3521,7 @@ async function createIndexes$8(db) {
|
|
|
3521
3521
|
"ends_at"
|
|
3522
3522
|
]).execute();
|
|
3523
3523
|
}
|
|
3524
|
-
async function down$
|
|
3524
|
+
async function down$61(db) {
|
|
3525
3525
|
await db.schema.dropTable("restaurant_closures").execute();
|
|
3526
3526
|
await db.schema.dropTable("restaurant_special_hours").execute();
|
|
3527
3527
|
await db.schema.dropTable("restaurant_hours_overrides").execute();
|
|
@@ -3531,14 +3531,14 @@ async function down$60(db) {
|
|
|
3531
3531
|
//#endregion
|
|
3532
3532
|
//#region src/database/migrations/064_restaurant_reservations.ts
|
|
3533
3533
|
var _064_restaurant_reservations_exports = /* @__PURE__ */ __exportAll({
|
|
3534
|
-
down: () => down$
|
|
3535
|
-
up: () => up$
|
|
3534
|
+
down: () => down$60,
|
|
3535
|
+
up: () => up$60
|
|
3536
3536
|
});
|
|
3537
3537
|
const RESERVATION_STATUS_CHECK = sql`status in ('pending', 'confirmed', 'seated', 'completed', 'cancelled', 'no_show')`;
|
|
3538
3538
|
const RESERVATION_SOURCE_CHECK = sql`source in ('public', 'admin', 'mcp', 'import')`;
|
|
3539
3539
|
const HOLD_STATUS_CHECK = sql`status in ('active', 'committed', 'released', 'expired')`;
|
|
3540
3540
|
const ACTIVE_REMOVED_STATUS_CHECK = sql`status in ('active', 'removed')`;
|
|
3541
|
-
async function up$
|
|
3541
|
+
async function up$60(db) {
|
|
3542
3542
|
await createSettingsTables(db);
|
|
3543
3543
|
await createFloorTables(db);
|
|
3544
3544
|
await createReservationTables(db);
|
|
@@ -3897,7 +3897,7 @@ async function createIndexes$7(db) {
|
|
|
3897
3897
|
WHERE status = 'active'
|
|
3898
3898
|
`.execute(db);
|
|
3899
3899
|
}
|
|
3900
|
-
async function down$
|
|
3900
|
+
async function down$60(db) {
|
|
3901
3901
|
await db.schema.dropTable("restaurant_guest_access").execute();
|
|
3902
3902
|
await db.schema.dropTable("restaurant_reservation_table_assignments").execute();
|
|
3903
3903
|
await db.schema.dropTable("restaurant_reservation_holds").execute();
|
|
@@ -3913,8 +3913,8 @@ async function down$59(db) {
|
|
|
3913
3913
|
//#endregion
|
|
3914
3914
|
//#region src/database/migrations/065_restaurant_orders.ts
|
|
3915
3915
|
var _065_restaurant_orders_exports = /* @__PURE__ */ __exportAll({
|
|
3916
|
-
down: () => down$
|
|
3917
|
-
up: () => up$
|
|
3916
|
+
down: () => down$59,
|
|
3917
|
+
up: () => up$59
|
|
3918
3918
|
});
|
|
3919
3919
|
const ORDER_STATUS_CHECK = sql`status in ('pending_payment', 'confirmed', 'preparing', 'ready', 'out_for_delivery', 'completed', 'cancelled')`;
|
|
3920
3920
|
const ORDER_SOURCE_CHECK = sql`source in ('public', 'admin', 'mcp', 'import', 'qr')`;
|
|
@@ -3923,7 +3923,7 @@ const PAYMENT_STATUS_CHECK = sql`status in ('requires_action', 'processing', 'au
|
|
|
3923
3923
|
const REFUND_STATUS_CHECK = sql`status in ('pending', 'succeeded', 'failed', 'cancelled')`;
|
|
3924
3924
|
const CART_HOLD_STATUS_CHECK = sql`status in ('active', 'committed', 'released', 'expired')`;
|
|
3925
3925
|
const ACTOR_TYPE_CHECK = sql`actor_type in ('user', 'api_token', 'system')`;
|
|
3926
|
-
async function up$
|
|
3926
|
+
async function up$59(db) {
|
|
3927
3927
|
await createOrderTables$1(db);
|
|
3928
3928
|
await createPaymentTables$1(db);
|
|
3929
3929
|
await createIndexes$6(db);
|
|
@@ -4260,7 +4260,7 @@ async function createImmutableLedgerTriggers(db) {
|
|
|
4260
4260
|
`.execute(db);
|
|
4261
4261
|
}
|
|
4262
4262
|
}
|
|
4263
|
-
async function down$
|
|
4263
|
+
async function down$59(db) {
|
|
4264
4264
|
await db.schema.dropTable("restaurant_refunds").execute();
|
|
4265
4265
|
await db.schema.dropTable("restaurant_payments").execute();
|
|
4266
4266
|
await db.schema.dropTable("restaurant_cart_holds").execute();
|
|
@@ -4275,10 +4275,10 @@ async function down$58(db) {
|
|
|
4275
4275
|
//#endregion
|
|
4276
4276
|
//#region src/database/migrations/066_restaurant_stripe_configuration.ts
|
|
4277
4277
|
var _066_restaurant_stripe_configuration_exports = /* @__PURE__ */ __exportAll({
|
|
4278
|
-
down: () => down$
|
|
4279
|
-
up: () => up$
|
|
4278
|
+
down: () => down$58,
|
|
4279
|
+
up: () => up$58
|
|
4280
4280
|
});
|
|
4281
|
-
async function up$
|
|
4281
|
+
async function up$58(db) {
|
|
4282
4282
|
await db.schema.createTable("restaurant_stripe_settings").addColumn("id", "text", (col) => col.primaryKey()).addColumn("default_key", "text", (col) => col.notNull().unique().defaultTo("default")).addColumn("mode", "text", (col) => col.notNull().check(sql`mode in ('test', 'live')`).defaultTo("test")).addColumn("publishable_key", "text").addColumn("payments_enabled", "integer", (col) => col.notNull().check(sql`payments_enabled in (0, 1)`).defaultTo(0)).addColumn("enabled_fulfilment_types_json", "text", (col) => col.notNull().defaultTo("[\"pickup\"]")).addColumn("payment_flow", "text", (col) => col.notNull().check(sql`payment_flow in ('checkout', 'payment_element')`).defaultTo("checkout")).addColumn("automatic_tax_enabled", "integer", (col) => col.notNull().check(sql`automatic_tax_enabled in (0, 1)`).defaultTo(1)).addColumn("configuration_status", "text", (col) => col.notNull().check(sql`configuration_status in ('unconfigured', 'unverified', 'valid', 'invalid')`).defaultTo("unconfigured")).addColumn("stripe_account_id", "text").addColumn("charges_enabled", "integer", (col) => col.check(sql`charges_enabled is null or charges_enabled in (0, 1)`)).addColumn("details_submitted", "integer", (col) => col.check(sql`details_submitted is null or details_submitted in (0, 1)`)).addColumn("tax_status", "text", (col) => col.notNull().check(sql`tax_status in ('unknown', 'active', 'pending', 'unavailable')`).defaultTo("unknown")).addColumn("validation_error_code", "text").addColumn("last_validated_at", "text").addColumn("connect_status", "text", (col) => col.notNull().check(sql`connect_status in ('not_configured', 'restricted', 'ready')`).defaultTo("not_configured")).addColumn("version", "integer", (col) => col.notNull().defaultTo(1)).addColumn("created_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).addColumn("updated_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).addCheckConstraint("ck_restaurant_stripe_settings_default_key", sql`default_key = 'default'`).execute();
|
|
4283
4283
|
await db.schema.createTable("restaurant_stripe_location_settings").addColumn("id", "text", (col) => col.primaryKey()).addColumn("location_id", "text", (col) => col.notNull().unique().references("restaurant_locations.id").onDelete("cascade")).addColumn("payments_enabled", "integer", (col) => col.check(sql`payments_enabled is null or payments_enabled in (0, 1)`)).addColumn("enabled_fulfilment_types_json", "text").addColumn("payment_flow", "text", (col) => col.check(sql`payment_flow is null or payment_flow in ('checkout', 'payment_element')`)).addColumn("tax_mode", "text", (col) => col.check(sql`tax_mode is null or tax_mode in ('stripe_tax', 'manual_vat', 'none')`)).addColumn("manual_vat_reason", "text").addColumn("version", "integer", (col) => col.notNull().defaultTo(1)).addColumn("created_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).addColumn("updated_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).addCheckConstraint("ck_restaurant_stripe_location_manual_vat_reason", sql`(tax_mode = 'manual_vat' and manual_vat_reason is not null and length(trim(manual_vat_reason)) > 0) or ((tax_mode is null or tax_mode <> 'manual_vat') and manual_vat_reason is null)`).execute();
|
|
4284
4284
|
await db.schema.createTable("restaurant_stripe_manual_tax_rates").addColumn("id", "text", (col) => col.primaryKey()).addColumn("location_id", "text", (col) => col.notNull().references("restaurant_locations.id").onDelete("cascade")).addColumn("tax_code", "text", (col) => col.notNull().defaultTo("*")).addColumn("stripe_tax_rate_id", "text", (col) => col.notNull()).addColumn("display_name", "text", (col) => col.notNull()).addColumn("jurisdiction", "text", (col) => col.notNull()).addColumn("percentage", "text", (col) => col.notNull()).addColumn("inclusive", "integer", (col) => col.notNull().check(sql`inclusive in (0, 1)`).defaultTo(0)).addColumn("active", "integer", (col) => col.notNull().check(sql`active in (0, 1)`).defaultTo(1)).addColumn("version", "integer", (col) => col.notNull().defaultTo(1)).addColumn("created_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).addColumn("updated_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).addUniqueConstraint("uq_restaurant_stripe_manual_tax_rates_mapping", ["location_id", "tax_code"]).execute();
|
|
@@ -4345,7 +4345,7 @@ async function up$57(db) {
|
|
|
4345
4345
|
"tax_code"
|
|
4346
4346
|
]).execute();
|
|
4347
4347
|
}
|
|
4348
|
-
async function down$
|
|
4348
|
+
async function down$58(db) {
|
|
4349
4349
|
await db.schema.dropTable("restaurant_stripe_manual_tax_rates").execute();
|
|
4350
4350
|
await db.schema.dropTable("restaurant_stripe_location_settings").execute();
|
|
4351
4351
|
await db.schema.dropTable("restaurant_stripe_settings").execute();
|
|
@@ -4354,10 +4354,10 @@ async function down$57(db) {
|
|
|
4354
4354
|
//#endregion
|
|
4355
4355
|
//#region src/database/migrations/067_restaurant_payment_requested_amount.ts
|
|
4356
4356
|
var _067_restaurant_payment_requested_amount_exports = /* @__PURE__ */ __exportAll({
|
|
4357
|
-
down: () => down$
|
|
4358
|
-
up: () => up$
|
|
4357
|
+
down: () => down$57,
|
|
4358
|
+
up: () => up$57
|
|
4359
4359
|
});
|
|
4360
|
-
async function up$
|
|
4360
|
+
async function up$57(db) {
|
|
4361
4361
|
await db.schema.alterTable("restaurant_payments").addColumn("amount_requested_minor", "integer", (column) => column.notNull().defaultTo(0).check(sql`amount_requested_minor >= 0`)).execute();
|
|
4362
4362
|
await sql`
|
|
4363
4363
|
UPDATE restaurant_payments
|
|
@@ -4373,19 +4373,19 @@ async function up$56(db) {
|
|
|
4373
4373
|
WHERE amount_requested_minor = 0
|
|
4374
4374
|
`.execute(db);
|
|
4375
4375
|
}
|
|
4376
|
-
async function down$
|
|
4376
|
+
async function down$57(db) {
|
|
4377
4377
|
await db.schema.alterTable("restaurant_payments").dropColumn("amount_requested_minor").execute();
|
|
4378
4378
|
}
|
|
4379
4379
|
|
|
4380
4380
|
//#endregion
|
|
4381
4381
|
//#region src/database/migrations/068_restaurant_stripe_events.ts
|
|
4382
4382
|
var _068_restaurant_stripe_events_exports = /* @__PURE__ */ __exportAll({
|
|
4383
|
-
down: () => down$
|
|
4384
|
-
up: () => up$
|
|
4383
|
+
down: () => down$56,
|
|
4384
|
+
up: () => up$56
|
|
4385
4385
|
});
|
|
4386
4386
|
const currentTimestamp = sql`(datetime('now'))`;
|
|
4387
4387
|
const retentionTimestamp = sql`(datetime('now', '+30 days'))`;
|
|
4388
|
-
async function up$
|
|
4388
|
+
async function up$56(db) {
|
|
4389
4389
|
await db.schema.createTable("restaurant_stripe_events").addColumn("id", "text", (col) => col.primaryKey()).addColumn("event_id", "text", (col) => col.notNull().unique()).addColumn("event_type", "text", (col) => col.notNull()).addColumn("livemode", "integer", (col) => col.notNull().check(sql`livemode in (0, 1)`)).addColumn("api_version", "text").addColumn("object_type", "text").addColumn("object_id", "text").addColumn("payload_sha256", "text", (col) => col.notNull().check(sql`length(payload_sha256) = 71 and payload_sha256 like 'sha256:%'`)).addColumn("status", "text", (col) => col.notNull().defaultTo("processing").check(sql`status in ('processing', 'processed', 'failed', 'ignored')`)).addColumn("attempt_count", "integer", (col) => col.notNull().defaultTo(1).check(sql`attempt_count >= 1`)).addColumn("error_code", "text", (col) => col.check(sql`length(error_code) <= 64`)).addColumn("location_id", "text", (col) => col.references("restaurant_locations.id").onDelete("set null")).addColumn("payment_id", "text", (col) => col.references("restaurant_payments.id").onDelete("set null")).addColumn("received_at", "text", (col) => col.notNull().defaultTo(currentTimestamp)).addColumn("last_attempt_at", "text", (col) => col.notNull().defaultTo(currentTimestamp)).addColumn("processed_at", "text").addColumn("retain_until", "text", (col) => col.notNull().defaultTo(retentionTimestamp)).addColumn("created_at", "text", (col) => col.notNull().defaultTo(currentTimestamp)).addColumn("updated_at", "text", (col) => col.notNull().defaultTo(currentTimestamp)).addCheckConstraint("ck_restaurant_stripe_events_object", sql`(object_type is null and object_id is null) or (object_type is not null and object_id is not null)`).addCheckConstraint("ck_restaurant_stripe_events_processed", sql`(status in ('processed', 'ignored') and processed_at is not null) or (status in ('processing', 'failed') and processed_at is null)`).addCheckConstraint("ck_restaurant_stripe_events_retention", sql`datetime(retain_until) >= datetime(received_at, '+30 days')`).execute();
|
|
4390
4390
|
for (const [name, column] of [
|
|
4391
4391
|
["idx_restaurant_stripe_events_status", "status"],
|
|
@@ -4402,22 +4402,22 @@ async function up$55(db) {
|
|
|
4402
4402
|
"id"
|
|
4403
4403
|
]).execute();
|
|
4404
4404
|
}
|
|
4405
|
-
async function down$
|
|
4405
|
+
async function down$56(db) {
|
|
4406
4406
|
await db.schema.dropTable("restaurant_stripe_events").execute();
|
|
4407
4407
|
}
|
|
4408
4408
|
|
|
4409
4409
|
//#endregion
|
|
4410
4410
|
//#region src/database/migrations/069_restaurant_tax_behavior.ts
|
|
4411
4411
|
var _069_restaurant_tax_behavior_exports = /* @__PURE__ */ __exportAll({
|
|
4412
|
-
down: () => down$
|
|
4413
|
-
up: () => up$
|
|
4412
|
+
down: () => down$55,
|
|
4413
|
+
up: () => up$55
|
|
4414
4414
|
});
|
|
4415
|
-
async function up$
|
|
4415
|
+
async function up$55(db) {
|
|
4416
4416
|
await db.schema.alterTable("restaurant_stripe_settings").addColumn("default_tax_behavior", "text", (column) => column.notNull().defaultTo("exclusive").check(sql`default_tax_behavior in ('exclusive', 'inclusive')`)).execute();
|
|
4417
4417
|
await db.schema.alterTable("restaurant_stripe_location_settings").addColumn("tax_behavior", "text", (column) => column.check(sql`tax_behavior is null or tax_behavior in ('exclusive', 'inclusive')`)).execute();
|
|
4418
4418
|
await db.schema.alterTable("restaurant_menu_items").addColumn("tax_behavior", "text", (column) => column.check(sql`tax_behavior is null or tax_behavior in ('exclusive', 'inclusive')`)).execute();
|
|
4419
4419
|
}
|
|
4420
|
-
async function down$
|
|
4420
|
+
async function down$55(db) {
|
|
4421
4421
|
await db.schema.alterTable("restaurant_menu_items").dropColumn("tax_behavior").execute();
|
|
4422
4422
|
await db.schema.alterTable("restaurant_stripe_location_settings").dropColumn("tax_behavior").execute();
|
|
4423
4423
|
await db.schema.alterTable("restaurant_stripe_settings").dropColumn("default_tax_behavior").execute();
|
|
@@ -4426,15 +4426,15 @@ async function down$54(db) {
|
|
|
4426
4426
|
//#endregion
|
|
4427
4427
|
//#region src/database/migrations/070_restaurant_inclusive_order_item_totals.ts
|
|
4428
4428
|
var _070_restaurant_inclusive_order_item_totals_exports = /* @__PURE__ */ __exportAll({
|
|
4429
|
-
down: () => down$
|
|
4430
|
-
up: () => up$
|
|
4429
|
+
down: () => down$54,
|
|
4430
|
+
up: () => up$54
|
|
4431
4431
|
});
|
|
4432
4432
|
const REBUILT_ORDER_ITEMS = "_restaurant_order_items_rebuild";
|
|
4433
4433
|
const REBUILT_ORDER_ITEM_MODIFIERS = "_restaurant_order_item_modifiers_rebuild";
|
|
4434
|
-
async function up$
|
|
4434
|
+
async function up$54(db) {
|
|
4435
4435
|
await rebuildOrderItemLedger(db, true);
|
|
4436
4436
|
}
|
|
4437
|
-
async function down$
|
|
4437
|
+
async function down$54(db) {
|
|
4438
4438
|
await rebuildOrderItemLedger(db, false);
|
|
4439
4439
|
}
|
|
4440
4440
|
async function rebuildOrderItemLedger(db, inclusiveAware) {
|
|
@@ -4557,11 +4557,11 @@ async function createImmutableTriggers(db) {
|
|
|
4557
4557
|
//#endregion
|
|
4558
4558
|
//#region src/database/migrations/071_restaurant_delivery_zones.ts
|
|
4559
4559
|
var _071_restaurant_delivery_zones_exports = /* @__PURE__ */ __exportAll({
|
|
4560
|
-
down: () => down$
|
|
4561
|
-
up: () => up$
|
|
4560
|
+
down: () => down$53,
|
|
4561
|
+
up: () => up$53
|
|
4562
4562
|
});
|
|
4563
4563
|
const DELIVERY_ZONE_STATUS_CHECK = sql`status in ('active', 'archived')`;
|
|
4564
|
-
async function up$
|
|
4564
|
+
async function up$53(db) {
|
|
4565
4565
|
await db.schema.createTable("restaurant_delivery_zones").addColumn("id", "text", (column) => column.primaryKey()).addColumn("location_id", "text", (column) => column.notNull().references("restaurant_locations.id").onDelete("cascade")).addColumn("name", "text", (column) => column.notNull()).addColumn("status", "text", (column) => column.notNull().check(DELIVERY_ZONE_STATUS_CHECK).defaultTo("active")).addColumn("priority", "integer", (column) => column.notNull().check(sql`priority >= 0`).defaultTo(0)).addColumn("radius_meters", "integer", (column) => column.check(sql`radius_meters is null or radius_meters > 0`)).addColumn("postal_codes_json", "text", (column) => column.notNull().defaultTo("[]")).addColumn("area_codes_json", "text", (column) => column.notNull().defaultTo("[]")).addColumn("fee_minor", "integer", (column) => column.notNull().check(sql`fee_minor >= 0`).defaultTo(0)).addColumn("minimum_order_minor", "integer", (column) => column.notNull().check(sql`minimum_order_minor >= 0`).defaultTo(0)).addColumn("estimated_minutes", "integer", (column) => column.notNull().check(sql`estimated_minutes between 1 and 1440`).defaultTo(45)).addColumn("version", "integer", (column) => column.notNull().check(sql`version >= 1`).defaultTo(1)).addColumn("created_at", "text", (column) => column.notNull().defaultTo(currentTimestamp$1(db))).addColumn("updated_at", "text", (column) => column.notNull().defaultTo(currentTimestamp$1(db))).addUniqueConstraint("uq_restaurant_delivery_zones_location_id", ["location_id", "id"]).execute();
|
|
4566
4566
|
await db.schema.createIndex("idx_restaurant_delivery_zones_location_status_priority").on("restaurant_delivery_zones").columns([
|
|
4567
4567
|
"location_id",
|
|
@@ -4570,35 +4570,35 @@ async function up$52(db) {
|
|
|
4570
4570
|
"id"
|
|
4571
4571
|
]).execute();
|
|
4572
4572
|
}
|
|
4573
|
-
async function down$
|
|
4573
|
+
async function down$53(db) {
|
|
4574
4574
|
await db.schema.dropTable("restaurant_delivery_zones").execute();
|
|
4575
4575
|
}
|
|
4576
4576
|
|
|
4577
4577
|
//#endregion
|
|
4578
4578
|
//#region src/database/migrations/072_restaurant_delivery_settings.ts
|
|
4579
4579
|
var _072_restaurant_delivery_settings_exports = /* @__PURE__ */ __exportAll({
|
|
4580
|
-
down: () => down$
|
|
4581
|
-
up: () => up$
|
|
4580
|
+
down: () => down$52,
|
|
4581
|
+
up: () => up$52
|
|
4582
4582
|
});
|
|
4583
4583
|
const SLOT_MINUTES_CHECK = sql`slot_minutes between 5 and 120 and slot_minutes % 5 = 0`;
|
|
4584
|
-
async function up$
|
|
4584
|
+
async function up$52(db) {
|
|
4585
4585
|
await db.schema.createTable("restaurant_delivery_settings").addColumn("id", "text", (column) => column.primaryKey()).addColumn("location_id", "text", (column) => column.notNull().unique().references("restaurant_locations.id").onDelete("cascade")).addColumn("slot_minutes", "integer", (column) => column.notNull().check(SLOT_MINUTES_CHECK).defaultTo(30)).addColumn("lead_minutes", "integer", (column) => column.notNull().check(sql`lead_minutes between 0 and 10080`).defaultTo(60)).addColumn("booking_horizon_days", "integer", (column) => column.notNull().check(sql`booking_horizon_days between 0 and 365`).defaultTo(14)).addColumn("version", "integer", (column) => column.notNull().check(sql`version >= 1`).defaultTo(1)).addColumn("created_at", "text", (column) => column.notNull().defaultTo(currentTimestamp$1(db))).addColumn("updated_at", "text", (column) => column.notNull().defaultTo(currentTimestamp$1(db))).execute();
|
|
4586
4586
|
await db.schema.createIndex("idx_restaurant_delivery_settings_location_id").on("restaurant_delivery_settings").column("location_id").execute();
|
|
4587
4587
|
}
|
|
4588
|
-
async function down$
|
|
4588
|
+
async function down$52(db) {
|
|
4589
4589
|
await db.schema.dropTable("restaurant_delivery_settings").execute();
|
|
4590
4590
|
}
|
|
4591
4591
|
|
|
4592
4592
|
//#endregion
|
|
4593
4593
|
//#region src/database/migrations/073_restaurant_dine_in.ts
|
|
4594
4594
|
var _073_restaurant_dine_in_exports = /* @__PURE__ */ __exportAll({
|
|
4595
|
-
down: () => down$
|
|
4596
|
-
up: () => up$
|
|
4595
|
+
down: () => down$51,
|
|
4596
|
+
up: () => up$51
|
|
4597
4597
|
});
|
|
4598
4598
|
const SESSION_STATUS_CHECK = sql`status in ('open', 'closed', 'cancelled')`;
|
|
4599
4599
|
const ROUND_PAYMENT_MODE_CHECK = sql`payment_mode in ('prepaid', 'offline', 'tab')`;
|
|
4600
4600
|
const ROUND_STATUS_CHECK = sql`status in ('open', 'authorized', 'settled', 'voided')`;
|
|
4601
|
-
async function up$
|
|
4601
|
+
async function up$51(db) {
|
|
4602
4602
|
await db.schema.createTable("restaurant_dine_in_sessions").addColumn("id", "text", (col) => col.primaryKey()).addColumn("location_id", "text", (col) => col.notNull().references("restaurant_locations.id").onDelete("restrict")).addColumn("table_id", "text", (col) => col.notNull().references("restaurant_tables.id").onDelete("restrict")).addColumn("session_key", "text", (col) => col.notNull().unique()).addColumn("token_id", "text", (col) => col.notNull().unique()).addColumn("token_hash", "text", (col) => col.notNull().unique()).addColumn("service_date", "text", (col) => col.notNull().check(sql`length(service_date) = 10`)).addColumn("status", "text", (col) => col.notNull().check(SESSION_STATUS_CHECK).defaultTo("open")).addColumn("expires_at", "text", (col) => col.notNull()).addColumn("opened_at", "text", (col) => col.notNull()).addColumn("closed_at", "text").addColumn("version", "integer", (col) => col.notNull().defaultTo(1)).addColumn("created_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).addColumn("updated_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).addUniqueConstraint("uq_restaurant_dine_in_sessions_location_id", ["location_id", "id"]).addCheckConstraint("ck_restaurant_dine_in_sessions_state", sql`(status = 'open' and closed_at is null) or (status in ('closed', 'cancelled') and closed_at is not null)`).execute();
|
|
4603
4603
|
await db.schema.createTable("restaurant_tab_rounds").addColumn("id", "text", (col) => col.primaryKey()).addColumn("location_id", "text", (col) => col.notNull().references("restaurant_locations.id").onDelete("restrict")).addColumn("session_id", "text", (col) => col.notNull()).addColumn("order_id", "text", (col) => col.notNull().unique()).addColumn("payment_id", "text", (col) => col.unique()).addColumn("round_number", "integer", (col) => col.notNull().check(sql`round_number >= 1`)).addColumn("request_key", "text", (col) => col.notNull().unique()).addColumn("payment_mode", "text", (col) => col.notNull().check(ROUND_PAYMENT_MODE_CHECK)).addColumn("status", "text", (col) => col.notNull().check(ROUND_STATUS_CHECK).defaultTo("open")).addColumn("authorization_ceiling_minor", "integer", (col) => col.notNull().check(sql`authorization_ceiling_minor >= 0`).defaultTo(0)).addColumn("amount_requested_minor", "integer", (col) => col.notNull().check(sql`amount_requested_minor > 0`)).addColumn("amount_authorized_minor", "integer", (col) => col.notNull().check(sql`amount_authorized_minor >= 0`).defaultTo(0)).addColumn("amount_captured_minor", "integer", (col) => col.notNull().check(sql`amount_captured_minor >= 0`).defaultTo(0)).addColumn("amount_refunded_minor", "integer", (col) => col.notNull().check(sql`amount_refunded_minor >= 0`).defaultTo(0)).addColumn("opened_at", "text", (col) => col.notNull()).addColumn("settled_at", "text").addColumn("version", "integer", (col) => col.notNull().defaultTo(1)).addColumn("created_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).addColumn("updated_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).addForeignKeyConstraint("fk_restaurant_tab_rounds_session_location", ["location_id", "session_id"], "restaurant_dine_in_sessions", ["location_id", "id"], (cb) => cb.onDelete("restrict")).addForeignKeyConstraint("fk_restaurant_tab_rounds_order_location", ["location_id", "order_id"], "restaurant_orders", ["location_id", "id"], (cb) => cb.onDelete("restrict")).addForeignKeyConstraint("fk_restaurant_tab_rounds_payment_location", ["location_id", "payment_id"], "restaurant_payments", ["location_id", "id"], (cb) => cb.onDelete("restrict")).addUniqueConstraint("uq_restaurant_tab_rounds_session_number", ["session_id", "round_number"]).addUniqueConstraint("uq_restaurant_tab_rounds_location_id", ["location_id", "id"]).addCheckConstraint("ck_restaurant_tab_rounds_amounts", sql`amount_refunded_minor <= amount_captured_minor and amount_captured_minor <= amount_authorized_minor`).addCheckConstraint("ck_restaurant_tab_rounds_authorization", sql`payment_mode <> 'tab' or authorization_ceiling_minor >= amount_requested_minor`).addCheckConstraint("ck_restaurant_tab_rounds_settled", sql`(status = 'settled' and settled_at is not null) or (status <> 'settled' and settled_at is null)`).execute();
|
|
4604
4604
|
await db.schema.createIndex("idx_restaurant_dine_in_sessions_location_id").on("restaurant_dine_in_sessions").column("location_id").execute();
|
|
@@ -4626,7 +4626,7 @@ async function up$50(db) {
|
|
|
4626
4626
|
WHERE status = 'open'
|
|
4627
4627
|
`.execute(db);
|
|
4628
4628
|
}
|
|
4629
|
-
async function down$
|
|
4629
|
+
async function down$51(db) {
|
|
4630
4630
|
await db.schema.dropTable("restaurant_tab_rounds").execute();
|
|
4631
4631
|
await db.schema.dropTable("restaurant_dine_in_sessions").execute();
|
|
4632
4632
|
}
|
|
@@ -4634,11 +4634,11 @@ async function down$50(db) {
|
|
|
4634
4634
|
//#endregion
|
|
4635
4635
|
//#region src/database/migrations/074_restaurant_outbox.ts
|
|
4636
4636
|
var _074_restaurant_outbox_exports = /* @__PURE__ */ __exportAll({
|
|
4637
|
-
down: () => down$
|
|
4638
|
-
up: () => up$
|
|
4637
|
+
down: () => down$50,
|
|
4638
|
+
up: () => up$50
|
|
4639
4639
|
});
|
|
4640
4640
|
const OUTBOX_STATUS_CHECK = sql`status in ('pending', 'processing', 'delivered', 'failed')`;
|
|
4641
|
-
async function up$
|
|
4641
|
+
async function up$50(db) {
|
|
4642
4642
|
await db.schema.createTable("restaurant_outbox_events").addColumn("id", "text", (col) => col.primaryKey()).addColumn("location_id", "text", (col) => col.notNull().references("restaurant_locations.id").onDelete("restrict")).addColumn("aggregate_type", "text", (col) => col.notNull().check(sql`length(aggregate_type) between 1 and 64`)).addColumn("aggregate_id", "text", (col) => col.notNull().check(sql`length(aggregate_id) between 1 and 128`)).addColumn("event_type", "text", (col) => col.notNull().check(sql`length(event_type) between 1 and 128`)).addColumn("dedupe_key", "text", (col) => col.notNull().unique()).addColumn("payload_json", "text", (col) => col.notNull()).addColumn("status", "text", (col) => col.notNull().check(OUTBOX_STATUS_CHECK).defaultTo("pending")).addColumn("attempt_count", "integer", (col) => col.notNull().check(sql`attempt_count >= 0`).defaultTo(0)).addColumn("available_at", "text", (col) => col.notNull()).addColumn("locked_until", "text").addColumn("last_error_code", "text").addColumn("version", "integer", (col) => col.notNull().defaultTo(1)).addColumn("created_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).addColumn("updated_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).addUniqueConstraint("uq_restaurant_outbox_location_id", ["location_id", "id"]).execute();
|
|
4643
4643
|
for (const [name, column] of [
|
|
4644
4644
|
["idx_restaurant_outbox_location_id", "location_id"],
|
|
@@ -4654,19 +4654,19 @@ async function up$49(db) {
|
|
|
4654
4654
|
"id"
|
|
4655
4655
|
]).execute();
|
|
4656
4656
|
}
|
|
4657
|
-
async function down$
|
|
4657
|
+
async function down$50(db) {
|
|
4658
4658
|
await db.schema.dropTable("restaurant_outbox_events").execute();
|
|
4659
4659
|
}
|
|
4660
4660
|
|
|
4661
4661
|
//#endregion
|
|
4662
4662
|
//#region src/database/migrations/075_restaurant_kds_tickets.ts
|
|
4663
4663
|
var _075_restaurant_kds_tickets_exports = /* @__PURE__ */ __exportAll({
|
|
4664
|
-
down: () => down$
|
|
4665
|
-
up: () => up$
|
|
4664
|
+
down: () => down$49,
|
|
4665
|
+
up: () => up$49
|
|
4666
4666
|
});
|
|
4667
4667
|
const FULFILMENT_TYPE_CHECK = sql`fulfilment_type in ('dine_in', 'pickup', 'delivery')`;
|
|
4668
4668
|
const KDS_STATUS_CHECK = sql`status in ('queued', 'preparing', 'ready', 'completed', 'cancelled')`;
|
|
4669
|
-
async function up$
|
|
4669
|
+
async function up$49(db) {
|
|
4670
4670
|
await db.schema.createTable("restaurant_kds_tickets").addColumn("id", "text", (col) => col.primaryKey()).addColumn("location_id", "text", (col) => col.notNull().references("restaurant_locations.id").onDelete("restrict")).addColumn("order_id", "text", (col) => col.notNull().unique().references("restaurant_orders.id").onDelete("restrict")).addColumn("order_number", "integer", (col) => col.notNull().check(sql`order_number > 0`)).addColumn("fulfilment_type", "text", (col) => col.notNull().check(FULFILMENT_TYPE_CHECK)).addColumn("items_json", "text", (col) => col.notNull()).addColumn("status", "text", (col) => col.notNull().check(KDS_STATUS_CHECK).defaultTo("queued")).addColumn("priority", "integer", (col) => col.notNull().check(sql`priority >= 0`).defaultTo(0)).addColumn("started_at", "text").addColumn("ready_at", "text").addColumn("completed_at", "text").addColumn("cancelled_at", "text").addColumn("version", "integer", (col) => col.notNull().defaultTo(1)).addColumn("created_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).addColumn("updated_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).addUniqueConstraint("uq_restaurant_kds_tickets_location_id", ["location_id", "id"]).addForeignKeyConstraint("fk_restaurant_kds_tickets_order_location", ["location_id", "order_id"], "restaurant_orders", ["location_id", "id"], (cb) => cb.onDelete("restrict")).execute();
|
|
4671
4671
|
for (const [name, column] of [
|
|
4672
4672
|
["idx_restaurant_kds_tickets_location_id", "location_id"],
|
|
@@ -4684,38 +4684,38 @@ async function up$48(db) {
|
|
|
4684
4684
|
"id"
|
|
4685
4685
|
]).execute();
|
|
4686
4686
|
}
|
|
4687
|
-
async function down$
|
|
4687
|
+
async function down$49(db) {
|
|
4688
4688
|
await db.schema.dropTable("restaurant_kds_tickets").execute();
|
|
4689
4689
|
}
|
|
4690
4690
|
|
|
4691
4691
|
//#endregion
|
|
4692
4692
|
//#region src/database/migrations/076_restaurant_notification_settings.ts
|
|
4693
4693
|
var _076_restaurant_notification_settings_exports = /* @__PURE__ */ __exportAll({
|
|
4694
|
-
down: () => down$
|
|
4695
|
-
up: () => up$
|
|
4694
|
+
down: () => down$48,
|
|
4695
|
+
up: () => up$48
|
|
4696
4696
|
});
|
|
4697
4697
|
const SCOPE_CHECK = sql`(
|
|
4698
4698
|
(location_id is null and scope_key = 'global') or
|
|
4699
4699
|
(location_id is not null and scope_key = ('location:' || location_id))
|
|
4700
4700
|
)`;
|
|
4701
|
-
async function up$
|
|
4701
|
+
async function up$48(db) {
|
|
4702
4702
|
await db.schema.createTable("restaurant_notification_settings").addColumn("id", "text", (col) => col.primaryKey()).addColumn("scope_key", "text", (col) => col.notNull().unique()).addColumn("location_id", "text", (col) => col.references("restaurant_locations.id").onDelete("cascade")).addColumn("webhook_url", "text", (col) => col.check(sql`webhook_url is null or length(webhook_url) between 1 and 2048`)).addColumn("webhook_enabled", "integer", (col) => col.notNull().check(sql`webhook_enabled in (0, 1)`).defaultTo(0)).addColumn("webhook_event_types_json", "text", (col) => col.notNull().defaultTo("[]")).addColumn("version", "integer", (col) => col.notNull().defaultTo(1)).addColumn("created_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).addColumn("updated_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).addCheckConstraint("ck_restaurant_notification_settings_scope", SCOPE_CHECK).execute();
|
|
4703
4703
|
await db.schema.createIndex("idx_restaurant_notification_settings_location_id").on("restaurant_notification_settings").column("location_id").execute();
|
|
4704
4704
|
await db.schema.createIndex("idx_restaurant_notification_settings_updated_at").on("restaurant_notification_settings").column("updated_at").execute();
|
|
4705
4705
|
}
|
|
4706
|
-
async function down$
|
|
4706
|
+
async function down$48(db) {
|
|
4707
4707
|
await db.schema.dropTable("restaurant_notification_settings").execute();
|
|
4708
4708
|
}
|
|
4709
4709
|
|
|
4710
4710
|
//#endregion
|
|
4711
4711
|
//#region src/database/migrations/077_restaurant_outbox_deliveries.ts
|
|
4712
4712
|
var _077_restaurant_outbox_deliveries_exports = /* @__PURE__ */ __exportAll({
|
|
4713
|
-
down: () => down$
|
|
4714
|
-
up: () => up$
|
|
4713
|
+
down: () => down$47,
|
|
4714
|
+
up: () => up$47
|
|
4715
4715
|
});
|
|
4716
4716
|
const CHANNEL_CHECK = sql`channel in ('email', 'webhook', 'receipt', 'external_kds')`;
|
|
4717
4717
|
const DELIVERY_STATUS_CHECK = sql`status in ('pending', 'processing', 'delivered', 'failed')`;
|
|
4718
|
-
async function up$
|
|
4718
|
+
async function up$47(db) {
|
|
4719
4719
|
await db.schema.createTable("restaurant_outbox_deliveries").addColumn("id", "text", (col) => col.primaryKey()).addColumn("event_id", "text", (col) => col.notNull().references("restaurant_outbox_events.id").onDelete("cascade")).addColumn("channel", "text", (col) => col.notNull().check(CHANNEL_CHECK)).addColumn("status", "text", (col) => col.notNull().check(DELIVERY_STATUS_CHECK).defaultTo("pending")).addColumn("attempt_count", "integer", (col) => col.notNull().check(sql`attempt_count >= 0`).defaultTo(0)).addColumn("available_at", "text", (col) => col.notNull()).addColumn("locked_until", "text").addColumn("last_error_code", "text").addColumn("version", "integer", (col) => col.notNull().defaultTo(1)).addColumn("created_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).addColumn("updated_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).addUniqueConstraint("uq_restaurant_outbox_delivery_event_channel", ["event_id", "channel"]).execute();
|
|
4720
4720
|
await db.schema.createIndex("idx_restaurant_outbox_deliveries_event_id").on("restaurant_outbox_deliveries").column("event_id").execute();
|
|
4721
4721
|
await db.schema.createIndex("idx_restaurant_outbox_deliveries_channel").on("restaurant_outbox_deliveries").column("channel").execute();
|
|
@@ -4757,17 +4757,17 @@ async function up$46(db) {
|
|
|
4757
4757
|
ON CONFLICT (event_id, channel) DO NOTHING
|
|
4758
4758
|
`.execute(db);
|
|
4759
4759
|
}
|
|
4760
|
-
async function down$
|
|
4760
|
+
async function down$47(db) {
|
|
4761
4761
|
await db.schema.dropTable("restaurant_outbox_deliveries").execute();
|
|
4762
4762
|
}
|
|
4763
4763
|
|
|
4764
4764
|
//#endregion
|
|
4765
4765
|
//#region src/database/migrations/078_restaurant_external_kds_settings.ts
|
|
4766
4766
|
var _078_restaurant_external_kds_settings_exports = /* @__PURE__ */ __exportAll({
|
|
4767
|
-
down: () => down$
|
|
4768
|
-
up: () => up$
|
|
4767
|
+
down: () => down$46,
|
|
4768
|
+
up: () => up$46
|
|
4769
4769
|
});
|
|
4770
|
-
async function up$
|
|
4770
|
+
async function up$46(db) {
|
|
4771
4771
|
await db.schema.alterTable("restaurant_notification_settings").addColumn("external_kds_url", "text", (col) => col.check(sql`external_kds_url is null or length(external_kds_url) between 1 and 2048`)).execute();
|
|
4772
4772
|
await db.schema.alterTable("restaurant_notification_settings").addColumn("external_kds_enabled", "integer", (col) => col.notNull().check(sql`external_kds_enabled in (0, 1)`).defaultTo(0)).execute();
|
|
4773
4773
|
await db.schema.alterTable("restaurant_notification_settings").addColumn("external_kds_event_types_json", "text", (col) => col.notNull().defaultTo("[]")).execute();
|
|
@@ -4784,7 +4784,7 @@ async function up$45(db) {
|
|
|
4784
4784
|
ON CONFLICT (event_id, channel) DO NOTHING
|
|
4785
4785
|
`.execute(db);
|
|
4786
4786
|
}
|
|
4787
|
-
async function down$
|
|
4787
|
+
async function down$46(db) {
|
|
4788
4788
|
await db.schema.alterTable("restaurant_notification_settings").dropColumn("external_kds_event_types_json").execute();
|
|
4789
4789
|
await db.schema.alterTable("restaurant_notification_settings").dropColumn("external_kds_enabled").execute();
|
|
4790
4790
|
await db.schema.alterTable("restaurant_notification_settings").dropColumn("external_kds_url").execute();
|
|
@@ -4793,26 +4793,26 @@ async function down$45(db) {
|
|
|
4793
4793
|
//#endregion
|
|
4794
4794
|
//#region src/database/migrations/079_restaurant_dine_in_settings.ts
|
|
4795
4795
|
var _079_restaurant_dine_in_settings_exports = /* @__PURE__ */ __exportAll({
|
|
4796
|
-
down: () => down$
|
|
4797
|
-
up: () => up$
|
|
4796
|
+
down: () => down$45,
|
|
4797
|
+
up: () => up$45
|
|
4798
4798
|
});
|
|
4799
4799
|
const PAYMENT_MODE_CHECK = sql`default_payment_mode in ('prepaid', 'offline', 'tab')`;
|
|
4800
|
-
async function up$
|
|
4800
|
+
async function up$45(db) {
|
|
4801
4801
|
await db.schema.createTable("restaurant_dine_in_settings").ifNotExists().addColumn("id", "text", (column) => column.primaryKey()).addColumn("location_id", "text", (column) => column.notNull().unique().references("restaurant_locations.id").onDelete("cascade")).addColumn("qr_enabled", "integer", (column) => column.notNull().check(sql`qr_enabled in (0, 1)`).defaultTo(1)).addColumn("offline_payment_enabled", "integer", (column) => column.notNull().check(sql`offline_payment_enabled in (0, 1)`).defaultTo(1)).addColumn("open_tab_enabled", "integer", (column) => column.notNull().check(sql`open_tab_enabled in (0, 1)`).defaultTo(1)).addColumn("default_payment_mode", "text", (column) => column.notNull().check(PAYMENT_MODE_CHECK).defaultTo("prepaid")).addColumn("tab_authorization_ceiling_minor", "integer", (column) => column.notNull().check(sql`tab_authorization_ceiling_minor >= 0`).defaultTo(0)).addColumn("session_ttl_seconds", "integer", (column) => column.notNull().check(sql`session_ttl_seconds between 300 and 86400`).defaultTo(43200)).addColumn("version", "integer", (column) => column.notNull().check(sql`version >= 1`).defaultTo(1)).addColumn("created_at", "text", (column) => column.notNull().defaultTo(currentTimestamp$1(db))).addColumn("updated_at", "text", (column) => column.notNull().defaultTo(currentTimestamp$1(db))).addCheckConstraint("ck_restaurant_dine_in_settings_default_mode", sql`default_payment_mode <> 'tab' or open_tab_enabled = 1`).execute();
|
|
4802
4802
|
await db.schema.createIndex("idx_restaurant_dine_in_settings_location_id").ifNotExists().on("restaurant_dine_in_settings").column("location_id").execute();
|
|
4803
4803
|
await db.schema.createIndex("idx_restaurant_dine_in_settings_updated_at").ifNotExists().on("restaurant_dine_in_settings").column("updated_at").execute();
|
|
4804
4804
|
}
|
|
4805
|
-
async function down$
|
|
4805
|
+
async function down$45(db) {
|
|
4806
4806
|
await db.schema.dropTable("restaurant_dine_in_settings").ifExists().execute();
|
|
4807
4807
|
}
|
|
4808
4808
|
|
|
4809
4809
|
//#endregion
|
|
4810
4810
|
//#region src/database/migrations/080_restaurant_operating_settings.ts
|
|
4811
4811
|
var _080_restaurant_operating_settings_exports = /* @__PURE__ */ __exportAll({
|
|
4812
|
-
down: () => down$
|
|
4813
|
-
up: () => up$
|
|
4812
|
+
down: () => down$44,
|
|
4813
|
+
up: () => up$44
|
|
4814
4814
|
});
|
|
4815
|
-
async function up$
|
|
4815
|
+
async function up$44(db) {
|
|
4816
4816
|
await db.schema.createTable("restaurant_operating_settings").addColumn("id", "text", (column) => column.primaryKey()).addColumn("scope_key", "text", (column) => column.notNull().unique()).addColumn("location_id", "text", (column) => column.unique().references("restaurant_locations.id").onDelete("cascade")).addColumn("default_currency", "text").addColumn("default_timezone", "text").addColumn("default_service_modes_json", "text").addColumn("tips_enabled", "integer", (column) => column.check(sql`tips_enabled in (0, 1)`)).addColumn("suggested_tip_percentages_json", "text").addColumn("service_fee_basis_points", "integer", (column) => column.check(sql`service_fee_basis_points between 0 and 10000`)).addColumn("version", "integer", (column) => column.notNull().check(sql`version >= 1`).defaultTo(1)).addColumn("created_at", "text", (column) => column.notNull().defaultTo(currentTimestamp$1(db))).addColumn("updated_at", "text", (column) => column.notNull().defaultTo(currentTimestamp$1(db))).addCheckConstraint("ck_restaurant_operating_settings_scope", sql`(
|
|
4817
4817
|
location_id is null and scope_key = '*' and
|
|
4818
4818
|
default_currency is not null and default_timezone is not null and
|
|
@@ -4825,22 +4825,22 @@ async function up$43(db) {
|
|
|
4825
4825
|
await db.schema.createIndex("idx_restaurant_operating_settings_location_id").on("restaurant_operating_settings").column("location_id").execute();
|
|
4826
4826
|
await db.schema.createIndex("idx_restaurant_operating_settings_updated_at").on("restaurant_operating_settings").column("updated_at").execute();
|
|
4827
4827
|
}
|
|
4828
|
-
async function down$
|
|
4828
|
+
async function down$44(db) {
|
|
4829
4829
|
await db.schema.dropTable("restaurant_operating_settings").execute();
|
|
4830
4830
|
}
|
|
4831
4831
|
|
|
4832
4832
|
//#endregion
|
|
4833
4833
|
//#region src/database/migrations/081_restaurant_email_notification_settings.ts
|
|
4834
4834
|
var _081_restaurant_email_notification_settings_exports = /* @__PURE__ */ __exportAll({
|
|
4835
|
-
down: () => down$
|
|
4836
|
-
up: () => up$
|
|
4835
|
+
down: () => down$43,
|
|
4836
|
+
up: () => up$43
|
|
4837
4837
|
});
|
|
4838
|
-
async function up$
|
|
4838
|
+
async function up$43(db) {
|
|
4839
4839
|
await db.schema.alterTable("restaurant_notification_settings").addColumn("email_enabled", "integer", (col) => col.notNull().check(sql`email_enabled in (0, 1)`).defaultTo(0)).execute();
|
|
4840
4840
|
await db.schema.alterTable("restaurant_notification_settings").addColumn("email_event_types_json", "text", (col) => col.notNull().defaultTo("[]")).execute();
|
|
4841
4841
|
await db.schema.alterTable("restaurant_notification_settings").addColumn("email_templates_json", "text", (col) => col.notNull().defaultTo("{}")).execute();
|
|
4842
4842
|
}
|
|
4843
|
-
async function down$
|
|
4843
|
+
async function down$43(db) {
|
|
4844
4844
|
await db.schema.alterTable("restaurant_notification_settings").dropColumn("email_templates_json").execute();
|
|
4845
4845
|
await db.schema.alterTable("restaurant_notification_settings").dropColumn("email_event_types_json").execute();
|
|
4846
4846
|
await db.schema.alterTable("restaurant_notification_settings").dropColumn("email_enabled").execute();
|
|
@@ -4849,17 +4849,17 @@ async function down$42(db) {
|
|
|
4849
4849
|
//#endregion
|
|
4850
4850
|
//#region src/database/migrations/082_restaurant_reservation_checkout_holds.ts
|
|
4851
4851
|
var _082_restaurant_reservation_checkout_holds_exports = /* @__PURE__ */ __exportAll({
|
|
4852
|
-
down: () => down$
|
|
4853
|
-
up: () => up$
|
|
4852
|
+
down: () => down$42,
|
|
4853
|
+
up: () => up$42
|
|
4854
4854
|
});
|
|
4855
|
-
async function up$
|
|
4855
|
+
async function up$42(db) {
|
|
4856
4856
|
await db.schema.alterTable("restaurant_reservation_holds").addColumn("zone_id", "text", (col) => col.references("restaurant_zones.id").onDelete("set null")).execute();
|
|
4857
4857
|
await db.schema.alterTable("restaurant_reservation_holds").addColumn("token_id", "text").execute();
|
|
4858
4858
|
await db.schema.alterTable("restaurant_reservation_holds").addColumn("token_hash", "text").execute();
|
|
4859
4859
|
await db.schema.createIndex("idx_restaurant_reservation_holds_zone_id").on("restaurant_reservation_holds").column("zone_id").execute();
|
|
4860
4860
|
await db.schema.createIndex("idx_restaurant_reservation_holds_token_hash").unique().on("restaurant_reservation_holds").column("token_hash").execute();
|
|
4861
4861
|
}
|
|
4862
|
-
async function down$
|
|
4862
|
+
async function down$42(db) {
|
|
4863
4863
|
await db.schema.dropIndex("idx_restaurant_reservation_holds_token_hash").execute();
|
|
4864
4864
|
await db.schema.dropIndex("idx_restaurant_reservation_holds_zone_id").execute();
|
|
4865
4865
|
await db.schema.alterTable("restaurant_reservation_holds").dropColumn("token_hash").execute();
|
|
@@ -4870,10 +4870,10 @@ async function down$41(db) {
|
|
|
4870
4870
|
//#endregion
|
|
4871
4871
|
//#region src/database/migrations/083_restaurant_reservation_availability_indexes.ts
|
|
4872
4872
|
var _083_restaurant_reservation_availability_indexes_exports = /* @__PURE__ */ __exportAll({
|
|
4873
|
-
down: () => down$
|
|
4874
|
-
up: () => up$
|
|
4873
|
+
down: () => down$41,
|
|
4874
|
+
up: () => up$41
|
|
4875
4875
|
});
|
|
4876
|
-
async function up$
|
|
4876
|
+
async function up$41(db) {
|
|
4877
4877
|
await db.schema.createIndex("idx_restaurant_reservations_location_availability").on("restaurant_reservations").columns([
|
|
4878
4878
|
"location_id",
|
|
4879
4879
|
"status",
|
|
@@ -4888,7 +4888,7 @@ async function up$40(db) {
|
|
|
4888
4888
|
"expires_at"
|
|
4889
4889
|
]).execute();
|
|
4890
4890
|
}
|
|
4891
|
-
async function down$
|
|
4891
|
+
async function down$41(db) {
|
|
4892
4892
|
await db.schema.dropIndex("idx_restaurant_reservation_holds_location_availability").execute();
|
|
4893
4893
|
await db.schema.dropIndex("idx_restaurant_reservations_location_availability").execute();
|
|
4894
4894
|
}
|
|
@@ -4896,10 +4896,10 @@ async function down$40(db) {
|
|
|
4896
4896
|
//#endregion
|
|
4897
4897
|
//#region src/database/migrations/084_restaurant_reservation_demand.ts
|
|
4898
4898
|
var _084_restaurant_reservation_demand_exports = /* @__PURE__ */ __exportAll({
|
|
4899
|
-
down: () => down$
|
|
4900
|
-
up: () => up$
|
|
4899
|
+
down: () => down$40,
|
|
4900
|
+
up: () => up$40
|
|
4901
4901
|
});
|
|
4902
|
-
async function up$
|
|
4902
|
+
async function up$40(db) {
|
|
4903
4903
|
await createDemandSettings(db);
|
|
4904
4904
|
await createReservationRequests(db);
|
|
4905
4905
|
await createRequestTableAssignments(db);
|
|
@@ -4908,7 +4908,7 @@ async function up$39(db) {
|
|
|
4908
4908
|
await createPriorityAlertDeliveries(db);
|
|
4909
4909
|
await createIndexes$4(db);
|
|
4910
4910
|
}
|
|
4911
|
-
async function down$
|
|
4911
|
+
async function down$40(db) {
|
|
4912
4912
|
await db.schema.dropTable("restaurant_priority_alert_deliveries").execute();
|
|
4913
4913
|
await db.schema.dropTable("restaurant_priority_alert_opportunities").execute();
|
|
4914
4914
|
await db.schema.dropTable("restaurant_priority_alerts").execute();
|
|
@@ -4997,10 +4997,10 @@ async function createIndexes$4(db) {
|
|
|
4997
4997
|
//#endregion
|
|
4998
4998
|
//#region src/database/migrations/085_restaurant_reservation_offers.ts
|
|
4999
4999
|
var _085_restaurant_reservation_offers_exports = /* @__PURE__ */ __exportAll({
|
|
5000
|
-
down: () => down$
|
|
5001
|
-
up: () => up$
|
|
5000
|
+
down: () => down$39,
|
|
5001
|
+
up: () => up$39
|
|
5002
5002
|
});
|
|
5003
|
-
async function up$
|
|
5003
|
+
async function up$39(db) {
|
|
5004
5004
|
await db.schema.createTable("restaurant_reservation_offers").addColumn("id", "text", (col) => col.primaryKey()).addColumn("source_reservation_id", "text", (col) => col.notNull().unique().references("restaurant_reservations.id").onDelete("restrict")).addColumn("location_id", "text", (col) => col.notNull().references("restaurant_locations.id").onDelete("restrict")).addColumn("zone_id", "text", (col) => col.references("restaurant_zones.id").onDelete("set null")).addColumn("hold_id", "text", (col) => col.notNull().unique().references("restaurant_reservation_holds.id").onDelete("restrict")).addColumn("request_key", "text", (col) => col.notNull().unique()).addColumn("token_id", "text", (col) => col.notNull().unique()).addColumn("token_hash", "text", (col) => col.notNull().unique()).addColumn("expires_at", "text", (col) => col.notNull()).addColumn("service_date", "text", (col) => col.notNull().check(sql`length(service_date) = 10`)).addColumn("starts_at", "text", (col) => col.notNull()).addColumn("ends_at", "text", (col) => col.notNull()).addColumn("duration_minutes", "integer", (col) => col.notNull().check(sql`duration_minutes between 30 and 240`)).addColumn("party_size", "integer", (col) => col.notNull().check(sql`party_size between 1 and 1000`)).addColumn("message", "text").addColumn("payment_mode", "text", (col) => col.notNull().check(sql`payment_mode in ('none', 'charge')`).defaultTo("none")).addColumn("amount_minor", "integer", (col) => col.check(sql`amount_minor is null or amount_minor > 0`)).addColumn("currency", "text", (col) => col.check(sql`currency is null or length(currency) = 3`)).addColumn("status", "text", (col) => col.notNull().check(sql`status in ('pending', 'accepted', 'declined', 'expired')`).defaultTo("pending")).addColumn("accepted_reservation_id", "text", (col) => col.references("restaurant_reservations.id").onDelete("restrict")).addColumn("offered_by_actor_type", "text", (col) => col.notNull().check(sql`offered_by_actor_type in ('user', 'api_token', 'system')`)).addColumn("offered_by_actor_id", "text").addColumn("accepted_at", "text").addColumn("declined_at", "text").addColumn("expired_at", "text").addColumn("version", "integer", (col) => col.notNull().defaultTo(1)).addColumn("created_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).addColumn("updated_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).addCheckConstraint("ck_restaurant_reservation_offers_time", sql`ends_at > starts_at`).addCheckConstraint("ck_restaurant_reservation_offers_payment", sql`(payment_mode = 'none' and amount_minor is null and currency is null)
|
|
5005
5005
|
or (payment_mode = 'charge' and amount_minor is not null and currency is not null)`).addCheckConstraint("ck_restaurant_reservation_offers_state", sql`(
|
|
5006
5006
|
(status = 'pending' and accepted_reservation_id is null and accepted_at is null and declined_at is null and expired_at is null)
|
|
@@ -5014,17 +5014,17 @@ async function up$38(db) {
|
|
|
5014
5014
|
await db.schema.createIndex("idx_restaurant_reservation_offers_status_expires").on("restaurant_reservation_offers").columns(["status", "expires_at"]).execute();
|
|
5015
5015
|
await db.schema.createIndex("idx_restaurant_reservation_offers_created_at").on("restaurant_reservation_offers").column("created_at").execute();
|
|
5016
5016
|
}
|
|
5017
|
-
async function down$
|
|
5017
|
+
async function down$39(db) {
|
|
5018
5018
|
await db.schema.dropTable("restaurant_reservation_offers").execute();
|
|
5019
5019
|
}
|
|
5020
5020
|
|
|
5021
5021
|
//#endregion
|
|
5022
5022
|
//#region src/database/migrations/086_restaurant_reservation_payment_policies.ts
|
|
5023
5023
|
var _086_restaurant_reservation_payment_policies_exports = /* @__PURE__ */ __exportAll({
|
|
5024
|
-
down: () => down$
|
|
5025
|
-
up: () => up$
|
|
5024
|
+
down: () => down$38,
|
|
5025
|
+
up: () => up$38
|
|
5026
5026
|
});
|
|
5027
|
-
async function up$
|
|
5027
|
+
async function up$38(db) {
|
|
5028
5028
|
await db.schema.createTable("restaurant_reservation_payment_policies").addColumn("id", "text", (col) => col.primaryKey()).addColumn("location_id", "text", (col) => col.notNull().references("restaurant_locations.id").onDelete("restrict")).addColumn("request_key", "text", (col) => col.notNull().unique()).addColumn("name", "text", (col) => col.notNull()).addColumn("scope_type", "text", (col) => col.notNull().check(sql`scope_type in ('venue_default', 'party_size', 'service_window', 'experience')`)).addColumn("experience_key", "text").addColumn("service_date", "text", (col) => col.check(sql`service_date is null or length(service_date) = 10`)).addColumn("starts_at_local", "text", (col) => col.check(sql`starts_at_local is null or length(starts_at_local) = 5`)).addColumn("ends_at_local", "text", (col) => col.check(sql`ends_at_local is null or length(ends_at_local) = 5`)).addColumn("min_party_size", "integer", (col) => col.check(sql`min_party_size is null or min_party_size between 1 and 1000`)).addColumn("max_party_size", "integer", (col) => col.check(sql`max_party_size is null or max_party_size between 1 and 1000`)).addColumn("collection_mode", "text", (col) => col.notNull().check(sql`collection_mode in ('none', 'charge', 'authorize')`).defaultTo("none")).addColumn("amount_basis", "text", (col) => col.notNull().check(sql`amount_basis in ('none', 'fixed', 'per_guest', 'quote_percentage', 'quote_total')`).defaultTo("none")).addColumn("amount_value", "integer").addColumn("currency", "text", (col) => col.check(sql`currency is null or length(currency) = 3`)).addColumn("cancellation_window_minutes", "integer", (col) => col.notNull().check(sql`cancellation_window_minutes >= 0`).defaultTo(1440)).addColumn("cancellation_fee_basis", "text", (col) => col.notNull().check(sql`cancellation_fee_basis in ('none', 'fixed', 'percentage', 'full')`).defaultTo("none")).addColumn("cancellation_fee_value", "integer").addColumn("cancellation_fee_currency", "text", (col) => col.check(sql`cancellation_fee_currency is null or length(cancellation_fee_currency) = 3`)).addColumn("modification_requires_review", "integer", (col) => col.notNull().check(sql`modification_requires_review in (0, 1)`).defaultTo(1)).addColumn("status", "text", (col) => col.notNull().check(sql`status in ('active', 'inactive')`).defaultTo("active")).addColumn("version", "integer", (col) => col.notNull().defaultTo(1)).addColumn("created_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).addColumn("updated_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).addCheckConstraint("ck_restaurant_reservation_payment_policies_scope", sql`(
|
|
5029
5029
|
(scope_type = 'venue_default' and experience_key is null and service_date is null and starts_at_local is null and ends_at_local is null and min_party_size is null and max_party_size is null)
|
|
5030
5030
|
or (scope_type = 'experience' and experience_key is not null and service_date is null and starts_at_local is null and ends_at_local is null and min_party_size is null and max_party_size is null)
|
|
@@ -5061,17 +5061,17 @@ async function up$37(db) {
|
|
|
5061
5061
|
]).execute();
|
|
5062
5062
|
await db.schema.createIndex("idx_restaurant_reservation_payment_policies_created_at").on("restaurant_reservation_payment_policies").column("created_at").execute();
|
|
5063
5063
|
}
|
|
5064
|
-
async function down$
|
|
5064
|
+
async function down$38(db) {
|
|
5065
5065
|
await db.schema.dropTable("restaurant_reservation_payment_policies").execute();
|
|
5066
5066
|
}
|
|
5067
5067
|
|
|
5068
5068
|
//#endregion
|
|
5069
5069
|
//#region src/database/migrations/087_restaurant_reservation_commercial_catalog.ts
|
|
5070
5070
|
var _087_restaurant_reservation_commercial_catalog_exports = /* @__PURE__ */ __exportAll({
|
|
5071
|
-
down: () => down$
|
|
5072
|
-
up: () => up$
|
|
5071
|
+
down: () => down$37,
|
|
5072
|
+
up: () => up$37
|
|
5073
5073
|
});
|
|
5074
|
-
async function up$
|
|
5074
|
+
async function up$37(db) {
|
|
5075
5075
|
await db.schema.createTable("restaurant_reservation_experiences").addColumn("id", "text", (col) => col.primaryKey()).addColumn("location_id", "text", (col) => col.notNull().references("restaurant_locations.id").onDelete("restrict")).addColumn("request_key", "text", (col) => col.notNull().unique()).addColumn("experience_key", "text", (col) => col.notNull()).addColumn("name", "text", (col) => col.notNull()).addColumn("description", "text").addColumn("booking_mode", "text", (col) => col.notNull().check(sql`booking_mode in ('direct', 'request')`)).addColumn("price_basis", "text", (col) => col.notNull().check(sql`price_basis in ('none', 'fixed', 'per_guest', 'minimum_spend')`)).addColumn("price_minor", "integer").addColumn("currency", "text", (col) => col.check(sql`currency is null or length(currency) = 3`)).addColumn("duration_minutes", "integer", (col) => col.check(sql`duration_minutes is null or duration_minutes between 30 and 480`)).addColumn("min_party_size", "integer", (col) => col.notNull().check(sql`min_party_size between 1 and 1000`)).addColumn("max_party_size", "integer", (col) => col.notNull().check(sql`max_party_size between 1 and 1000`)).addColumn("max_bookings_per_slot", "integer", (col) => col.check(sql`max_bookings_per_slot is null or max_bookings_per_slot > 0`)).addColumn("max_covers_per_slot", "integer", (col) => col.check(sql`max_covers_per_slot is null or max_covers_per_slot > 0`)).addColumn("sales_start_at", "text").addColumn("sales_end_at", "text").addColumn("image_media_id", "text", (col) => col.references("media.id").onDelete("set null")).addColumn("image_alt_text", "text").addColumn("terms_text", "text").addColumn("status", "text", (col) => col.notNull().check(sql`status in ('draft', 'active', 'archived')`).defaultTo("draft")).addColumn("sort_order", "integer", (col) => col.notNull().defaultTo(0)).addColumn("version", "integer", (col) => col.notNull().defaultTo(1)).addColumn("created_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).addColumn("updated_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).addUniqueConstraint("uq_restaurant_reservation_experiences_location_key", ["location_id", "experience_key"]).addCheckConstraint("ck_restaurant_reservation_experiences_price", sql`(price_basis = 'none' and price_minor is null and currency is null)
|
|
5076
5076
|
or (price_basis in ('fixed', 'per_guest', 'minimum_spend') and price_minor is not null and price_minor > 0 and currency is not null)`).addCheckConstraint("ck_restaurant_reservation_experiences_party_size", sql`min_party_size <= max_party_size`).addCheckConstraint("ck_restaurant_reservation_experiences_sales_window", sql`sales_start_at is null or sales_end_at is null or sales_end_at > sales_start_at`).execute();
|
|
5077
5077
|
await db.schema.createTable("restaurant_reservation_addon_categories").addColumn("id", "text", (col) => col.primaryKey()).addColumn("location_id", "text", (col) => col.notNull().references("restaurant_locations.id").onDelete("restrict")).addColumn("request_key", "text", (col) => col.notNull().unique()).addColumn("category_key", "text", (col) => col.notNull()).addColumn("name", "text", (col) => col.notNull()).addColumn("description", "text").addColumn("available_for_standard", "integer", (col) => col.notNull().check(sql`available_for_standard in (0, 1)`).defaultTo(0)).addColumn("min_quantity", "integer", (col) => col.notNull().check(sql`min_quantity >= 0`).defaultTo(0)).addColumn("max_quantity", "integer", (col) => col.check(sql`max_quantity is null or max_quantity >= 0`)).addColumn("status", "text", (col) => col.notNull().check(sql`status in ('active', 'inactive', 'archived')`).defaultTo("active")).addColumn("sort_order", "integer", (col) => col.notNull().defaultTo(0)).addColumn("version", "integer", (col) => col.notNull().defaultTo(1)).addColumn("created_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).addColumn("updated_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).addUniqueConstraint("uq_restaurant_reservation_addon_categories_location_key", ["location_id", "category_key"]).addCheckConstraint("ck_restaurant_reservation_addon_categories_quantity", sql`max_quantity is null or min_quantity <= max_quantity`).execute();
|
|
@@ -5154,7 +5154,7 @@ async function up$36(db) {
|
|
|
5154
5154
|
]
|
|
5155
5155
|
]) await db.schema.createIndex(name).on(table).columns([...columns]).execute();
|
|
5156
5156
|
}
|
|
5157
|
-
async function down$
|
|
5157
|
+
async function down$37(db) {
|
|
5158
5158
|
await db.schema.dropTable("restaurant_reservation_experience_included_addons").execute();
|
|
5159
5159
|
await db.schema.dropTable("restaurant_reservation_experience_addon_categories").execute();
|
|
5160
5160
|
await db.schema.dropTable("restaurant_reservation_addons").execute();
|
|
@@ -5165,10 +5165,10 @@ async function down$36(db) {
|
|
|
5165
5165
|
//#endregion
|
|
5166
5166
|
//#region src/database/migrations/088_restaurant_reservation_hold_commercial_allocations.ts
|
|
5167
5167
|
var _088_restaurant_reservation_hold_commercial_allocations_exports = /* @__PURE__ */ __exportAll({
|
|
5168
|
-
down: () => down$
|
|
5169
|
-
up: () => up$
|
|
5168
|
+
down: () => down$36,
|
|
5169
|
+
up: () => up$36
|
|
5170
5170
|
});
|
|
5171
|
-
async function up$
|
|
5171
|
+
async function up$36(db) {
|
|
5172
5172
|
await db.schema.createTable("restaurant_reservation_hold_commercial_selections").addColumn("id", "text", (col) => col.primaryKey()).addColumn("hold_id", "text", (col) => col.notNull().unique().references("restaurant_reservation_holds.id").onDelete("cascade")).addColumn("location_id", "text", (col) => col.notNull().references("restaurant_locations.id").onDelete("restrict")).addColumn("experience_id", "text", (col) => col.references("restaurant_reservation_experiences.id").onDelete("restrict")).addColumn("experience_version", "integer").addColumn("revision", "integer", (col) => col.notNull().defaultTo(0)).addColumn("acknowledged_revision", "integer").addColumn("version", "integer", (col) => col.notNull().defaultTo(1)).addColumn("created_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).addColumn("updated_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).addCheckConstraint("ck_restaurant_reservation_hold_commercial_experience", sql`(experience_id is null and experience_version is null)
|
|
5173
5173
|
or (experience_id is not null and experience_version is not null and experience_version > 0)`).addCheckConstraint("ck_restaurant_reservation_hold_commercial_revision", sql`revision >= 0 and (acknowledged_revision is null or acknowledged_revision between 0 and revision)`).execute();
|
|
5174
5174
|
await db.schema.createTable("restaurant_reservation_hold_addons").addColumn("id", "text", (col) => col.primaryKey()).addColumn("selection_id", "text", (col) => col.notNull().references("restaurant_reservation_hold_commercial_selections.id").onDelete("cascade")).addColumn("hold_id", "text", (col) => col.notNull().references("restaurant_reservation_holds.id").onDelete("cascade")).addColumn("location_id", "text", (col) => col.notNull().references("restaurant_locations.id").onDelete("restrict")).addColumn("category_id", "text", (col) => col.notNull().references("restaurant_reservation_addon_categories.id").onDelete("restrict")).addColumn("addon_id", "text", (col) => col.notNull().references("restaurant_reservation_addons.id").onDelete("restrict")).addColumn("addon_version", "integer", (col) => col.notNull().check(sql`addon_version > 0`)).addColumn("allocation_kind", "text", (col) => col.notNull().check(sql`allocation_kind in ('included', 'selected')`)).addColumn("requested_quantity", "integer", (col) => col.notNull().check(sql`requested_quantity >= 0`)).addColumn("allocated_quantity", "integer", (col) => col.notNull().check(sql`allocated_quantity >= 0`)).addColumn("service_date", "text", (col) => col.notNull().check(sql`length(service_date) = 10`)).addColumn("starts_at", "text", (col) => col.notNull()).addColumn("expires_at", "text", (col) => col.notNull()).addColumn("status", "text", (col) => col.notNull().check(sql`status in ('active', 'committed', 'released', 'expired')`).defaultTo("active")).addColumn("released_at", "text").addColumn("version", "integer", (col) => col.notNull().defaultTo(1)).addColumn("created_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).addColumn("updated_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).addUniqueConstraint("uq_restaurant_reservation_hold_addon_kind", [
|
|
@@ -5232,7 +5232,7 @@ async function up$35(db) {
|
|
|
5232
5232
|
]
|
|
5233
5233
|
]) await db.schema.createIndex(name).on(table).columns([...columns]).execute();
|
|
5234
5234
|
}
|
|
5235
|
-
async function down$
|
|
5235
|
+
async function down$36(db) {
|
|
5236
5236
|
await db.schema.dropTable("restaurant_reservation_hold_addon_operations").execute();
|
|
5237
5237
|
await db.schema.dropTable("restaurant_reservation_hold_addons").execute();
|
|
5238
5238
|
await db.schema.dropTable("restaurant_reservation_hold_commercial_selections").execute();
|
|
@@ -5241,10 +5241,10 @@ async function down$35(db) {
|
|
|
5241
5241
|
//#endregion
|
|
5242
5242
|
//#region src/database/migrations/089_restaurant_reservation_quotes.ts
|
|
5243
5243
|
var _089_restaurant_reservation_quotes_exports = /* @__PURE__ */ __exportAll({
|
|
5244
|
-
down: () => down$
|
|
5245
|
-
up: () => up$
|
|
5244
|
+
down: () => down$35,
|
|
5245
|
+
up: () => up$35
|
|
5246
5246
|
});
|
|
5247
|
-
async function up$
|
|
5247
|
+
async function up$35(db) {
|
|
5248
5248
|
await db.schema.createTable("restaurant_reservation_quotes").addColumn("id", "text", (col) => col.primaryKey()).addColumn("hold_id", "text", (col) => col.notNull().references("restaurant_reservation_holds.id").onDelete("restrict")).addColumn("selection_id", "text", (col) => col.notNull().references("restaurant_reservation_hold_commercial_selections.id").onDelete("restrict")).addColumn("location_id", "text", (col) => col.notNull().references("restaurant_locations.id").onDelete("restrict")).addColumn("payment_policy_id", "text", (col) => col.notNull().references("restaurant_reservation_payment_policies.id").onDelete("restrict")).addColumn("payment_policy_version", "integer", (col) => col.notNull().check(sql`payment_policy_version > 0`)).addColumn("experience_id", "text", (col) => col.references("restaurant_reservation_experiences.id").onDelete("restrict")).addColumn("experience_version", "integer").addColumn("selection_revision", "integer", (col) => col.notNull().check(sql`selection_revision >= 0`)).addColumn("collection_mode", "text", (col) => col.notNull().check(sql`collection_mode in ('none', 'charge', 'authorize')`)).addColumn("currency", "text", (col) => col.notNull().check(sql`length(currency) = 3`)).addColumn("subtotal_minor", "integer", (col) => col.notNull().check(sql`subtotal_minor >= 0`)).addColumn("discount_minor", "integer", (col) => col.notNull().check(sql`discount_minor >= 0 and discount_minor <= subtotal_minor`)).addColumn("fee_minor", "integer", (col) => col.notNull().check(sql`fee_minor >= 0`)).addColumn("tax_minor", "integer", (col) => col.notNull().check(sql`tax_minor >= 0`)).addColumn("gratuity_minor", "integer", (col) => col.notNull().check(sql`gratuity_minor >= 0`)).addColumn("total_minor", "integer", (col) => col.notNull().check(sql`total_minor >= 0`)).addColumn("due_now_minor", "integer", (col) => col.notNull().check(sql`due_now_minor >= 0`)).addColumn("authorization_minor", "integer", (col) => col.notNull().check(sql`authorization_minor >= 0`)).addColumn("pricing_hash", "text", (col) => col.notNull().check(sql`length(pricing_hash) = 71 and pricing_hash like 'sha256:%'`)).addColumn("snapshot_json", "text", (col) => col.notNull()).addColumn("expires_at", "text", (col) => col.notNull()).addColumn("created_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).addUniqueConstraint("uq_restaurant_reservation_quotes_selection_revision", ["selection_id", "selection_revision"]).addCheckConstraint("ck_restaurant_reservation_quotes_experience", sql`(experience_id is null and experience_version is null)
|
|
5249
5249
|
or (experience_id is not null and experience_version is not null and experience_version > 0)`).addCheckConstraint("ck_restaurant_reservation_quotes_total", sql`total_minor = subtotal_minor - discount_minor + fee_minor + tax_minor + gratuity_minor`).addCheckConstraint("ck_restaurant_reservation_quotes_collection", sql`(collection_mode = 'none' and due_now_minor = 0 and authorization_minor = 0)
|
|
5250
5250
|
or (collection_mode = 'charge' and authorization_minor = 0)
|
|
@@ -5284,7 +5284,7 @@ async function up$34(db) {
|
|
|
5284
5284
|
]
|
|
5285
5285
|
]) await db.schema.createIndex(name).on(table).column(column).execute();
|
|
5286
5286
|
}
|
|
5287
|
-
async function down$
|
|
5287
|
+
async function down$35(db) {
|
|
5288
5288
|
await db.schema.dropTable("restaurant_reservation_quote_lines").execute();
|
|
5289
5289
|
await db.schema.dropTable("restaurant_reservation_quotes").execute();
|
|
5290
5290
|
}
|
|
@@ -5292,10 +5292,10 @@ async function down$34(db) {
|
|
|
5292
5292
|
//#endregion
|
|
5293
5293
|
//#region src/database/migrations/090_restaurant_reservation_quote_payments.ts
|
|
5294
5294
|
var _090_restaurant_reservation_quote_payments_exports = /* @__PURE__ */ __exportAll({
|
|
5295
|
-
down: () => down$
|
|
5296
|
-
up: () => up$
|
|
5295
|
+
down: () => down$34,
|
|
5296
|
+
up: () => up$34
|
|
5297
5297
|
});
|
|
5298
|
-
async function up$
|
|
5298
|
+
async function up$34(db) {
|
|
5299
5299
|
await sql.raw("PRAGMA foreign_keys = OFF").execute(db);
|
|
5300
5300
|
try {
|
|
5301
5301
|
await sql`
|
|
@@ -5370,7 +5370,7 @@ async function up$33(db) {
|
|
|
5370
5370
|
}
|
|
5371
5371
|
await assertForeignKeys$5(db);
|
|
5372
5372
|
}
|
|
5373
|
-
async function down$
|
|
5373
|
+
async function down$34(db) {
|
|
5374
5374
|
await db.schema.dropTable("restaurant_reservation_quote_checkouts").execute();
|
|
5375
5375
|
await sql`
|
|
5376
5376
|
DELETE FROM restaurant_refunds
|
|
@@ -5481,10 +5481,10 @@ async function assertForeignKeys$5(db) {
|
|
|
5481
5481
|
//#endregion
|
|
5482
5482
|
//#region src/database/migrations/091_restaurant_reservation_refunds.ts
|
|
5483
5483
|
var _091_restaurant_reservation_refunds_exports = /* @__PURE__ */ __exportAll({
|
|
5484
|
-
down: () => down$
|
|
5485
|
-
up: () => up$
|
|
5484
|
+
down: () => down$33,
|
|
5485
|
+
up: () => up$33
|
|
5486
5486
|
});
|
|
5487
|
-
async function up$
|
|
5487
|
+
async function up$33(db) {
|
|
5488
5488
|
await sql.raw("PRAGMA foreign_keys = OFF").execute(db);
|
|
5489
5489
|
try {
|
|
5490
5490
|
await sql`
|
|
@@ -5549,7 +5549,7 @@ async function up$32(db) {
|
|
|
5549
5549
|
}
|
|
5550
5550
|
await assertForeignKeys$4(db);
|
|
5551
5551
|
}
|
|
5552
|
-
async function down$
|
|
5552
|
+
async function down$33(db) {
|
|
5553
5553
|
await sql.raw("PRAGMA foreign_keys = OFF").execute(db);
|
|
5554
5554
|
try {
|
|
5555
5555
|
await sql`
|
|
@@ -5633,10 +5633,10 @@ async function assertForeignKeys$4(db) {
|
|
|
5633
5633
|
//#endregion
|
|
5634
5634
|
//#region src/database/migrations/092_restaurant_guest_profiles.ts
|
|
5635
5635
|
var _092_restaurant_guest_profiles_exports = /* @__PURE__ */ __exportAll({
|
|
5636
|
-
down: () => down$
|
|
5637
|
-
up: () => up$
|
|
5636
|
+
down: () => down$32,
|
|
5637
|
+
up: () => up$32
|
|
5638
5638
|
});
|
|
5639
|
-
async function up$
|
|
5639
|
+
async function up$32(db) {
|
|
5640
5640
|
await db.schema.createTable("restaurant_guest_profiles").addColumn("id", "text", (col) => col.primaryKey()).addColumn("location_id", "text", (col) => col.notNull().references("restaurant_locations.id").onDelete("restrict")).addColumn("created_request_key", "text", (col) => col.notNull().unique()).addColumn("claimed_user_id", "text", (col) => col.references("users.id").onDelete("set null")).addColumn("display_name", "text", (col) => col.notNull().check(sql`length(display_name) between 1 and 160`)).addColumn("normalized_email", "text").addColumn("normalized_phone", "text").addColumn("preferred_language", "text", (col) => col.notNull().check(sql`length(preferred_language) between 2 and 35`).defaultTo("en")).addColumn("preferred_channel", "text", (col) => col.check(sql`preferred_channel in ('email', 'sms', 'whatsapp')`)).addColumn("priority_tier", "integer", (col) => col.notNull().check(sql`priority_tier between 0 and 100`).defaultTo(0)).addColumn("status", "text", (col) => col.notNull().check(sql`status in ('active', 'merged', 'anonymized')`).defaultTo("active")).addColumn("merged_into_id", "text", (col) => col.references("restaurant_guest_profiles.id").onDelete("restrict")).addColumn("last_activity_at", "text", (col) => col.notNull()).addColumn("anonymized_at", "text").addColumn("version", "integer", (col) => col.notNull().defaultTo(1)).addColumn("created_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).addColumn("updated_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).addCheckConstraint("ck_restaurant_guest_profiles_identity", sql`(status = 'active' and (normalized_email is not null or normalized_phone is not null) and merged_into_id is null and anonymized_at is null) or (status = 'merged' and merged_into_id is not null and anonymized_at is null) or (status = 'anonymized' and normalized_email is null and normalized_phone is null and merged_into_id is null and anonymized_at is not null)`).addCheckConstraint("ck_restaurant_guest_profiles_distinct_merge", sql`merged_into_id is null or merged_into_id <> id`).execute();
|
|
5641
5641
|
await db.schema.createTable("restaurant_guest_profile_requests").addColumn("request_key", "text", (col) => col.primaryKey()).addColumn("profile_id", "text", (col) => col.notNull().references("restaurant_guest_profiles.id").onDelete("cascade")).addColumn("location_id", "text", (col) => col.notNull().references("restaurant_locations.id").onDelete("restrict")).addColumn("input_fingerprint", "text", (col) => col.notNull().check(sql`length(input_fingerprint) = 64`)).addColumn("created_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).execute();
|
|
5642
5642
|
await db.schema.createTable("restaurant_guest_profile_reservations").addColumn("id", "text", (col) => col.primaryKey()).addColumn("profile_id", "text", (col) => col.notNull().references("restaurant_guest_profiles.id").onDelete("cascade")).addColumn("reservation_id", "text", (col) => col.notNull().unique().references("restaurant_reservations.id").onDelete("cascade")).addColumn("location_id", "text", (col) => col.notNull().references("restaurant_locations.id").onDelete("restrict")).addColumn("match_source", "text", (col) => col.notNull().check(sql`match_source in ('contact', 'account', 'staff', 'import')`)).addColumn("created_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).execute();
|
|
@@ -5709,7 +5709,7 @@ async function up$31(db) {
|
|
|
5709
5709
|
await sql`CREATE UNIQUE INDEX idx_restaurant_guest_profiles_active_phone ON restaurant_guest_profiles(location_id, normalized_phone) WHERE status = 'active' AND normalized_phone IS NOT NULL`.execute(db);
|
|
5710
5710
|
await sql`CREATE UNIQUE INDEX idx_restaurant_guest_profiles_claimed_user_location ON restaurant_guest_profiles(location_id, claimed_user_id) WHERE status = 'active' AND claimed_user_id IS NOT NULL`.execute(db);
|
|
5711
5711
|
}
|
|
5712
|
-
async function down$
|
|
5712
|
+
async function down$32(db) {
|
|
5713
5713
|
await db.schema.dropTable("restaurant_guest_consents").execute();
|
|
5714
5714
|
await db.schema.dropTable("restaurant_guest_profile_reservations").execute();
|
|
5715
5715
|
await db.schema.dropTable("restaurant_guest_profile_requests").execute();
|
|
@@ -5719,24 +5719,24 @@ async function down$31(db) {
|
|
|
5719
5719
|
//#endregion
|
|
5720
5720
|
//#region src/database/migrations/093_restaurant_guest_profile_retention.ts
|
|
5721
5721
|
var _093_restaurant_guest_profile_retention_exports = /* @__PURE__ */ __exportAll({
|
|
5722
|
-
down: () => down$
|
|
5723
|
-
up: () => up$
|
|
5722
|
+
down: () => down$31,
|
|
5723
|
+
up: () => up$31
|
|
5724
5724
|
});
|
|
5725
|
-
async function up$
|
|
5725
|
+
async function up$31(db) {
|
|
5726
5726
|
await db.schema.createTable("restaurant_guest_profile_retention_settings").addColumn("id", "text", (col) => col.primaryKey()).addColumn("location_id", "text", (col) => col.notNull().references("restaurant_locations.id").onDelete("cascade")).addColumn("inactivity_months", "integer", (col) => col.notNull().check(sql`inactivity_months between 1 and 120`).defaultTo(24)).addColumn("version", "integer", (col) => col.notNull().defaultTo(1)).addColumn("created_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).addColumn("updated_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).execute();
|
|
5727
5727
|
await db.schema.createIndex("idx_restaurant_guest_profile_retention_location_id").unique().on("restaurant_guest_profile_retention_settings").column("location_id").execute();
|
|
5728
5728
|
}
|
|
5729
|
-
async function down$
|
|
5729
|
+
async function down$31(db) {
|
|
5730
5730
|
await db.schema.dropTable("restaurant_guest_profile_retention_settings").execute();
|
|
5731
5731
|
}
|
|
5732
5732
|
|
|
5733
5733
|
//#endregion
|
|
5734
5734
|
//#region src/database/migrations/094_restaurant_guest_profile_sharing.ts
|
|
5735
5735
|
var _094_restaurant_guest_profile_sharing_exports = /* @__PURE__ */ __exportAll({
|
|
5736
|
-
down: () => down$
|
|
5737
|
-
up: () => up$
|
|
5736
|
+
down: () => down$30,
|
|
5737
|
+
up: () => up$30
|
|
5738
5738
|
});
|
|
5739
|
-
async function up$
|
|
5739
|
+
async function up$30(db) {
|
|
5740
5740
|
await db.schema.createTable("restaurant_related_location_pairs").addColumn("id", "text", (col) => col.primaryKey()).addColumn("location_a_id", "text", (col) => col.notNull().references("restaurant_locations.id").onDelete("restrict")).addColumn("location_b_id", "text", (col) => col.notNull().references("restaurant_locations.id").onDelete("restrict")).addColumn("status", "text", (col) => col.notNull().check(sql`status in ('active', 'inactive')`)).addColumn("policy_version", "text", (col) => col.notNull().check(sql`length(policy_version) between 1 and 128`)).addColumn("version", "integer", (col) => col.notNull().defaultTo(1)).addColumn("created_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).addColumn("updated_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).addUniqueConstraint("uq_restaurant_related_location_pairs_locations", ["location_a_id", "location_b_id"]).addCheckConstraint("ck_restaurant_related_location_pairs_canonical", sql`location_a_id < location_b_id`).execute();
|
|
5741
5741
|
await db.schema.createTable("restaurant_guest_profile_sharing_consents").addColumn("id", "text", (col) => col.primaryKey()).addColumn("pair_id", "text", (col) => col.notNull().references("restaurant_related_location_pairs.id").onDelete("restrict")).addColumn("profile_id", "text", (col) => col.notNull().references("restaurant_guest_profiles.id").onDelete("cascade")).addColumn("source_location_id", "text", (col) => col.notNull().references("restaurant_locations.id").onDelete("restrict")).addColumn("target_location_id", "text", (col) => col.notNull().references("restaurant_locations.id").onDelete("restrict")).addColumn("request_key", "text", (col) => col.notNull().unique()).addColumn("status", "text", (col) => col.notNull().check(sql`status in ('granted', 'withdrawn')`)).addColumn("source", "text", (col) => col.notNull().check(sql`source in ('checkout', 'account')`)).addColumn("policy_version", "text", (col) => col.notNull().check(sql`length(policy_version) between 1 and 128`)).addColumn("occurred_at", "text", (col) => col.notNull()).addColumn("created_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).addCheckConstraint("ck_restaurant_guest_profile_sharing_distinct_locations", sql`source_location_id <> target_location_id`).execute();
|
|
5742
5742
|
for (const [name, table, columns] of [
|
|
@@ -5782,7 +5782,7 @@ async function up$29(db) {
|
|
|
5782
5782
|
]
|
|
5783
5783
|
]) await db.schema.createIndex(name).on(table).columns([...columns]).execute();
|
|
5784
5784
|
}
|
|
5785
|
-
async function down$
|
|
5785
|
+
async function down$30(db) {
|
|
5786
5786
|
await db.schema.dropTable("restaurant_guest_profile_sharing_consents").execute();
|
|
5787
5787
|
await db.schema.dropTable("restaurant_related_location_pairs").execute();
|
|
5788
5788
|
}
|
|
@@ -5790,10 +5790,10 @@ async function down$29(db) {
|
|
|
5790
5790
|
//#endregion
|
|
5791
5791
|
//#region src/database/migrations/095_restaurant_priority_alert_notification_recovery.ts
|
|
5792
5792
|
var _095_restaurant_priority_alert_notification_recovery_exports = /* @__PURE__ */ __exportAll({
|
|
5793
|
-
down: () => down$
|
|
5794
|
-
up: () => up$
|
|
5793
|
+
down: () => down$29,
|
|
5794
|
+
up: () => up$29
|
|
5795
5795
|
});
|
|
5796
|
-
async function up$
|
|
5796
|
+
async function up$29(db) {
|
|
5797
5797
|
await db.schema.alterTable("restaurant_priority_alerts").addColumn("preferred_language", "text", (col) => col.notNull().defaultTo("en").check(sql`length(preferred_language) between 2 and 35`)).execute();
|
|
5798
5798
|
await db.schema.alterTable("restaurant_priority_alert_deliveries").addColumn("channel_attempt_count", "integer", (col) => col.notNull().defaultTo(0).check(sql`channel_attempt_count >= 0`)).execute();
|
|
5799
5799
|
await db.schema.alterTable("restaurant_priority_alert_deliveries").addColumn("fallback_count", "integer", (col) => col.notNull().defaultTo(0).check(sql`fallback_count >= 0`)).execute();
|
|
@@ -5803,7 +5803,7 @@ async function up$28(db) {
|
|
|
5803
5803
|
"id"
|
|
5804
5804
|
]).execute();
|
|
5805
5805
|
}
|
|
5806
|
-
async function down$
|
|
5806
|
+
async function down$29(db) {
|
|
5807
5807
|
await db.schema.dropIndex("idx_restaurant_priority_alert_deliveries_failure_queue").execute();
|
|
5808
5808
|
await db.schema.alterTable("restaurant_priority_alert_deliveries").dropColumn("fallback_count").execute();
|
|
5809
5809
|
await db.schema.alterTable("restaurant_priority_alert_deliveries").dropColumn("channel_attempt_count").execute();
|
|
@@ -5816,8 +5816,8 @@ var _096_restaurant_reservation_notification_preferences_exports = /* @__PURE__
|
|
|
5816
5816
|
addRestaurantReservationNotificationPreferenceColumns: () => addRestaurantReservationNotificationPreferenceColumns,
|
|
5817
5817
|
addRestaurantReservationQuoteCheckoutNotificationPreferenceColumns: () => addRestaurantReservationQuoteCheckoutNotificationPreferenceColumns,
|
|
5818
5818
|
addRestaurantReservationRequestNotificationPreferenceColumns: () => addRestaurantReservationRequestNotificationPreferenceColumns,
|
|
5819
|
-
down: () => down$
|
|
5820
|
-
up: () => up$
|
|
5819
|
+
down: () => down$28,
|
|
5820
|
+
up: () => up$28
|
|
5821
5821
|
});
|
|
5822
5822
|
async function addRestaurantReservationNotificationPreferenceColumns(db) {
|
|
5823
5823
|
await addNotificationPreferenceColumns(db, "restaurant_reservations");
|
|
@@ -5828,12 +5828,12 @@ async function addRestaurantReservationRequestNotificationPreferenceColumns(db)
|
|
|
5828
5828
|
async function addRestaurantReservationQuoteCheckoutNotificationPreferenceColumns(db) {
|
|
5829
5829
|
await addNotificationPreferenceColumns(db, "restaurant_reservation_quote_checkouts");
|
|
5830
5830
|
}
|
|
5831
|
-
async function up$
|
|
5831
|
+
async function up$28(db) {
|
|
5832
5832
|
await addRestaurantReservationNotificationPreferenceColumns(db);
|
|
5833
5833
|
await addRestaurantReservationRequestNotificationPreferenceColumns(db);
|
|
5834
5834
|
await addRestaurantReservationQuoteCheckoutNotificationPreferenceColumns(db);
|
|
5835
5835
|
}
|
|
5836
|
-
async function down$
|
|
5836
|
+
async function down$28(db) {
|
|
5837
5837
|
await dropNotificationPreferenceColumns(db, "restaurant_reservation_quote_checkouts");
|
|
5838
5838
|
await dropNotificationPreferenceColumns(db, "restaurant_reservation_requests");
|
|
5839
5839
|
await dropNotificationPreferenceColumns(db, "restaurant_reservations");
|
|
@@ -5852,12 +5852,12 @@ async function dropNotificationPreferenceColumns(db, table) {
|
|
|
5852
5852
|
//#endregion
|
|
5853
5853
|
//#region src/database/migrations/097_restaurant_guest_notification_recovery.ts
|
|
5854
5854
|
var _097_restaurant_guest_notification_recovery_exports = /* @__PURE__ */ __exportAll({
|
|
5855
|
-
down: () => down$
|
|
5856
|
-
up: () => up$
|
|
5855
|
+
down: () => down$27,
|
|
5856
|
+
up: () => up$27
|
|
5857
5857
|
});
|
|
5858
5858
|
const REBUILT_TABLE = "_restaurant_outbox_deliveries_097";
|
|
5859
5859
|
const DOWN_TABLE$3 = "_restaurant_outbox_deliveries_097_down";
|
|
5860
|
-
async function up$
|
|
5860
|
+
async function up$27(db) {
|
|
5861
5861
|
await sql.raw("PRAGMA foreign_keys = OFF").execute(db);
|
|
5862
5862
|
try {
|
|
5863
5863
|
await createRecoverableDeliveryTable(db, REBUILT_TABLE);
|
|
@@ -5881,7 +5881,7 @@ async function up$26(db) {
|
|
|
5881
5881
|
}
|
|
5882
5882
|
await assertForeignKeys$3(db);
|
|
5883
5883
|
}
|
|
5884
|
-
async function down$
|
|
5884
|
+
async function down$27(db) {
|
|
5885
5885
|
await sql.raw("PRAGMA foreign_keys = OFF").execute(db);
|
|
5886
5886
|
try {
|
|
5887
5887
|
await createLegacyDeliveryTable(db, DOWN_TABLE$3);
|
|
@@ -5933,12 +5933,12 @@ async function assertForeignKeys$3(db) {
|
|
|
5933
5933
|
//#endregion
|
|
5934
5934
|
//#region src/database/migrations/098_restaurant_private_event_requests.ts
|
|
5935
5935
|
var _098_restaurant_private_event_requests_exports = /* @__PURE__ */ __exportAll({
|
|
5936
|
-
down: () => down$
|
|
5937
|
-
up: () => up$
|
|
5936
|
+
down: () => down$26,
|
|
5937
|
+
up: () => up$26
|
|
5938
5938
|
});
|
|
5939
5939
|
const UP_TABLE$2 = "_restaurant_reservation_requests_098";
|
|
5940
5940
|
const DOWN_TABLE$2 = "_restaurant_reservation_requests_098_down";
|
|
5941
|
-
async function up$
|
|
5941
|
+
async function up$26(db) {
|
|
5942
5942
|
await sql.raw("PRAGMA foreign_keys = OFF").execute(db);
|
|
5943
5943
|
try {
|
|
5944
5944
|
await createExperienceRequestTable(db);
|
|
@@ -5975,7 +5975,7 @@ async function up$25(db) {
|
|
|
5975
5975
|
}
|
|
5976
5976
|
await assertForeignKeys$2(db);
|
|
5977
5977
|
}
|
|
5978
|
-
async function down$
|
|
5978
|
+
async function down$26(db) {
|
|
5979
5979
|
await sql.raw("PRAGMA foreign_keys = OFF").execute(db);
|
|
5980
5980
|
try {
|
|
5981
5981
|
await createLegacyRequestTable(db);
|
|
@@ -6162,10 +6162,10 @@ async function assertForeignKeys$2(db) {
|
|
|
6162
6162
|
//#endregion
|
|
6163
6163
|
//#region src/database/migrations/099_restaurant_reservation_promotions.ts
|
|
6164
6164
|
var _099_restaurant_reservation_promotions_exports = /* @__PURE__ */ __exportAll({
|
|
6165
|
-
down: () => down$
|
|
6166
|
-
up: () => up$
|
|
6165
|
+
down: () => down$25,
|
|
6166
|
+
up: () => up$25
|
|
6167
6167
|
});
|
|
6168
|
-
async function up$
|
|
6168
|
+
async function up$25(db) {
|
|
6169
6169
|
await db.schema.createTable("restaurant_reservation_promotions").addColumn("id", "text", (col) => col.primaryKey()).addColumn("location_id", "text", (col) => col.notNull().references("restaurant_locations.id").onDelete("restrict")).addColumn("request_key", "text", (col) => col.notNull().unique()).addColumn("code_digest", "text", (col) => col.notNull().check(sql`length(code_digest) = 71 and code_digest like 'sha256:%'`)).addColumn("code_hint", "text", (col) => col.notNull().check(sql`length(code_hint) between 1 and 8`)).addColumn("name", "text", (col) => col.notNull().check(sql`length(name) between 1 and 160`)).addColumn("discount_type", "text", (col) => col.notNull().check(sql`discount_type in ('fixed', 'percentage')`)).addColumn("discount_value", "integer", (col) => col.notNull().check(sql`discount_value > 0`)).addColumn("max_discount_minor", "integer", (col) => col.check(sql`max_discount_minor is null or max_discount_minor > 0`)).addColumn("currency", "text", (col) => col.notNull().check(sql`length(currency) = 3`)).addColumn("applies_to", "text", (col) => col.notNull().check(sql`applies_to in ('all', 'experience', 'addons')`)).addColumn("service_starts_at", "text").addColumn("service_ends_at", "text").addColumn("max_redemptions", "integer", (col) => col.check(sql`max_redemptions is null or max_redemptions > 0`)).addColumn("reserved_count", "integer", (col) => col.notNull().defaultTo(0).check(sql`reserved_count >= 0`)).addColumn("redeemed_count", "integer", (col) => col.notNull().defaultTo(0).check(sql`redeemed_count >= 0`)).addColumn("status", "text", (col) => col.notNull().defaultTo("active").check(sql`status in ('active', 'archived')`)).addColumn("version", "integer", (col) => col.notNull().defaultTo(1)).addColumn("created_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).addColumn("updated_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).addUniqueConstraint("uq_restaurant_reservation_promotions_location_code", ["location_id", "code_digest"]).addCheckConstraint("ck_restaurant_reservation_promotions_discount", sql`(discount_type = 'fixed' and max_discount_minor is null)
|
|
6170
6170
|
or (discount_type = 'percentage' and discount_value between 1 and 10000)`).addCheckConstraint("ck_restaurant_reservation_promotions_window", sql`service_starts_at is null or service_ends_at is null or service_ends_at > service_starts_at`).addCheckConstraint("ck_restaurant_reservation_promotions_counts", sql`max_redemptions is null or reserved_count + redeemed_count <= max_redemptions`).execute();
|
|
6171
6171
|
await db.schema.createTable("restaurant_reservation_promotion_allocations").addColumn("id", "text", (col) => col.primaryKey()).addColumn("promotion_id", "text", (col) => col.notNull().references("restaurant_reservation_promotions.id").onDelete("restrict")).addColumn("promotion_version", "integer", (col) => col.notNull().check(sql`promotion_version > 0`)).addColumn("selection_id", "text", (col) => col.notNull().references("restaurant_reservation_hold_commercial_selections.id").onDelete("restrict")).addColumn("hold_id", "text", (col) => col.notNull().references("restaurant_reservation_holds.id").onDelete("restrict")).addColumn("location_id", "text", (col) => col.notNull().references("restaurant_locations.id").onDelete("restrict")).addColumn("reservation_id", "text", (col) => col.references("restaurant_reservations.id").onDelete("restrict")).addColumn("promotion_name", "text", (col) => col.notNull().check(sql`length(promotion_name) between 1 and 160`)).addColumn("code_hint", "text", (col) => col.notNull().check(sql`length(code_hint) between 1 and 8`)).addColumn("discount_type", "text", (col) => col.notNull().check(sql`discount_type in ('fixed', 'percentage')`)).addColumn("discount_value", "integer", (col) => col.notNull().check(sql`discount_value > 0`)).addColumn("max_discount_minor", "integer", (col) => col.check(sql`max_discount_minor is null or max_discount_minor > 0`)).addColumn("currency", "text", (col) => col.notNull().check(sql`length(currency) = 3`)).addColumn("applies_to", "text", (col) => col.notNull().check(sql`applies_to in ('all', 'experience', 'addons')`)).addColumn("expires_at", "text", (col) => col.notNull()).addColumn("status", "text", (col) => col.notNull().defaultTo("held").check(sql`status in ('held', 'attached', 'redeemed', 'released')`)).addColumn("attached_at", "text").addColumn("redeemed_at", "text").addColumn("released_at", "text").addColumn("version", "integer", (col) => col.notNull().defaultTo(1)).addColumn("created_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).addColumn("updated_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).addCheckConstraint("ck_restaurant_reservation_promotion_allocations_discount", sql`(discount_type = 'fixed' and max_discount_minor is null)
|
|
@@ -6227,7 +6227,7 @@ async function up$24(db) {
|
|
|
6227
6227
|
WHERE status IN ('held', 'attached')
|
|
6228
6228
|
`.execute(db);
|
|
6229
6229
|
}
|
|
6230
|
-
async function down$
|
|
6230
|
+
async function down$25(db) {
|
|
6231
6231
|
await db.schema.dropTable("restaurant_reservation_promotion_operations").execute();
|
|
6232
6232
|
await db.schema.dropTable("restaurant_reservation_promotion_allocations").execute();
|
|
6233
6233
|
await db.schema.dropTable("restaurant_reservation_promotions").execute();
|
|
@@ -6236,10 +6236,10 @@ async function down$24(db) {
|
|
|
6236
6236
|
//#endregion
|
|
6237
6237
|
//#region src/database/migrations/100_restaurant_reservation_gift_cards.ts
|
|
6238
6238
|
var _100_restaurant_reservation_gift_cards_exports = /* @__PURE__ */ __exportAll({
|
|
6239
|
-
down: () => down$
|
|
6240
|
-
up: () => up$
|
|
6239
|
+
down: () => down$24,
|
|
6240
|
+
up: () => up$24
|
|
6241
6241
|
});
|
|
6242
|
-
async function up$
|
|
6242
|
+
async function up$24(db) {
|
|
6243
6243
|
await db.schema.createTable("restaurant_gift_cards").addColumn("id", "text", (col) => col.primaryKey()).addColumn("location_id", "text", (col) => col.notNull().references("restaurant_locations.id").onDelete("restrict")).addColumn("request_key", "text", (col) => col.notNull().unique()).addColumn("request_hash", "text", (col) => col.notNull().check(sql`length(request_hash) = 64`)).addColumn("number_digest", "text", (col) => col.notNull().check(sql`length(number_digest) = 71 and number_digest like 'sha256:%'`)).addColumn("number_hint", "text", (col) => col.notNull().check(sql`length(number_hint) between 1 and 8`)).addColumn("pin_digest", "text", (col) => col.notNull().check(sql`length(pin_digest) = 71 and pin_digest like 'sha256:%'`)).addColumn("currency", "text", (col) => col.notNull().check(sql`length(currency) = 3`)).addColumn("available_minor", "integer", (col) => col.notNull().defaultTo(0).check(sql`available_minor >= 0`)).addColumn("held_minor", "integer", (col) => col.notNull().defaultTo(0).check(sql`held_minor >= 0`)).addColumn("status", "text", (col) => col.notNull().defaultTo("active").check(sql`status in ('active', 'inactive')`)).addColumn("version", "integer", (col) => col.notNull().defaultTo(1).check(sql`version > 0`)).addColumn("created_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).addColumn("updated_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).addUniqueConstraint("uq_restaurant_gift_cards_location_number", ["location_id", "number_digest"]).execute();
|
|
6244
6244
|
await db.schema.createTable("restaurant_reservation_gift_card_allocations").addColumn("id", "text", (col) => col.primaryKey()).addColumn("gift_card_id", "text", (col) => col.notNull().references("restaurant_gift_cards.id").onDelete("restrict")).addColumn("gift_card_version", "integer", (col) => col.notNull().check(sql`gift_card_version > 0`)).addColumn("selection_id", "text", (col) => col.notNull().references("restaurant_reservation_hold_commercial_selections.id").onDelete("restrict")).addColumn("hold_id", "text", (col) => col.notNull().references("restaurant_reservation_holds.id").onDelete("restrict")).addColumn("location_id", "text", (col) => col.notNull().references("restaurant_locations.id").onDelete("restrict")).addColumn("reservation_id", "text", (col) => col.references("restaurant_reservations.id").onDelete("restrict")).addColumn("card_hint", "text", (col) => col.notNull().check(sql`length(card_hint) between 1 and 8`)).addColumn("currency", "text", (col) => col.notNull().check(sql`length(currency) = 3`)).addColumn("amount_minor", "integer", (col) => col.notNull().check(sql`amount_minor > 0`)).addColumn("refunded_minor", "integer", (col) => col.notNull().defaultTo(0).check(sql`refunded_minor >= 0`)).addColumn("expires_at", "text", (col) => col.notNull()).addColumn("status", "text", (col) => col.notNull().defaultTo("held").check(sql`status in ('held', 'redeemed', 'released')`)).addColumn("redeemed_at", "text").addColumn("released_at", "text").addColumn("version", "integer", (col) => col.notNull().defaultTo(1).check(sql`version > 0`)).addColumn("created_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).addColumn("updated_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).addCheckConstraint("ck_restaurant_reservation_gift_card_allocations_refund", sql`refunded_minor <= amount_minor`).addCheckConstraint("ck_restaurant_reservation_gift_card_allocations_state", sql`(status = 'held' and reservation_id is null and redeemed_at is null and released_at is null and refunded_minor = 0)
|
|
6245
6245
|
or (status = 'redeemed' and reservation_id is not null and redeemed_at is not null and released_at is null)
|
|
@@ -6318,7 +6318,7 @@ async function up$23(db) {
|
|
|
6318
6318
|
WHERE status = 'held'
|
|
6319
6319
|
`.execute(db);
|
|
6320
6320
|
}
|
|
6321
|
-
async function down$
|
|
6321
|
+
async function down$24(db) {
|
|
6322
6322
|
await db.schema.dropTable("restaurant_reservation_gift_card_operations").execute();
|
|
6323
6323
|
await db.schema.dropTable("restaurant_gift_card_ledger_entries").execute();
|
|
6324
6324
|
await db.schema.dropTable("restaurant_reservation_gift_card_allocations").execute();
|
|
@@ -6328,12 +6328,12 @@ async function down$23(db) {
|
|
|
6328
6328
|
//#endregion
|
|
6329
6329
|
//#region src/database/migrations/101_restaurant_reservation_request_payment_links.ts
|
|
6330
6330
|
var _101_restaurant_reservation_request_payment_links_exports = /* @__PURE__ */ __exportAll({
|
|
6331
|
-
down: () => down$
|
|
6332
|
-
up: () => up$
|
|
6331
|
+
down: () => down$23,
|
|
6332
|
+
up: () => up$23
|
|
6333
6333
|
});
|
|
6334
6334
|
const UP_TABLE$1 = "_restaurant_guest_access_101";
|
|
6335
6335
|
const DOWN_TABLE$1 = "_restaurant_guest_access_101_down";
|
|
6336
|
-
async function up$
|
|
6336
|
+
async function up$23(db) {
|
|
6337
6337
|
await sql.raw("PRAGMA foreign_keys = OFF").execute(db);
|
|
6338
6338
|
try {
|
|
6339
6339
|
await createGuestAccessTable$1(db, UP_TABLE$1, true);
|
|
@@ -6347,7 +6347,7 @@ async function up$22(db) {
|
|
|
6347
6347
|
}
|
|
6348
6348
|
await assertForeignKeys$1(db);
|
|
6349
6349
|
}
|
|
6350
|
-
async function down$
|
|
6350
|
+
async function down$23(db) {
|
|
6351
6351
|
await sql.raw("PRAGMA foreign_keys = OFF").execute(db);
|
|
6352
6352
|
try {
|
|
6353
6353
|
await db.schema.dropTable("restaurant_reservation_request_payment_link_deliveries").execute();
|
|
@@ -6410,12 +6410,12 @@ async function assertForeignKeys$1(db) {
|
|
|
6410
6410
|
//#endregion
|
|
6411
6411
|
//#region src/database/migrations/102_restaurant_reservation_offer_links.ts
|
|
6412
6412
|
var _102_restaurant_reservation_offer_links_exports = /* @__PURE__ */ __exportAll({
|
|
6413
|
-
down: () => down$
|
|
6414
|
-
up: () => up$
|
|
6413
|
+
down: () => down$22,
|
|
6414
|
+
up: () => up$22
|
|
6415
6415
|
});
|
|
6416
6416
|
const UP_TABLE = "_restaurant_guest_access_102";
|
|
6417
6417
|
const DOWN_TABLE = "_restaurant_guest_access_102_down";
|
|
6418
|
-
async function up$
|
|
6418
|
+
async function up$22(db) {
|
|
6419
6419
|
await sql.raw("PRAGMA foreign_keys = OFF").execute(db);
|
|
6420
6420
|
try {
|
|
6421
6421
|
await createGuestAccessTable(db, UP_TABLE, true);
|
|
@@ -6434,7 +6434,7 @@ async function up$21(db) {
|
|
|
6434
6434
|
}
|
|
6435
6435
|
await assertForeignKeys(db);
|
|
6436
6436
|
}
|
|
6437
|
-
async function down$
|
|
6437
|
+
async function down$22(db) {
|
|
6438
6438
|
await sql.raw("PRAGMA foreign_keys = OFF").execute(db);
|
|
6439
6439
|
try {
|
|
6440
6440
|
await db.schema.dropIndex("idx_restaurant_reservation_offers_location_created").execute();
|
|
@@ -6498,16 +6498,16 @@ async function assertForeignKeys(db) {
|
|
|
6498
6498
|
//#endregion
|
|
6499
6499
|
//#region src/database/migrations/103_restaurant_reservation_guest_details.ts
|
|
6500
6500
|
var _103_restaurant_reservation_guest_details_exports = /* @__PURE__ */ __exportAll({
|
|
6501
|
-
down: () => down$
|
|
6502
|
-
up: () => up$
|
|
6501
|
+
down: () => down$21,
|
|
6502
|
+
up: () => up$21
|
|
6503
6503
|
});
|
|
6504
|
-
async function up$
|
|
6504
|
+
async function up$21(db) {
|
|
6505
6505
|
await db.schema.createTable("restaurant_reservation_guest_settings").addColumn("id", "text", (column) => column.primaryKey()).addColumn("location_id", "text", (column) => column.notNull().unique().references("restaurant_locations.id").onDelete("cascade")).addColumn("login_mode", "text", (column) => column.notNull().check(sql`login_mode in ('guest', 'optional', 'required')`).defaultTo("optional")).addColumn("version", "integer", (column) => column.notNull().defaultTo(1)).addColumn("created_at", "text", (column) => column.notNull().defaultTo(currentTimestamp$1(db))).addColumn("updated_at", "text", (column) => column.notNull().defaultTo(currentTimestamp$1(db))).execute();
|
|
6506
6506
|
await db.schema.createTable("restaurant_reservation_guest_fields").addColumn("id", "text", (column) => column.primaryKey()).addColumn("location_id", "text", (column) => column.notNull().references("restaurant_locations.id").onDelete("cascade")).addColumn("request_key", "text", (column) => column.notNull().unique()).addColumn("field_key", "text", (column) => column.notNull()).addColumn("label", "text", (column) => column.notNull()).addColumn("description", "text").addColumn("input_type", "text", (column) => column.notNull().check(sql`input_type in ('text', 'textarea', 'select', 'checkbox')`)).addColumn("required", "integer", (column) => column.notNull().check(sql`required in (0, 1)`).defaultTo(0)).addColumn("options_json", "text").addColumn("placeholder", "text").addColumn("max_length", "integer", (column) => column.check(sql`max_length is null or max_length between 1 and 2000`)).addColumn("sort_order", "integer", (column) => column.notNull().defaultTo(0)).addColumn("status", "text", (column) => column.notNull().check(sql`status in ('active', 'inactive')`).defaultTo("active")).addColumn("version", "integer", (column) => column.notNull().defaultTo(1)).addColumn("created_at", "text", (column) => column.notNull().defaultTo(currentTimestamp$1(db))).addColumn("updated_at", "text", (column) => column.notNull().defaultTo(currentTimestamp$1(db))).addUniqueConstraint("uq_restaurant_reservation_guest_fields_location_key", ["location_id", "field_key"]).execute();
|
|
6507
6507
|
await db.schema.createTable("restaurant_reservation_guest_field_values").addColumn("id", "text", (column) => column.primaryKey()).addColumn("reservation_id", "text", (column) => column.notNull().references("restaurant_reservations.id").onDelete("cascade")).addColumn("field_id", "text", (column) => column.notNull().references("restaurant_reservation_guest_fields.id").onDelete("restrict")).addColumn("field_key", "text", (column) => column.notNull()).addColumn("field_label", "text", (column) => column.notNull()).addColumn("value_json", "text", (column) => column.notNull()).addColumn("created_at", "text", (column) => column.notNull().defaultTo(currentTimestamp$1(db))).addUniqueConstraint("uq_restaurant_reservation_guest_field_values_reservation_field", ["reservation_id", "field_id"]).execute();
|
|
6508
6508
|
await createIndexes$3(db);
|
|
6509
6509
|
}
|
|
6510
|
-
async function down$
|
|
6510
|
+
async function down$21(db) {
|
|
6511
6511
|
await db.schema.dropTable("restaurant_reservation_guest_field_values").execute();
|
|
6512
6512
|
await db.schema.dropTable("restaurant_reservation_guest_fields").execute();
|
|
6513
6513
|
await db.schema.dropTable("restaurant_reservation_guest_settings").execute();
|
|
@@ -6545,10 +6545,10 @@ async function createIndexes$3(db) {
|
|
|
6545
6545
|
//#endregion
|
|
6546
6546
|
//#region src/database/migrations/104_restaurant_reservation_quote_guest_details.ts
|
|
6547
6547
|
var _104_restaurant_reservation_quote_guest_details_exports = /* @__PURE__ */ __exportAll({
|
|
6548
|
-
down: () => down$
|
|
6549
|
-
up: () => up$
|
|
6548
|
+
down: () => down$20,
|
|
6549
|
+
up: () => up$20
|
|
6550
6550
|
});
|
|
6551
|
-
async function up$
|
|
6551
|
+
async function up$20(db) {
|
|
6552
6552
|
await db.schema.createTable("restaurant_reservation_quote_guest_contexts").addColumn("quote_id", "text", (column) => column.primaryKey().references("restaurant_reservation_quotes.id").onDelete("cascade")).addColumn("location_id", "text", (column) => column.notNull().references("restaurant_locations.id").onDelete("cascade")).addColumn("verified_user_id", "text", (column) => column.references("users.id").onDelete("set null")).addColumn("guest_profile_id", "text", (column) => column.notNull().references("restaurant_guest_profiles.id").onDelete("restrict")).addColumn("created_at", "text", (column) => column.notNull().defaultTo(currentTimestamp$1(db))).execute();
|
|
6553
6553
|
await db.schema.createTable("restaurant_reservation_quote_guest_field_values").addColumn("id", "text", (column) => column.primaryKey()).addColumn("quote_id", "text", (column) => column.notNull().references("restaurant_reservation_quotes.id").onDelete("cascade")).addColumn("field_id", "text", (column) => column.notNull().references("restaurant_reservation_guest_fields.id").onDelete("restrict")).addColumn("field_key", "text", (column) => column.notNull()).addColumn("field_label", "text", (column) => column.notNull()).addColumn("value_json", "text", (column) => column.notNull()).addColumn("created_at", "text", (column) => column.notNull().defaultTo(currentTimestamp$1(db))).addUniqueConstraint("uq_restaurant_reservation_quote_guest_field_values_quote_field", ["quote_id", "field_id"]).execute();
|
|
6554
6554
|
for (const [name, table, columns] of [
|
|
@@ -6579,7 +6579,7 @@ async function up$19(db) {
|
|
|
6579
6579
|
]
|
|
6580
6580
|
]) await db.schema.createIndex(name).on(table).columns([...columns]).execute();
|
|
6581
6581
|
}
|
|
6582
|
-
async function down$
|
|
6582
|
+
async function down$20(db) {
|
|
6583
6583
|
await db.schema.dropTable("restaurant_reservation_quote_guest_field_values").execute();
|
|
6584
6584
|
await db.schema.dropTable("restaurant_reservation_quote_guest_contexts").execute();
|
|
6585
6585
|
}
|
|
@@ -6587,22 +6587,22 @@ async function down$19(db) {
|
|
|
6587
6587
|
//#endregion
|
|
6588
6588
|
//#region src/database/migrations/105_restaurant_reservation_language_settings.ts
|
|
6589
6589
|
var _105_restaurant_reservation_language_settings_exports = /* @__PURE__ */ __exportAll({
|
|
6590
|
-
down: () => down$
|
|
6591
|
-
up: () => up$
|
|
6590
|
+
down: () => down$19,
|
|
6591
|
+
up: () => up$19
|
|
6592
6592
|
});
|
|
6593
|
-
async function up$
|
|
6593
|
+
async function up$19(db) {
|
|
6594
6594
|
await db.schema.createTable("restaurant_reservation_language_settings").addColumn("id", "text", (column) => column.primaryKey()).addColumn("location_id", "text", (column) => column.notNull().unique().references("restaurant_locations.id").onDelete("cascade")).addColumn("default_language", "text", (column) => column.notNull().defaultTo("en")).addColumn("enabled_languages_json", "text", (column) => column.notNull().defaultTo("[\"en\"]")).addColumn("version", "integer", (column) => column.notNull().defaultTo(1)).addColumn("created_at", "text", (column) => column.notNull().defaultTo(currentTimestamp$1(db))).addColumn("updated_at", "text", (column) => column.notNull().defaultTo(currentTimestamp$1(db))).execute();
|
|
6595
6595
|
await db.schema.createIndex("idx_restaurant_reservation_language_settings_location_id").on("restaurant_reservation_language_settings").column("location_id").execute();
|
|
6596
6596
|
}
|
|
6597
|
-
async function down$
|
|
6597
|
+
async function down$19(db) {
|
|
6598
6598
|
await db.schema.dropTable("restaurant_reservation_language_settings").execute();
|
|
6599
6599
|
}
|
|
6600
6600
|
|
|
6601
6601
|
//#endregion
|
|
6602
6602
|
//#region src/database/migrations/106_restaurant_reservation_analytics.ts
|
|
6603
6603
|
var _106_restaurant_reservation_analytics_exports = /* @__PURE__ */ __exportAll({
|
|
6604
|
-
down: () => down$
|
|
6605
|
-
up: () => up$
|
|
6604
|
+
down: () => down$18,
|
|
6605
|
+
up: () => up$18
|
|
6606
6606
|
});
|
|
6607
6607
|
const EVENT_TYPE_CHECK = sql`event_type IN (
|
|
6608
6608
|
'flow_viewed',
|
|
@@ -6616,7 +6616,7 @@ const EVENT_TYPE_CHECK = sql`event_type IN (
|
|
|
6616
6616
|
'priority_alert_subscribed',
|
|
6617
6617
|
'management_viewed'
|
|
6618
6618
|
)`;
|
|
6619
|
-
async function up$
|
|
6619
|
+
async function up$18(db) {
|
|
6620
6620
|
await db.schema.createTable("restaurant_reservation_analytics_settings").addColumn("id", "text", (column) => column.primaryKey()).addColumn("location_id", "text", (column) => column.notNull().unique().references("restaurant_locations.id").onDelete("cascade")).addColumn("enabled", "integer", (column) => column.notNull().defaultTo(0)).addColumn("retention_days", "integer", (column) => column.notNull().defaultTo(90)).addColumn("version", "integer", (column) => column.notNull().defaultTo(1)).addColumn("created_at", "text", (column) => column.notNull().defaultTo(currentTimestamp$1(db))).addColumn("updated_at", "text", (column) => column.notNull().defaultTo(currentTimestamp$1(db))).addCheckConstraint("ck_restaurant_reservation_analytics_settings_enabled", sql`enabled IN (0, 1)`).addCheckConstraint("ck_restaurant_reservation_analytics_settings_retention_days", sql`retention_days BETWEEN 1 AND 365`).execute();
|
|
6621
6621
|
await db.schema.createIndex("idx_restaurant_reservation_analytics_settings_location_id").on("restaurant_reservation_analytics_settings").column("location_id").execute();
|
|
6622
6622
|
await db.schema.createTable("restaurant_reservation_analytics_events").addColumn("id", "text", (column) => column.primaryKey()).addColumn("location_id", "text", (column) => column.notNull().references("restaurant_locations.id").onDelete("cascade")).addColumn("event_type", "text", (column) => column.notNull()).addColumn("occurred_at", "text", (column) => column.notNull().defaultTo(currentTimestamp$1(db))).addCheckConstraint("ck_restaurant_reservation_analytics_events_type", EVENT_TYPE_CHECK).execute();
|
|
@@ -6624,7 +6624,7 @@ async function up$17(db) {
|
|
|
6624
6624
|
await db.schema.createIndex("idx_restaurant_reservation_analytics_events_location_occurred_at").on("restaurant_reservation_analytics_events").columns(["location_id", "occurred_at"]).execute();
|
|
6625
6625
|
await db.schema.createIndex("idx_restaurant_reservation_analytics_events_location_event_type").on("restaurant_reservation_analytics_events").columns(["location_id", "event_type"]).execute();
|
|
6626
6626
|
}
|
|
6627
|
-
async function down$
|
|
6627
|
+
async function down$18(db) {
|
|
6628
6628
|
await db.schema.dropTable("restaurant_reservation_analytics_events").execute();
|
|
6629
6629
|
await db.schema.dropTable("restaurant_reservation_analytics_settings").execute();
|
|
6630
6630
|
}
|
|
@@ -6632,24 +6632,24 @@ async function down$17(db) {
|
|
|
6632
6632
|
//#endregion
|
|
6633
6633
|
//#region src/database/migrations/107_payment_stripe_configuration.ts
|
|
6634
6634
|
var _107_payment_stripe_configuration_exports = /* @__PURE__ */ __exportAll({
|
|
6635
|
-
down: () => down$
|
|
6636
|
-
up: () => up$
|
|
6635
|
+
down: () => down$17,
|
|
6636
|
+
up: () => up$17
|
|
6637
6637
|
});
|
|
6638
|
-
async function up$
|
|
6639
|
-
async function down$
|
|
6638
|
+
async function up$17() {}
|
|
6639
|
+
async function down$17() {}
|
|
6640
6640
|
|
|
6641
6641
|
//#endregion
|
|
6642
6642
|
//#region src/database/migrations/108_venue_foundation.ts
|
|
6643
6643
|
var _108_venue_foundation_exports = /* @__PURE__ */ __exportAll({
|
|
6644
|
-
down: () => down$
|
|
6645
|
-
up: () => up$
|
|
6644
|
+
down: () => down$16,
|
|
6645
|
+
up: () => up$16
|
|
6646
6646
|
});
|
|
6647
6647
|
const RECORD_STATUS = sql`status in ('draft', 'active', 'archived')`;
|
|
6648
6648
|
const SPACE_STATUS = sql`status in ('draft', 'active', 'archived')`;
|
|
6649
6649
|
const BOOKING_MODE = sql`booking_mode in ('enquiry', 'request', 'instant')`;
|
|
6650
6650
|
const ORDER_STATUS = sql`status in ('enquired', 'requested', 'quoted', 'negotiating', 'accepted', 'payment_pending', 'confirmed', 'declined', 'withdrawn', 'expired', 'cancelled', 'completed')`;
|
|
6651
6651
|
const ORDER_HISTORY_TO_STATUS = sql`to_status in ('enquired', 'requested', 'quoted', 'negotiating', 'accepted', 'payment_pending', 'confirmed', 'declined', 'withdrawn', 'expired', 'cancelled', 'completed')`;
|
|
6652
|
-
async function up$
|
|
6652
|
+
async function up$16(db) {
|
|
6653
6653
|
await runStep("inventory tables", () => createInventoryTables(db));
|
|
6654
6654
|
await runStep("policy tables", () => createPolicyTables(db));
|
|
6655
6655
|
await runStep("order tables", () => createOrderTables(db));
|
|
@@ -6818,7 +6818,7 @@ async function createIndexes$2(db) {
|
|
|
6818
6818
|
throw new Error(`Index ${name} failed: ${message}`, { cause: error });
|
|
6819
6819
|
}
|
|
6820
6820
|
}
|
|
6821
|
-
async function down$
|
|
6821
|
+
async function down$16(db) {
|
|
6822
6822
|
await db.schema.dropTable("venue_availability_blocks").execute();
|
|
6823
6823
|
await db.schema.dropTable("venue_availability_rules").execute();
|
|
6824
6824
|
await db.schema.dropTable("venue_booking_holds").execute();
|
|
@@ -6836,10 +6836,10 @@ async function down$15(db) {
|
|
|
6836
6836
|
//#endregion
|
|
6837
6837
|
//#region src/database/migrations/109_venue_commercial_lifecycle.ts
|
|
6838
6838
|
var _109_venue_commercial_lifecycle_exports = /* @__PURE__ */ __exportAll({
|
|
6839
|
-
down: () => down$
|
|
6840
|
-
up: () => up$
|
|
6839
|
+
down: () => down$15,
|
|
6840
|
+
up: () => up$15
|
|
6841
6841
|
});
|
|
6842
|
-
async function up$
|
|
6842
|
+
async function up$15(db) {
|
|
6843
6843
|
await createCancellationTables(db);
|
|
6844
6844
|
await createQuoteTables(db);
|
|
6845
6845
|
await createPaymentTables(db);
|
|
@@ -6960,7 +6960,7 @@ async function createIndexes$1(db) {
|
|
|
6960
6960
|
]
|
|
6961
6961
|
]) await db.schema.createIndex(name).on(table).columns([...columns]).execute();
|
|
6962
6962
|
}
|
|
6963
|
-
async function down$
|
|
6963
|
+
async function down$15(db) {
|
|
6964
6964
|
await db.schema.dropTable("venue_payment_events").execute();
|
|
6965
6965
|
await db.schema.dropTable("venue_refunds").execute();
|
|
6966
6966
|
await db.schema.dropTable("venue_payments").execute();
|
|
@@ -6975,10 +6975,10 @@ async function down$14(db) {
|
|
|
6975
6975
|
//#endregion
|
|
6976
6976
|
//#region src/database/migrations/110_venue_communications_reviews.ts
|
|
6977
6977
|
var _110_venue_communications_reviews_exports = /* @__PURE__ */ __exportAll({
|
|
6978
|
-
down: () => down$
|
|
6979
|
-
up: () => up$
|
|
6978
|
+
down: () => down$14,
|
|
6979
|
+
up: () => up$14
|
|
6980
6980
|
});
|
|
6981
|
-
async function up$
|
|
6981
|
+
async function up$14(db) {
|
|
6982
6982
|
await createConversationTables(db);
|
|
6983
6983
|
await createNotificationTables(db);
|
|
6984
6984
|
await createReviewTables(db);
|
|
@@ -7097,7 +7097,7 @@ async function createIndexes(db) {
|
|
|
7097
7097
|
]
|
|
7098
7098
|
]) await db.schema.createIndex(name).on(table).columns([...columns]).execute();
|
|
7099
7099
|
}
|
|
7100
|
-
async function down$
|
|
7100
|
+
async function down$14(db) {
|
|
7101
7101
|
await db.schema.dropTable("venue_review_responses").execute();
|
|
7102
7102
|
await db.schema.dropTable("venue_reviews").execute();
|
|
7103
7103
|
await db.schema.dropTable("venue_review_invitations").execute();
|
|
@@ -7114,10 +7114,10 @@ async function down$13(db) {
|
|
|
7114
7114
|
var _111_content_release_grants_exports = /* @__PURE__ */ __exportAll({
|
|
7115
7115
|
createReleaseGrantsIndexes: () => createReleaseGrantsIndexes,
|
|
7116
7116
|
createReleaseGrantsTable: () => createReleaseGrantsTable,
|
|
7117
|
-
down: () => down$
|
|
7118
|
-
up: () => up$
|
|
7117
|
+
down: () => down$13,
|
|
7118
|
+
up: () => up$13
|
|
7119
7119
|
});
|
|
7120
|
-
async function up$
|
|
7120
|
+
async function up$13(db) {
|
|
7121
7121
|
await createReleaseGrantsTable(db);
|
|
7122
7122
|
await createReleaseGrantsIndexes(db);
|
|
7123
7123
|
}
|
|
@@ -7149,15 +7149,15 @@ async function createReleaseGrantsIndexes(db) {
|
|
|
7149
7149
|
WHERE status = 'active'
|
|
7150
7150
|
`.execute(db);
|
|
7151
7151
|
}
|
|
7152
|
-
async function down$
|
|
7152
|
+
async function down$13(db) {
|
|
7153
7153
|
await db.schema.dropTable("_dineway_content_release_grants").execute();
|
|
7154
7154
|
}
|
|
7155
7155
|
|
|
7156
7156
|
//#endregion
|
|
7157
7157
|
//#region src/database/migrations/114_assignment_overdue.ts
|
|
7158
7158
|
var _114_assignment_overdue_exports = /* @__PURE__ */ __exportAll({
|
|
7159
|
-
down: () => down$
|
|
7160
|
-
up: () => up$
|
|
7159
|
+
down: () => down$12,
|
|
7160
|
+
up: () => up$12
|
|
7161
7161
|
});
|
|
7162
7162
|
const ACTOR_TYPES = [
|
|
7163
7163
|
"user",
|
|
@@ -7181,7 +7181,7 @@ const PRIORITIES = [
|
|
|
7181
7181
|
"high",
|
|
7182
7182
|
"urgent"
|
|
7183
7183
|
];
|
|
7184
|
-
async function up$
|
|
7184
|
+
async function up$12(db) {
|
|
7185
7185
|
if (isSqlite(db)) {
|
|
7186
7186
|
await rebuildSqliteAssignments(db, true);
|
|
7187
7187
|
return;
|
|
@@ -7193,7 +7193,7 @@ async function up$11(db) {
|
|
|
7193
7193
|
"overdue"
|
|
7194
7194
|
]);
|
|
7195
7195
|
}
|
|
7196
|
-
async function down$
|
|
7196
|
+
async function down$12(db) {
|
|
7197
7197
|
if (isSqlite(db)) {
|
|
7198
7198
|
await rebuildSqliteAssignments(db, false);
|
|
7199
7199
|
return;
|
|
@@ -7318,28 +7318,28 @@ async function replacePostgresStatusConstraint(db, statuses) {
|
|
|
7318
7318
|
//#endregion
|
|
7319
7319
|
//#region src/database/migrations/115_integration_credentials.ts
|
|
7320
7320
|
var _115_integration_credentials_exports = /* @__PURE__ */ __exportAll({
|
|
7321
|
-
down: () => down$
|
|
7322
|
-
up: () => up$
|
|
7321
|
+
down: () => down$11,
|
|
7322
|
+
up: () => up$11
|
|
7323
7323
|
});
|
|
7324
|
-
async function up$
|
|
7324
|
+
async function up$11(db) {
|
|
7325
7325
|
await db.schema.createTable("_dineway_integration_credentials").addColumn("provider", "text", (col) => col.primaryKey()).addColumn("credential_type", "text", (col) => col.notNull()).addColumn("encryption_version", "integer", (col) => col.notNull()).addColumn("key_id", "text", (col) => col.notNull()).addColumn("nonce", "text", (col) => col.notNull()).addColumn("ciphertext", "text", (col) => col.notNull()).addColumn("fingerprint", "text", (col) => col.notNull()).addColumn("source", "text", (col) => col.notNull()).addColumn("created_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).addColumn("updated_at", "text", (col) => col.notNull().defaultTo(currentTimestamp$1(db))).execute();
|
|
7326
7326
|
await db.schema.createIndex("idx_dineway_integration_credentials_updated_at").on("_dineway_integration_credentials").column("updated_at").execute();
|
|
7327
7327
|
}
|
|
7328
|
-
async function down$
|
|
7328
|
+
async function down$11(db) {
|
|
7329
7329
|
await db.schema.dropTable("_dineway_integration_credentials").execute();
|
|
7330
7330
|
}
|
|
7331
7331
|
|
|
7332
7332
|
//#endregion
|
|
7333
7333
|
//#region src/database/migrations/116_repair_fts_sync_triggers.ts
|
|
7334
7334
|
var _116_repair_fts_sync_triggers_exports = /* @__PURE__ */ __exportAll({
|
|
7335
|
-
down: () => down$
|
|
7336
|
-
up: () => up$
|
|
7335
|
+
down: () => down$10,
|
|
7336
|
+
up: () => up$10
|
|
7337
7337
|
});
|
|
7338
7338
|
/**
|
|
7339
7339
|
* Rebuild enabled FTS5 indexes so existing sites receive the corrected
|
|
7340
7340
|
* external-content update and delete triggers before their next content write.
|
|
7341
7341
|
*/
|
|
7342
|
-
async function up$
|
|
7342
|
+
async function up$10(db) {
|
|
7343
7343
|
if (!isSqlite(db)) return;
|
|
7344
7344
|
const collections = await sql`
|
|
7345
7345
|
SELECT id, slug, search_config
|
|
@@ -7427,19 +7427,19 @@ function isSearchEnabled(searchConfig) {
|
|
|
7427
7427
|
return false;
|
|
7428
7428
|
}
|
|
7429
7429
|
}
|
|
7430
|
-
async function down$
|
|
7430
|
+
async function down$10(_db) {}
|
|
7431
7431
|
|
|
7432
7432
|
//#endregion
|
|
7433
7433
|
//#region src/database/migrations/117_content_taxonomy_covering_index.ts
|
|
7434
7434
|
var _117_content_taxonomy_covering_index_exports = /* @__PURE__ */ __exportAll({
|
|
7435
|
-
down: () => down$
|
|
7436
|
-
up: () => up$
|
|
7435
|
+
down: () => down$9,
|
|
7436
|
+
up: () => up$9
|
|
7437
7437
|
});
|
|
7438
7438
|
/**
|
|
7439
7439
|
* Replace the single-column taxonomy reverse index with a covering index for
|
|
7440
7440
|
* term-driven collection queries.
|
|
7441
7441
|
*/
|
|
7442
|
-
async function up$
|
|
7442
|
+
async function up$9(db) {
|
|
7443
7443
|
await db.schema.createIndex("idx_content_taxonomies_term_collection_entry").ifNotExists().on("content_taxonomies").columns([
|
|
7444
7444
|
"taxonomy_id",
|
|
7445
7445
|
"collection",
|
|
@@ -7447,7 +7447,7 @@ async function up$8(db) {
|
|
|
7447
7447
|
]).execute();
|
|
7448
7448
|
await db.schema.dropIndex("idx_content_taxonomies_term").ifExists().execute();
|
|
7449
7449
|
}
|
|
7450
|
-
async function down$
|
|
7450
|
+
async function down$9(db) {
|
|
7451
7451
|
await db.schema.createIndex("idx_content_taxonomies_term").ifNotExists().on("content_taxonomies").column("taxonomy_id").execute();
|
|
7452
7452
|
await db.schema.dropIndex("idx_content_taxonomies_term_collection_entry").ifExists().execute();
|
|
7453
7453
|
}
|
|
@@ -7455,14 +7455,14 @@ async function down$8(db) {
|
|
|
7455
7455
|
//#endregion
|
|
7456
7456
|
//#region src/database/migrations/118_collection_url_field.ts
|
|
7457
7457
|
var _118_collection_url_field_exports = /* @__PURE__ */ __exportAll({
|
|
7458
|
-
down: () => down$
|
|
7459
|
-
up: () => up$
|
|
7458
|
+
down: () => down$8,
|
|
7459
|
+
up: () => up$8
|
|
7460
7460
|
});
|
|
7461
|
-
async function up$
|
|
7461
|
+
async function up$8(db) {
|
|
7462
7462
|
await db.schema.alterTable("_dineway_collections").addColumn("url_field", "text").execute();
|
|
7463
7463
|
await updateIndexes(db, true);
|
|
7464
7464
|
}
|
|
7465
|
-
async function down$
|
|
7465
|
+
async function down$8(db) {
|
|
7466
7466
|
await updateIndexes(db, false);
|
|
7467
7467
|
await db.schema.alterTable("_dineway_collections").dropColumn("url_field").execute();
|
|
7468
7468
|
}
|
|
@@ -7479,41 +7479,41 @@ async function updateIndexes(db, create) {
|
|
|
7479
7479
|
//#endregion
|
|
7480
7480
|
//#region src/database/migrations/119_public_discovery_rules.ts
|
|
7481
7481
|
var _119_public_discovery_rules_exports = /* @__PURE__ */ __exportAll({
|
|
7482
|
-
down: () => down$
|
|
7483
|
-
up: () => up$
|
|
7482
|
+
down: () => down$7,
|
|
7483
|
+
up: () => up$7
|
|
7484
7484
|
});
|
|
7485
|
-
async function up$
|
|
7485
|
+
async function up$7(db) {
|
|
7486
7486
|
await db.schema.alterTable("_dineway_collections").addColumn("public_discovery", "text").execute();
|
|
7487
7487
|
}
|
|
7488
|
-
async function down$
|
|
7488
|
+
async function down$7(db) {
|
|
7489
7489
|
await db.schema.alterTable("_dineway_collections").dropColumn("public_discovery").execute();
|
|
7490
7490
|
}
|
|
7491
7491
|
|
|
7492
7492
|
//#endregion
|
|
7493
7493
|
//#region src/database/migrations/120_payment_subscriptions.ts
|
|
7494
7494
|
var _120_payment_subscriptions_exports = /* @__PURE__ */ __exportAll({
|
|
7495
|
-
down: () => down$
|
|
7496
|
-
up: () => up$
|
|
7495
|
+
down: () => down$6,
|
|
7496
|
+
up: () => up$6
|
|
7497
7497
|
});
|
|
7498
|
-
async function up$
|
|
7499
|
-
async function down$
|
|
7498
|
+
async function up$6() {}
|
|
7499
|
+
async function down$6() {}
|
|
7500
7500
|
|
|
7501
7501
|
//#endregion
|
|
7502
7502
|
//#region src/database/migrations/121_payment_purchases.ts
|
|
7503
7503
|
var _121_payment_purchases_exports = /* @__PURE__ */ __exportAll({
|
|
7504
|
-
down: () => down$
|
|
7505
|
-
up: () => up$
|
|
7504
|
+
down: () => down$5,
|
|
7505
|
+
up: () => up$5
|
|
7506
7506
|
});
|
|
7507
|
-
async function up$
|
|
7508
|
-
async function down$
|
|
7507
|
+
async function up$5() {}
|
|
7508
|
+
async function down$5() {}
|
|
7509
7509
|
|
|
7510
7510
|
//#endregion
|
|
7511
7511
|
//#region src/database/migrations/122_integration_runs.ts
|
|
7512
7512
|
var _122_integration_runs_exports = /* @__PURE__ */ __exportAll({
|
|
7513
|
-
down: () => down$
|
|
7514
|
-
up: () => up$
|
|
7513
|
+
down: () => down$4,
|
|
7514
|
+
up: () => up$4
|
|
7515
7515
|
});
|
|
7516
|
-
async function up$
|
|
7516
|
+
async function up$4(db) {
|
|
7517
7517
|
await db.schema.createTable("_dineway_integration_runs").addColumn("id", "text", (c) => c.primaryKey()).addColumn("actor_id", "text", (c) => c.notNull()).addColumn("idempotency_key", "text").addColumn("request_hash", "text", (c) => c.notNull()).addColumn("request_json", "text", (c) => c.notNull()).addColumn("run_json", "text", (c) => c.notNull()).addColumn("state", "text", (c) => c.notNull()).addColumn("upstream_id", "text").addColumn("credential_fingerprint", "text", (c) => c.notNull()).addColumn("created_at", "text", (c) => c.notNull()).addColumn("updated_at", "text", (c) => c.notNull()).execute();
|
|
7518
7518
|
await db.schema.createIndex("idx_dineway_integration_runs_actor_key").on("_dineway_integration_runs").columns(["actor_id", "idempotency_key"]).unique().execute();
|
|
7519
7519
|
await db.schema.createIndex("idx_dineway_integration_runs_actor_created").on("_dineway_integration_runs").columns([
|
|
@@ -7523,24 +7523,24 @@ async function up$3(db) {
|
|
|
7523
7523
|
]).execute();
|
|
7524
7524
|
await db.schema.createIndex("idx_dineway_integration_runs_state_updated").on("_dineway_integration_runs").columns(["state", "updated_at"]).execute();
|
|
7525
7525
|
}
|
|
7526
|
-
async function down$
|
|
7526
|
+
async function down$4(db) {
|
|
7527
7527
|
await db.schema.dropTable("_dineway_integration_runs").execute();
|
|
7528
7528
|
}
|
|
7529
7529
|
|
|
7530
7530
|
//#endregion
|
|
7531
7531
|
//#region src/database/migrations/123_review_automation.ts
|
|
7532
7532
|
var _123_review_automation_exports = /* @__PURE__ */ __exportAll({
|
|
7533
|
-
down: () => down$
|
|
7534
|
-
up: () => up$
|
|
7533
|
+
down: () => down$3,
|
|
7534
|
+
up: () => up$3
|
|
7535
7535
|
});
|
|
7536
|
-
async function up$
|
|
7536
|
+
async function up$3(db) {
|
|
7537
7537
|
await db.schema.alterTable("_dineway_review_requests").addColumn("revoked_at", "text").execute();
|
|
7538
7538
|
await db.schema.createTable("_dineway_review_jobs").addColumn("review_id", "text", (c) => c.primaryKey().references("_dineway_review_requests.id").onDelete("cascade")).addColumn("target_key", "text", (c) => c.notNull().unique()).addColumn("content_hash", "text", (c) => c.notNull()).addColumn("state", "text", (c) => c.notNull()).addColumn("release_state", "text", (c) => c.notNull()).addColumn("evidence_json", "text").addColumn("reason", "text").addColumn("release_reason", "text").addColumn("scheduled_at", "text").addColumn("created_at", "text", (c) => c.notNull()).addColumn("updated_at", "text", (c) => c.notNull()).execute();
|
|
7539
7539
|
await db.schema.createIndex("idx_dineway_review_jobs_state_updated").on("_dineway_review_jobs").columns(["state", "updated_at"]).execute();
|
|
7540
7540
|
await db.schema.createIndex("idx_dineway_review_jobs_release_updated").on("_dineway_review_jobs").columns(["release_state", "updated_at"]).execute();
|
|
7541
7541
|
await db.schema.createIndex("idx_dineway_review_jobs_content_hash").on("_dineway_review_jobs").column("content_hash").execute();
|
|
7542
7542
|
}
|
|
7543
|
-
async function down$
|
|
7543
|
+
async function down$3(db) {
|
|
7544
7544
|
await db.schema.dropTable("_dineway_review_jobs").execute();
|
|
7545
7545
|
await db.schema.alterTable("_dineway_review_requests").dropColumn("revoked_at").execute();
|
|
7546
7546
|
}
|
|
@@ -7548,8 +7548,8 @@ async function down$2(db) {
|
|
|
7548
7548
|
//#endregion
|
|
7549
7549
|
//#region src/database/migrations/124_review_release_authority.ts
|
|
7550
7550
|
var _124_review_release_authority_exports = /* @__PURE__ */ __exportAll({
|
|
7551
|
-
down: () => down$
|
|
7552
|
-
up: () => up$
|
|
7551
|
+
down: () => down$2,
|
|
7552
|
+
up: () => up$2
|
|
7553
7553
|
});
|
|
7554
7554
|
async function replaceTable(db, automated) {
|
|
7555
7555
|
await createReleaseGrantsTable(db, automated, "_dineway_content_release_grants_next");
|
|
@@ -7558,10 +7558,10 @@ async function replaceTable(db, automated) {
|
|
|
7558
7558
|
await db.schema.alterTable("_dineway_content_release_grants_next").renameTo("_dineway_content_release_grants").execute();
|
|
7559
7559
|
await createReleaseGrantsIndexes(db);
|
|
7560
7560
|
}
|
|
7561
|
-
async function up$
|
|
7561
|
+
async function up$2(db) {
|
|
7562
7562
|
await replaceTable(db, true);
|
|
7563
7563
|
}
|
|
7564
|
-
async function down$
|
|
7564
|
+
async function down$2(db) {
|
|
7565
7565
|
const result = await sql`SELECT count(*) AS count FROM _dineway_content_release_grants WHERE authorization_method = 'review_automation'`.execute(db);
|
|
7566
7566
|
if (Number(result.rows[0]?.count)) throw new Error("Automated release history must be retained; this migration cannot be rolled back after automated publication.");
|
|
7567
7567
|
await replaceTable(db, false);
|
|
@@ -7570,14 +7570,84 @@ async function down$1(db) {
|
|
|
7570
7570
|
//#endregion
|
|
7571
7571
|
//#region src/database/migrations/125_cron_task_leases.ts
|
|
7572
7572
|
var _125_cron_task_leases_exports = /* @__PURE__ */ __exportAll({
|
|
7573
|
+
down: () => down$1,
|
|
7574
|
+
up: () => up$1
|
|
7575
|
+
});
|
|
7576
|
+
async function up$1(db) {
|
|
7577
|
+
await db.schema.alterTable("_dineway_cron_tasks").addColumn("lease_token", "text").execute();
|
|
7578
|
+
}
|
|
7579
|
+
async function down$1(db) {
|
|
7580
|
+
await db.schema.alterTable("_dineway_cron_tasks").dropColumn("lease_token").execute();
|
|
7581
|
+
}
|
|
7582
|
+
|
|
7583
|
+
//#endregion
|
|
7584
|
+
//#region src/database/migrations/126_content_storage.ts
|
|
7585
|
+
var _126_content_storage_exports = /* @__PURE__ */ __exportAll({
|
|
7573
7586
|
down: () => down,
|
|
7574
7587
|
up: () => up
|
|
7575
7588
|
});
|
|
7576
7589
|
async function up(db) {
|
|
7577
|
-
await db.schema.
|
|
7590
|
+
await db.schema.createTable("_dineway_content_write_intents").addColumn("id", "text", (c) => c.primaryKey()).addColumn("collection", "text", (c) => c.notNull()).addColumn("entry_id", "text", (c) => c.notNull()).addColumn("principal_id", "text", (c) => c.notNull()).addColumn("request_digest", "text", (c) => c.notNull()).addColumn("seed", "text", (c) => c.notNull()).addColumn("created_at", "text", (c) => c.notNull()).execute();
|
|
7591
|
+
await db.schema.createIndex("idx_content_write_intents_entry").on("_dineway_content_write_intents").columns(["collection", "entry_id"]).execute();
|
|
7592
|
+
await db.schema.createTable("_dineway_content_changes").addColumn("sequence", "integer", (c) => c.primaryKey().autoIncrement()).addColumn("collection", "text", (c) => c.notNull()).addColumn("entry_id", "text", (c) => c.notNull()).addColumn("source", "text", (c) => c.notNull()).addColumn("action", "text", (c) => c.notNull()).addColumn("changed_at", "text", (c) => c.notNull()).execute();
|
|
7593
|
+
await db.schema.createIndex("idx_content_changes_entry_sequence").on("_dineway_content_changes").columns([
|
|
7594
|
+
"collection",
|
|
7595
|
+
"entry_id",
|
|
7596
|
+
"sequence"
|
|
7597
|
+
]).execute();
|
|
7598
|
+
await db.schema.createTable("_dineway_content_migrations").addColumn("id", "text", (c) => c.primaryKey()).addColumn("collection", "text", (c) => c.notNull()).addColumn("partition", "text", (c) => c.notNull()).addColumn("source_store", "text", (c) => c.notNull()).addColumn("target_store", "text", (c) => c.notNull()).addColumn("routing_version", "text", (c) => c.notNull()).addColumn("state", "text", (c) => c.notNull()).addColumn("manifest_digest", "text").addColumn("verified_count", "integer").addColumn("created_at", "text", (c) => c.notNull()).addColumn("updated_at", "text", (c) => c.notNull()).addColumn("retain_until", "text", (c) => c.notNull()).execute();
|
|
7599
|
+
await db.schema.createTable("_dineway_content_migration_entries").addColumn("migration_id", "text", (c) => c.notNull()).addColumn("entry_id", "text", (c) => c.notNull()).addColumn("source_digest", "text", (c) => c.notNull()).addColumn("archive_key", "text", (c) => c.notNull()).addColumn("target_location", "text", (c) => c.notNull()).addColumn("state", "text", (c) => c.notNull()).addColumn("updated_at", "text", (c) => c.notNull()).addPrimaryKeyConstraint("pk_content_migration_entries", ["migration_id", "entry_id"]).execute();
|
|
7600
|
+
await db.schema.createTable("_dineway_content_partitions").addColumn("collection", "text", (c) => c.notNull()).addColumn("partition", "text", (c) => c.notNull()).addColumn("store", "text", (c) => c.notNull()).addColumn("target_store", "text", (c) => c.notNull()).addColumn("state", "text", (c) => c.notNull()).addColumn("epoch", "integer", (c) => c.notNull()).addColumn("migration_id", "text").addColumn("updated_at", "text", (c) => c.notNull()).addPrimaryKeyConstraint("pk_content_partitions", ["collection", "partition"]).execute();
|
|
7601
|
+
await db.schema.createTable("_dineway_content_storage_config").addColumn("id", "text", (c) => c.primaryKey()).addColumn("version", "text", (c) => c.notNull()).addColumn("digest", "text", (c) => c.notNull()).execute();
|
|
7602
|
+
await db.schema.createTable("_dineway_content_locations").addColumn("collection", "text", (c) => c.notNull()).addColumn("entry_id", "text", (c) => c.notNull()).addColumn("store", "text", (c) => c.notNull()).addColumn("partition", "text", (c) => c.notNull()).addColumn("routing_version", "text", (c) => c.notNull()).addColumn("version", "text", (c) => c.notNull()).addColumn("digest", "text", (c) => c.notNull()).addPrimaryKeyConstraint("pk_content_locations", ["collection", "entry_id"]).execute();
|
|
7603
|
+
await db.schema.createIndex("idx_content_locations_store_partition").on("_dineway_content_locations").columns([
|
|
7604
|
+
"store",
|
|
7605
|
+
"partition",
|
|
7606
|
+
"entry_id"
|
|
7607
|
+
]).execute();
|
|
7608
|
+
await db.schema.createIndex("idx_content_locations_collection_partition").on("_dineway_content_locations").columns([
|
|
7609
|
+
"collection",
|
|
7610
|
+
"partition",
|
|
7611
|
+
"entry_id"
|
|
7612
|
+
]).execute();
|
|
7613
|
+
await db.schema.createIndex("idx_content_migration_entries_state").on("_dineway_content_migration_entries").columns([
|
|
7614
|
+
"migration_id",
|
|
7615
|
+
"state",
|
|
7616
|
+
"entry_id"
|
|
7617
|
+
]).execute();
|
|
7618
|
+
await db.schema.createTable("_dineway_content_operations").addColumn("id", "text", (c) => c.primaryKey()).addColumn("collection", "text", (c) => c.notNull()).addColumn("entry_id", "text", (c) => c.notNull()).addColumn("command", "text", (c) => c.notNull()).addColumn("state", "text", (c) => c.notNull()).addColumn("created_at", "text", (c) => c.notNull()).addColumn("updated_at", "text", (c) => c.notNull()).execute();
|
|
7619
|
+
await db.schema.createIndex("idx_content_operations_entry").on("_dineway_content_operations").columns([
|
|
7620
|
+
"collection",
|
|
7621
|
+
"entry_id",
|
|
7622
|
+
"created_at"
|
|
7623
|
+
]).execute();
|
|
7624
|
+
await db.schema.createIndex("idx_content_operations_state").on("_dineway_content_operations").columns(["state", "updated_at"]).execute();
|
|
7625
|
+
await db.schema.createTable("_dineway_content_commit_events").addColumn("sequence", "integer", (c) => c.primaryKey().autoIncrement()).addColumn("operation_id", "text", (c) => c.notNull().unique()).addColumn("collection", "text", (c) => c.notNull()).addColumn("entry_id", "text", (c) => c.notNull()).addColumn("command", "text", (c) => c.notNull()).addColumn("created_at", "text", (c) => c.notNull()).addColumn("delivered_at", "text").addColumn("payload_digest", "text").addColumn("part_count", "integer", (c) => c.notNull().defaultTo(0)).execute();
|
|
7626
|
+
await db.schema.createIndex("idx_content_commit_events_entry_sequence").on("_dineway_content_commit_events").columns([
|
|
7627
|
+
"collection",
|
|
7628
|
+
"entry_id",
|
|
7629
|
+
"sequence"
|
|
7630
|
+
]).execute();
|
|
7631
|
+
await db.schema.createTable("_dineway_content_event_payloads").addColumn("operation_id", "text", (c) => c.notNull()).addColumn("part", "integer", (c) => c.notNull()).addColumn("data", "text", (c) => c.notNull()).addPrimaryKeyConstraint("pk_content_event_payloads", ["operation_id", "part"]).execute();
|
|
7632
|
+
await db.schema.createTable("_dineway_content_hook_deliveries").addColumn("id", "text", (c) => c.primaryKey()).addColumn("operation_id", "text", (c) => c.notNull()).addColumn("hook", "text", (c) => c.notNull()).addColumn("plugin_id", "text", (c) => c.notNull()).addColumn("ordinal", "integer", (c) => c.notNull()).addColumn("timeout_ms", "integer", (c) => c.notNull()).addColumn("attempts", "integer", (c) => c.notNull()).addColumn("next_attempt_at", "text", (c) => c.notNull()).addColumn("lease_owner", "text").addColumn("lease_until", "text").addColumn("created_at", "text", (c) => c.notNull()).addColumn("delivered_at", "text").addColumn("last_error", "text").execute();
|
|
7633
|
+
await db.schema.createIndex("idx_content_hook_deliveries_due").on("_dineway_content_hook_deliveries").columns(["delivered_at", "next_attempt_at"]).execute();
|
|
7634
|
+
await db.schema.createIndex("idx_content_hook_deliveries_operation").on("_dineway_content_hook_deliveries").columns(["operation_id", "ordinal"]).execute();
|
|
7635
|
+
await db.schema.createIndex("idx_content_commit_events_delivery").on("_dineway_content_commit_events").columns(["delivered_at", "created_at"]).execute();
|
|
7578
7636
|
}
|
|
7579
7637
|
async function down(db) {
|
|
7580
|
-
|
|
7638
|
+
for (const table of [
|
|
7639
|
+
"_dineway_content_hook_deliveries",
|
|
7640
|
+
"_dineway_content_event_payloads",
|
|
7641
|
+
"_dineway_content_write_intents",
|
|
7642
|
+
"_dineway_content_changes",
|
|
7643
|
+
"_dineway_content_commit_events",
|
|
7644
|
+
"_dineway_content_operations",
|
|
7645
|
+
"_dineway_content_locations",
|
|
7646
|
+
"_dineway_content_storage_config",
|
|
7647
|
+
"_dineway_content_partitions",
|
|
7648
|
+
"_dineway_content_migration_entries",
|
|
7649
|
+
"_dineway_content_migrations"
|
|
7650
|
+
]) await db.schema.dropTable(table).execute();
|
|
7581
7651
|
}
|
|
7582
7652
|
|
|
7583
7653
|
//#endregion
|
|
@@ -7704,7 +7774,8 @@ const MIGRATIONS = Object.freeze({
|
|
|
7704
7774
|
"122_integration_runs": _122_integration_runs_exports,
|
|
7705
7775
|
"123_review_automation": _123_review_automation_exports,
|
|
7706
7776
|
"124_review_release_authority": _124_review_release_authority_exports,
|
|
7707
|
-
"125_cron_task_leases": _125_cron_task_leases_exports
|
|
7777
|
+
"125_cron_task_leases": _125_cron_task_leases_exports,
|
|
7778
|
+
"126_content_storage": _126_content_storage_exports
|
|
7708
7779
|
});
|
|
7709
7780
|
const MIGRATION_NAMES = Object.freeze(Object.keys(MIGRATIONS).toSorted());
|
|
7710
7781
|
/** Total number of registered migrations. Exported for use in tests. */
|