dineway 0.1.44 → 0.1.46
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-events-CpcTzKpF.mjs → activity-events-CNk3clTT.mjs} +1 -1
- package/dist/{allowed-origins-3RuuoFjC.mjs → allowed-origins-DhipQNLb.mjs} +1 -1
- package/dist/api/route-utils.d.mts +9 -10
- package/dist/api/route-utils.mjs +13 -13
- package/dist/api/schemas/index.d.mts +2 -2
- package/dist/api/schemas/index.mjs +4 -4
- package/dist/{api-x5yKhnAw.mjs → api-Bmfii2mH.mjs} +101 -56
- package/dist/{api-tokens-BFg7tiOQ.mjs → api-tokens-DtvdtIkm.mjs} +1 -1
- package/dist/{apply-TIoQ00aH.mjs → apply-BpRBCqUt.mjs} +76 -31
- package/dist/astro/index.d.mts +10 -11
- package/dist/astro/index.mjs +23 -3
- package/dist/astro/middleware/auth.d.mts +9 -10
- package/dist/astro/middleware/auth.mjs +5 -5
- package/dist/astro/middleware/redirect.mjs +13 -7
- package/dist/astro/middleware/request-context.mjs +3 -3
- 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.mjs +120 -82
- package/dist/astro/routes/api/admin/allowed-domains/_domain_.mjs +5 -5
- package/dist/astro/routes/api/admin/allowed-domains/index.mjs +5 -5
- package/dist/astro/routes/api/admin/api-tokens/_id_.mjs +4 -4
- package/dist/astro/routes/api/admin/api-tokens/index.mjs +6 -6
- package/dist/astro/routes/api/admin/briefing.mjs +17 -17
- package/dist/astro/routes/api/admin/byline-fields/_slug_/usage.d.mts +7 -0
- package/dist/astro/routes/api/admin/byline-fields/_slug_/usage.mjs +17 -0
- package/dist/astro/routes/api/admin/byline-fields/_slug_.d.mts +9 -0
- package/dist/astro/routes/api/admin/byline-fields/_slug_.mjs +38 -0
- package/dist/astro/routes/api/admin/byline-fields/index.d.mts +8 -0
- package/dist/astro/routes/api/admin/byline-fields/index.mjs +31 -0
- package/dist/astro/routes/api/admin/byline-fields/reorder.d.mts +7 -0
- package/dist/astro/routes/api/admin/byline-fields/reorder.mjs +24 -0
- package/dist/astro/routes/api/admin/bylines/_id_/index.mjs +27 -27
- package/dist/astro/routes/api/admin/bylines/_id_/translations.d.mts +8 -0
- package/dist/astro/routes/api/admin/bylines/_id_/translations.mjs +57 -0
- package/dist/astro/routes/api/admin/bylines/index.mjs +30 -26
- package/dist/astro/routes/api/admin/comments/_id_/status.mjs +11 -11
- package/dist/astro/routes/api/admin/comments/_id_.mjs +5 -5
- package/dist/astro/routes/api/admin/comments/bulk.mjs +9 -9
- package/dist/astro/routes/api/admin/comments/counts.mjs +5 -5
- package/dist/astro/routes/api/admin/comments/index.mjs +9 -9
- package/dist/astro/routes/api/admin/context/_id_/history.mjs +23 -23
- package/dist/astro/routes/api/admin/context/_id_/index.mjs +23 -23
- package/dist/astro/routes/api/admin/context/_id_/review.mjs +27 -27
- package/dist/astro/routes/api/admin/context/_id_/supersede.mjs +27 -27
- package/dist/astro/routes/api/admin/context/diff.mjs +26 -26
- package/dist/astro/routes/api/admin/context/index.mjs +27 -27
- package/dist/astro/routes/api/admin/context/stale.mjs +26 -26
- package/dist/astro/routes/api/admin/hitl-requests/_id_/index.mjs +23 -23
- package/dist/astro/routes/api/admin/hitl-requests/_id_/resolve.mjs +26 -26
- package/dist/astro/routes/api/admin/hitl-requests/index.mjs +26 -26
- package/dist/astro/routes/api/admin/hooks/exclusive/_hookName_.mjs +24 -24
- package/dist/astro/routes/api/admin/hooks/exclusive/index.mjs +2 -2
- package/dist/astro/routes/api/admin/oauth-clients/_id_.mjs +6 -6
- package/dist/astro/routes/api/admin/oauth-clients/index.mjs +6 -6
- package/dist/astro/routes/api/admin/plugins/_id_/disable.mjs +48 -44
- package/dist/astro/routes/api/admin/plugins/_id_/enable.mjs +48 -44
- package/dist/astro/routes/api/admin/plugins/_id_/index.mjs +42 -38
- package/dist/astro/routes/api/admin/plugins/_id_/uninstall.mjs +47 -43
- package/dist/astro/routes/api/admin/plugins/_id_/update.mjs +47 -43
- package/dist/astro/routes/api/admin/plugins/index.mjs +42 -38
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/icon.mjs +2 -2
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/index.mjs +42 -38
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/install.mjs +47 -43
- package/dist/astro/routes/api/admin/plugins/marketplace/index.mjs +42 -38
- package/dist/astro/routes/api/admin/plugins/updates.mjs +42 -38
- package/dist/astro/routes/api/admin/review-requests/_id_/index.mjs +5 -5
- package/dist/astro/routes/api/admin/review-requests/_id_/resolve.mjs +26 -26
- package/dist/astro/routes/api/admin/review-requests/index.mjs +9 -9
- package/dist/astro/routes/api/admin/themes/marketplace/_id_/index.mjs +42 -38
- package/dist/astro/routes/api/admin/themes/marketplace/_id_/thumbnail.mjs +2 -2
- package/dist/astro/routes/api/admin/themes/marketplace/index.mjs +42 -38
- 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 +5 -5
- package/dist/astro/routes/api/admin/users/_id_/send-recovery.mjs +2 -2
- package/dist/astro/routes/api/admin/users/index.mjs +5 -5
- package/dist/astro/routes/api/auth/dev-bypass.mjs +5 -5
- package/dist/astro/routes/api/auth/invite/accept.mjs +1 -1
- package/dist/astro/routes/api/auth/invite/complete.mjs +9 -9
- package/dist/astro/routes/api/auth/invite/index.mjs +6 -6
- package/dist/astro/routes/api/auth/invite/register-options.mjs +8 -8
- package/dist/astro/routes/api/auth/logout.mjs +2 -2
- package/dist/astro/routes/api/auth/magic-link/send.mjs +8 -8
- package/dist/astro/routes/api/auth/magic-link/verify.mjs +2 -2
- package/dist/astro/routes/api/auth/me.mjs +20 -11
- package/dist/astro/routes/api/auth/mode.mjs +1 -1
- package/dist/astro/routes/api/auth/oauth/_provider_/callback.mjs +2 -2
- package/dist/astro/routes/api/auth/oauth/_provider_.mjs +2 -2
- package/dist/astro/routes/api/auth/passkey/_id_.mjs +5 -5
- package/dist/astro/routes/api/auth/passkey/index.mjs +1 -1
- package/dist/astro/routes/api/auth/passkey/options.mjs +10 -10
- package/dist/astro/routes/api/auth/passkey/register/options.mjs +8 -8
- package/dist/astro/routes/api/auth/passkey/register/verify.mjs +9 -9
- package/dist/astro/routes/api/auth/passkey/verify.mjs +9 -9
- package/dist/astro/routes/api/auth/setup-token/index.mjs +5 -5
- package/dist/astro/routes/api/auth/setup-token/verify.mjs +2 -2
- package/dist/astro/routes/api/auth/signup/complete.mjs +9 -9
- package/dist/astro/routes/api/auth/signup/request.mjs +8 -8
- package/dist/astro/routes/api/auth/signup/verify.mjs +1 -1
- package/dist/astro/routes/api/comments/_collection_/_contentId_/index.mjs +12 -12
- package/dist/astro/routes/api/content/_collection_/_id_/compare.mjs +2 -2
- package/dist/astro/routes/api/content/_collection_/_id_/discard-draft.mjs +5 -5
- package/dist/astro/routes/api/content/_collection_/_id_/duplicate.mjs +5 -5
- package/dist/astro/routes/api/content/_collection_/_id_/permanent.mjs +5 -5
- package/dist/astro/routes/api/content/_collection_/_id_/preview-url.mjs +11 -11
- package/dist/astro/routes/api/content/_collection_/_id_/publish.mjs +9 -9
- package/dist/astro/routes/api/content/_collection_/_id_/restore.mjs +5 -5
- package/dist/astro/routes/api/content/_collection_/_id_/revisions.mjs +2 -2
- package/dist/astro/routes/api/content/_collection_/_id_/schedule.mjs +9 -9
- package/dist/astro/routes/api/content/_collection_/_id_/terms/_taxonomy_.mjs +20 -14
- package/dist/astro/routes/api/content/_collection_/_id_/translations.mjs +2 -2
- package/dist/astro/routes/api/content/_collection_/_id_/unpublish.mjs +5 -5
- package/dist/astro/routes/api/content/_collection_/_id_.mjs +12 -10
- package/dist/astro/routes/api/content/_collection_/index.mjs +9 -9
- package/dist/astro/routes/api/content/_collection_/trash.mjs +6 -6
- package/dist/astro/routes/api/dashboard.mjs +8 -8
- 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 +10 -10
- package/dist/astro/routes/api/import/wordpress/analyze.mjs +7 -7
- package/dist/astro/routes/api/import/wordpress/execute.mjs +29 -28
- package/dist/astro/routes/api/import/wordpress/media.mjs +10 -10
- package/dist/astro/routes/api/import/wordpress/prepare.mjs +31 -31
- package/dist/astro/routes/api/import/wordpress/rewrite-url-helpers.d.mts +5 -1
- package/dist/astro/routes/api/import/wordpress/rewrite-url-helpers.mjs +16 -1
- package/dist/astro/routes/api/import/wordpress/rewrite-urls.mjs +30 -30
- package/dist/astro/routes/api/import/wordpress-plugin/analyze.d.mts +1 -1
- package/dist/astro/routes/api/import/wordpress-plugin/analyze.mjs +13 -13
- package/dist/astro/routes/api/import/wordpress-plugin/execute.d.mts +1 -1
- package/dist/astro/routes/api/import/wordpress-plugin/execute.mjs +31 -30
- package/dist/astro/routes/api/manifest.mjs +4 -4
- package/dist/astro/routes/api/mcp.mjs +75 -50
- package/dist/astro/routes/api/media/_id_/confirm.mjs +8 -8
- package/dist/astro/routes/api/media/_id_.mjs +6 -6
- 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 +10 -10
- package/dist/astro/routes/api/media.mjs +14 -13
- package/dist/astro/routes/api/menus/_name_/items/_id_.mjs +27 -27
- package/dist/astro/routes/api/menus/_name_/items.mjs +27 -27
- package/dist/astro/routes/api/menus/_name_/reorder.mjs +27 -27
- package/dist/astro/routes/api/menus/_name_/translations.mjs +27 -27
- package/dist/astro/routes/api/menus/_name_.mjs +27 -27
- package/dist/astro/routes/api/menus/index.mjs +27 -27
- package/dist/astro/routes/api/oauth/authorize.mjs +7 -7
- package/dist/astro/routes/api/oauth/device/authorize.mjs +6 -6
- 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 +6 -6
- package/dist/astro/routes/api/oauth/token/revoke.mjs +6 -6
- package/dist/astro/routes/api/oauth/token.mjs +6 -6
- package/dist/astro/routes/api/openapi.json.mjs +10 -7
- package/dist/astro/routes/api/plugins/_pluginId_/_...path_.mjs +3 -3
- package/dist/astro/routes/api/redirects/404s/index.mjs +10 -10
- package/dist/astro/routes/api/redirects/404s/summary.mjs +10 -10
- package/dist/astro/routes/api/redirects/_id_.mjs +28 -28
- package/dist/astro/routes/api/redirects/index.mjs +28 -28
- 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 +43 -39
- package/dist/astro/routes/api/schema/collections/_slug_/fields/index.mjs +43 -39
- package/dist/astro/routes/api/schema/collections/_slug_/fields/reorder.mjs +43 -39
- package/dist/astro/routes/api/schema/collections/_slug_/index.mjs +43 -39
- package/dist/astro/routes/api/schema/collections/index.mjs +43 -39
- package/dist/astro/routes/api/schema/index.mjs +7 -7
- package/dist/astro/routes/api/schema/orphans/_slug_.mjs +42 -38
- package/dist/astro/routes/api/schema/orphans/index.mjs +42 -38
- package/dist/astro/routes/api/search/enable.mjs +11 -11
- package/dist/astro/routes/api/search/index.mjs +10 -10
- package/dist/astro/routes/api/search/rebuild.mjs +11 -11
- package/dist/astro/routes/api/search/stats.mjs +7 -7
- package/dist/astro/routes/api/search/suggest.mjs +10 -10
- package/dist/astro/routes/api/sections/_slug_.mjs +27 -27
- package/dist/astro/routes/api/sections/index.mjs +27 -27
- package/dist/astro/routes/api/settings/email.mjs +3 -3
- package/dist/astro/routes/api/settings.mjs +27 -27
- package/dist/astro/routes/api/setup/admin-verify.mjs +11 -11
- package/dist/astro/routes/api/setup/admin.mjs +9 -9
- package/dist/astro/routes/api/setup/dev-bypass.mjs +24 -23
- package/dist/astro/routes/api/setup/dev-reset.mjs +1 -1
- package/dist/astro/routes/api/setup/index.mjs +25 -24
- package/dist/astro/routes/api/setup/status.mjs +3 -3
- package/dist/astro/routes/api/snapshot.mjs +7 -6
- package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_/translations.mjs +30 -29
- package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_.mjs +30 -29
- package/dist/astro/routes/api/taxonomies/_name_/terms/index.mjs +30 -29
- package/dist/astro/routes/api/taxonomies/index.mjs +30 -29
- package/dist/astro/routes/api/themes/preview.mjs +4 -4
- package/dist/astro/routes/api/typegen.mjs +4 -4
- package/dist/astro/routes/api/well-known/auth.mjs +2 -2
- 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 +26 -26
- package/dist/astro/routes/api/widget-areas/_name_/widgets/_id_.mjs +27 -27
- package/dist/astro/routes/api/widget-areas/_name_/widgets.mjs +27 -27
- package/dist/astro/routes/api/widget-areas/_name_.mjs +25 -25
- package/dist/astro/routes/api/widget-areas/index.mjs +27 -27
- package/dist/astro/routes/api/widget-components.mjs +2 -2
- package/dist/astro/routes/robots.txt.mjs +7 -7
- package/dist/astro/routes/sitemap-_collection_.xml.mjs +59 -15
- package/dist/astro/routes/sitemap.xml.mjs +8 -8
- package/dist/astro/session-driver.d.mts +1 -1
- package/dist/astro/session-driver.mjs +3 -3
- package/dist/astro/types.d.mts +16 -14
- package/dist/{audit-NgiRzqP9.mjs → audit-DuRbTm8L.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-1FHtkDP6.mjs → auth-control-guard-Dr14I98m.mjs} +1 -1
- package/dist/{authorize-BbIhZi3a.mjs → authorize-BLO0m7fW.mjs} +1 -1
- package/dist/{briefing-Jsxs587i.mjs → briefing-BFEWeJtR.mjs} +6 -6
- package/dist/{briefing-DD82WaEy.mjs → briefing-C4fJSVYW.mjs} +1 -1
- package/dist/byline-CXQcMsBu.mjs +628 -0
- package/dist/{bylines-DaXfz8wy.d.mts → byline-fields-CaF_xfpj.d.mts} +159 -28
- package/dist/{import-Br7aP9yh.mjs → byline-fields-D7TJ_oHF.mjs} +57 -3
- package/dist/byline-fields-Dc7L6Yry.mjs +113 -0
- package/dist/byline-registry-CL8BxPPp.mjs +287 -0
- package/dist/bylines-BgriNlW7.mjs +165 -0
- package/dist/bylines-D2vqm1aZ.mjs +163 -0
- package/dist/{cache-DQyZ-QaB.mjs → cache-GRK71jOU.mjs} +2 -2
- package/dist/{chunks-D8KL0nCY.mjs → chunks-DgEw12Bc.mjs} +1 -1
- package/dist/cli/index.mjs +958 -89
- package/dist/client/external-auth-headers.d.mts +1 -1
- package/dist/client/index.d.mts +2 -1
- package/dist/client/index.mjs +5 -2
- package/dist/{comment-BmJXz3lc.mjs → comment-ogMaF1gk.mjs} +1 -1
- package/dist/{comments-yTbeIYc2.mjs → comments-CTSOKrZq.mjs} +1 -1
- package/dist/{connection-BCNICDWN.mjs → connection-CiJWiWya.mjs} +44 -13
- package/dist/{content-DvpMad_N.mjs → content-BfyjOiMi.mjs} +24 -4
- package/dist/content-index-names-Bbu1FY1r.mjs +26 -0
- package/dist/{context-cudavuns.mjs → context-DRhmPCiE.mjs} +2 -2
- package/dist/{context-Ufrm1lOv.mjs → context-ZMHhwzkG.mjs} +8 -8
- package/dist/{context-route-helpers--PJWR-5R.mjs → context-route-helpers-YLWx2N1j.mjs} +1 -1
- package/dist/{dashboard-BC9bgPOH.mjs → dashboard-D0gWuzNp.mjs} +4 -4
- package/dist/db/index.d.mts +3 -3
- package/dist/db/index.mjs +2 -2
- package/dist/db/libsql.d.mts +1 -1
- package/dist/db/libsql.mjs +1 -1
- package/dist/db/postgres.d.mts +1 -1
- package/dist/db/sqlite.d.mts +1 -1
- package/dist/db/sqlite.mjs +1 -1
- package/dist/{device-flow-CTS91g4A.mjs → device-flow-BL5ZRlc1.mjs} +4 -4
- package/dist/{dialect-helpers-TkdbkFad.mjs → dialect-helpers-fk43GbDb.mjs} +13 -3
- package/dist/{fts-manager-DnfOsF4s.mjs → fts-manager-EHY2Kes9.mjs} +2 -2
- package/dist/{hitl-requests-Us2A4Vj5.mjs → hitl-requests-B4Hkt0TO.mjs} +2 -2
- package/dist/{hitl-route-helpers-DcPySbZ3.mjs → hitl-route-helpers-CHjdfQ0s.mjs} +4 -4
- package/dist/{import-DSXK3aQF.mjs → import-CvHY6sf5.mjs} +3 -3
- package/dist/{index-BwOO3vu2.d.mts → index-DJVaYiUV.d.mts} +2 -2
- package/dist/index.d.mts +16 -17
- package/dist/index.mjs +69 -65
- package/dist/{jsonld-CLbYsYYH.d.mts → jsonld-AcPnCEGD.d.mts} +2 -2
- package/dist/{load-BCCcmoW9.mjs → load-BdbvtoDb.mjs} +1 -1
- package/dist/{loader-p2imNN98.mjs → loader-Y0QvC_QO.mjs} +167 -61
- package/dist/media/index.d.mts +1 -2
- package/dist/media/index.mjs +2 -2
- package/dist/media/local-runtime.d.mts +11 -12
- package/dist/media/local-runtime.mjs +2 -2
- package/dist/{media-Cg4zc9fq.mjs → media-DhBwiCYR.mjs} +6 -1
- package/dist/{media-allowlist-D8gsm8_t.mjs → media-allowlist-BsXkT9RK.mjs} +1 -1
- package/dist/{menus-DOaL6NaF.mjs → menus-BzGQpw9d.mjs} +2 -2
- package/dist/{menus-DzG3-9tQ.mjs → menus-fqqzXyHd.mjs} +5 -5
- package/dist/{oauth-authorization-DyOFXQWq.mjs → oauth-authorization-Dk3_LOfj.mjs} +4 -4
- package/dist/{oauth-clients-BMs_bmoz.mjs → oauth-clients-CzeMGyUU.mjs} +2 -2
- package/dist/page/index.d.mts +2 -2
- package/dist/page/index.mjs +1 -1
- package/dist/{parse-D7Tu6ku4.mjs → parse-CneSgl7-.mjs} +1 -1
- package/dist/{types-cn-fvYQ1.d.mts → placeholder-CXfoCtCd.d.mts} +38 -1
- package/dist/plugin-utils.d.mts +22 -10
- package/dist/plugin-utils.mjs +8 -10
- package/dist/plugins/adapt-sandbox-entry.d.mts +9 -10
- package/dist/plugins/adapt-sandbox-entry.mjs +1 -1
- package/dist/{plugins-DCDVDF4B.mjs → plugins-BQ5Joz6v.mjs} +36 -6
- package/dist/{preview-BhgxNRWI.mjs → preview-D5rvDhRt.mjs} +7 -7
- package/dist/{provider-loader-B19YyyBp.d.mts → provider-loader-B5PMjpN7.d.mts} +1 -1
- package/dist/{query-BnRpB09I.mjs → query-BJuUydtD.mjs} +3 -3
- package/dist/{query-DHvNhBhi.mjs → query-CSx0EdSW.mjs} +30 -18
- package/dist/{rate-limit-BWP_kKiZ.mjs → rate-limit-i0G3IAOX.mjs} +2 -2
- package/dist/{redirect-BaVvo2te.mjs → redirect-BqFMj67n.mjs} +20 -6
- package/dist/{redirects-Ba-lJA5j.mjs → redirects-CJwHl_YG.mjs} +3 -3
- package/dist/{redirects-x5ol_Qj9.mjs → redirects-q_cToaHv.mjs} +29 -8
- package/dist/{registry-i__XP2WV.mjs → registry-Cq3QRBW2.mjs} +14 -5
- package/dist/{request-cache-BpwuE2ix.mjs → request-cache-w5cj5itT.mjs} +9 -1
- package/dist/{request-meta-DUGfAeXy.mjs → request-meta-DAb6xaP9.mjs} +1 -1
- package/dist/resolve-DTuDyYKs.mjs +100 -0
- package/dist/{review-requests-DuIxM4YM.mjs → review-requests-GYqjl2jO.mjs} +1 -1
- package/dist/{review-requests-CTUU_RJm.mjs → review-requests-tPw8_pAO.mjs} +1 -1
- package/dist/{runner-FhUNNaqA.d.mts → runner-Cnz4dl0f.d.mts} +1 -1
- package/dist/{runner-DF2DgD_B.mjs → runner-DTfG5v0G.mjs} +574 -196
- package/dist/{runtime-C4ZgKk6r.d.mts → runtime-Cd-kjPfN.d.mts} +1156 -274
- package/dist/runtime.d.mts +10 -11
- package/dist/runtime.mjs +4 -4
- package/dist/schema-DmHMWnSA.mjs +8 -0
- package/dist/{search-Cl9preJT.mjs → search-BAiFLz81.mjs} +3 -3
- package/dist/{sections-Zx-2q9IH.mjs → sections-DsuIrFDC.mjs} +2 -2
- package/dist/seed/index.d.mts +2 -2
- package/dist/seed/index.mjs +18 -17
- package/dist/seo/index.d.mts +1 -1
- package/dist/seo/index.mjs +1 -0
- package/dist/{seo-CJBiMDkj.mjs → seo-5lJOtB5J.mjs} +4 -2
- package/dist/{seo-BPb_reaG.mjs → seo-uMFBaR8G.mjs} +1 -1
- package/dist/{service-wPGgmbUa.mjs → service-CifrxCru.mjs} +2 -2
- package/dist/{settings-nr15a8uv.mjs → settings-BYGdocdj.mjs} +2 -2
- package/dist/{settings-DORe02PC.mjs → settings-DNRQuX3d.mjs} +3 -3
- package/dist/{site-activity-KFZprBZM.mjs → site-activity-6x1JccoR.mjs} +1 -1
- package/dist/{site-context-DuBQk6Mp.mjs → site-context-sN12ehZF.mjs} +13 -13
- 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 +1 -1
- package/dist/{taxonomies-DGaw_-aU.mjs → taxonomies-CQFmkP5u.mjs} +3 -3
- package/dist/{taxonomies-BVBKoXRf.mjs → taxonomies-faQVeMgj.mjs} +7 -32
- package/dist/{taxonomy-BvXRL85P.mjs → taxonomy-BnH-6VsX.mjs} +2 -2
- package/dist/{types-DvwHUku7.d.mts → types-B7_vSiPD.d.mts} +16 -0
- package/dist/{types-D1DjBFA9.mjs → types-Ck7-WoUD.mjs} +1 -1
- package/dist/{types-t7_nCCA9.d.mts → types-DEAQG87T.d.mts} +2 -56
- package/dist/{types-C-CMfzSl.d.mts → types-DYKtk8f1.d.mts} +31 -0
- package/dist/{types-C3Em8xpG.mjs → types-DbZhHtqS.mjs} +23 -1
- package/dist/{types-BIM7jwxr.d.mts → types-UGmU5sWx.d.mts} +1 -1
- package/dist/types-nP9vGUFq.d.mts +56 -0
- package/dist/ui/server-runtime.d.mts +13 -7
- package/dist/ui/server-runtime.mjs +18 -17
- package/dist/{user-2aI21yV1.mjs → user-CqZwN21P.mjs} +1 -1
- package/dist/{validate-CvQ6cvHH.d.mts → validate-BJuG-ISL.d.mts} +21 -3
- package/dist/{validate-JE-WfUQ5.mjs → validate-CK4a1sIF.mjs} +22 -2
- package/dist/version-Cg6ur4zS.mjs +6 -0
- package/dist/{widgets-Cj6ULpED.mjs → widgets-CdDvF4fV.mjs} +2 -2
- package/dist/{wordpress-slugs-hqItqJrQ.mjs → wordpress-slugs-B6Gw9q3Q.mjs} +1 -1
- package/dist/{zod-generator-C4BgFBZV.mjs → zod-generator-D1ROBNuC.mjs} +2 -2
- package/package.json +7 -8
- package/src/components/InlinePortableTextEditor.tsx +66 -0
- package/src/components/code-block-languages.ts +76 -0
- package/src/components/inline-code-block.tsx +241 -0
- package/dist/byline-DpNNSjET.mjs +0 -219
- package/dist/bylines-75_STR73.mjs +0 -114
- package/dist/chunk-ClPoSABd.mjs +0 -21
- package/dist/db-errors-DHJCB_gY.mjs +0 -23
- package/dist/index-Ct0pjZwW.d.mts +0 -835
- package/dist/placeholder-BZpCpid_.d.mts +0 -40
- package/dist/schema-U-SeFWwn.mjs +0 -8
- package/dist/version-PioVgJAl.mjs +0 -6
- /package/dist/{adapters-kZjS7plb.d.mts → adapters-OQCImOL7.d.mts} +0 -0
- /package/dist/{api-tokens-L0o9Bd7v.mjs → api-tokens-CYUoFGo7.mjs} +0 -0
- /package/dist/{challenge-store-cJam-E5R.mjs → challenge-store-CRSz-Xim.mjs} +0 -0
- /package/dist/{components-BJfa-F6n.mjs → components--pg6zBvu.mjs} +0 -0
- /package/dist/{config-XW5tMrH8.mjs → config-CVssduLe.mjs} +0 -0
- /package/dist/{context-types-BrSQNye5.mjs → context-types-DQh_XKkn.mjs} +0 -0
- /package/dist/{cron-D7FDsRu-.mjs → cron-DxCAU_Sn.mjs} +0 -0
- /package/dist/{default-5A3XVR7L.mjs → default-BHauvIdG.mjs} +0 -0
- /package/dist/{email-console-Bs1qKx59.mjs → email-console-BOVqIYpB.mjs} +0 -0
- /package/dist/{error-DLkgOP5m.mjs → error-DCSuUAZW.mjs} +0 -0
- /package/dist/{escape-r8_GbEU2.mjs → escape-BDgouFFY.mjs} +0 -0
- /package/dist/{experimental-workflows-BbZbIEZp.mjs → experimental-workflows-Dh4DUoD_.mjs} +0 -0
- /package/dist/{hash-DFFrkivP.mjs → hash-BPmX6P8I.mjs} +0 -0
- /package/dist/{manifest-schema-C6fzQoWn.mjs → manifest-schema-qh2P7RDX.mjs} +0 -0
- /package/dist/{mime-DYP4V5Ks.mjs → mime-8pAB8-77.mjs} +0 -0
- /package/dist/{mode-Bd55iLcP.mjs → mode-CpyEz8pe.mjs} +0 -0
- /package/dist/{normalize-BY_EJnd9.mjs → normalize-O-hi3a27.mjs} +0 -0
- /package/dist/{oauth-state-store-BRSUEkmx.mjs → oauth-state-store-qncPB_IU.mjs} +0 -0
- /package/dist/{oauth-user-lookup-DdcI8ZVL.mjs → oauth-user-lookup-BFjWF8wK.mjs} +0 -0
- /package/dist/{parser-egIGEco-.mjs → parser-DxfsARXL.mjs} +0 -0
- /package/dist/{passkey-config-AX4sjpQ4.mjs → passkey-config-DzHQK90v.mjs} +0 -0
- /package/dist/{patterns-CiyXeDgr.mjs → patterns-D9iDO3j8.mjs} +0 -0
- /package/dist/{placeholder-b0Ufu0La.mjs → placeholder-BDo81Is5.mjs} +0 -0
- /package/dist/{provider-loader-BdRV01gr.mjs → provider-loader-DzUxejk7.mjs} +0 -0
- /package/dist/{public-url-BL2r8dmQ.mjs → public-url-DLUM5OOv.mjs} +0 -0
- /package/dist/{redirect-Ce_6Yb6z.mjs → redirect-BjIBtDWY.mjs} +0 -0
- /package/dist/{secrets-DfeNNoLa.mjs → secrets-CN6FCpcB.mjs} +0 -0
- /package/dist/{seo-contributions-C0LXoWw3.mjs → seo-contributions-CqVvReEj.mjs} +0 -0
- /package/dist/{setup-complete-C2ztsNhJ.mjs → setup-complete-BytMc6HO.mjs} +0 -0
- /package/dist/{setup-nonce-BTKq7uBi.mjs → setup-nonce-pyGfc9hV.mjs} +0 -0
- /package/dist/{sidecar-client-lrf7ErYJ.mjs → sidecar-client-mJxwayYN.mjs} +0 -0
- /package/dist/{site-url-C18yBhtv.mjs → site-url-C-cu8Ff2.mjs} +0 -0
- /package/dist/{ssrf-KAIQS48_.mjs → ssrf-DiKqWd3N.mjs} +0 -0
- /package/dist/{tokens-CsP8Se8S.mjs → tokens-CjSgb0AC.mjs} +0 -0
- /package/dist/{transport-nNEGdHkI.d.mts → transport-DidKKxvW.d.mts} +0 -0
- /package/dist/{transport-B7kO-4ee.mjs → transport-LSdZVXHF.mjs} +0 -0
- /package/dist/{trusted-proxy-Bbm6PLR6.mjs → trusted-proxy-BgIIcbsN.mjs} +0 -0
- /package/dist/{types-CNNQ8l0v.mjs → types-Cg276-3z.mjs} +0 -0
- /package/dist/{types-BYjPylrZ.d.mts → types-DZpT-PnG.d.mts} +0 -0
- /package/dist/{types-BgE6gMFI.d.mts → types-Dryvv7LH.d.mts} +0 -0
- /package/dist/{types-BBETcziA.d.mts → types-GaCtZ1k9.d.mts} +0 -0
- /package/dist/{url-BzhfYtRn.mjs → url-w7Mp5qAD.mjs} +0 -0
- /package/dist/{utils-FEbQMgB5.mjs → utils-wv-zvC-Y.mjs} +0 -0
|
@@ -1,14 +1,32 @@
|
|
|
1
|
-
import { t as __exportAll } from "./chunk-ClPoSABd.mjs";
|
|
2
1
|
import { t as validateIdentifier } from "./validate-VPnKoIzW.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import { n as getI18nConfig } from "./config-
|
|
5
|
-
import {
|
|
2
|
+
import { a as currentTimestampValue, i as currentTimestamp, l as listTablesLike, n as columnExists, s as isSqlite, t as binaryType } from "./dialect-helpers-fk43GbDb.mjs";
|
|
3
|
+
import { n as getI18nConfig } from "./config-CVssduLe.mjs";
|
|
4
|
+
import { n as contentLocaleUpdatedIndexName, t as contentLocaleCreatedIndexName } from "./content-index-names-Bbu1FY1r.mjs";
|
|
5
|
+
import { createRequire } from "node:module";
|
|
6
6
|
import { createHash } from "node:crypto";
|
|
7
|
+
import { Migrator, sql } from "kysely";
|
|
8
|
+
|
|
9
|
+
//#region \0rolldown/runtime.js
|
|
10
|
+
var __defProp = Object.defineProperty;
|
|
11
|
+
var __exportAll = (all, no_symbols) => {
|
|
12
|
+
let target = {};
|
|
13
|
+
for (var name in all) {
|
|
14
|
+
__defProp(target, name, {
|
|
15
|
+
get: all[name],
|
|
16
|
+
enumerable: true
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
if (!no_symbols) {
|
|
20
|
+
__defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
21
|
+
}
|
|
22
|
+
return target;
|
|
23
|
+
};
|
|
7
24
|
|
|
25
|
+
//#endregion
|
|
8
26
|
//#region src/database/migrations/001_initial.ts
|
|
9
27
|
var _001_initial_exports = /* @__PURE__ */ __exportAll({
|
|
10
|
-
down: () => down$
|
|
11
|
-
up: () => up$
|
|
28
|
+
down: () => down$47,
|
|
29
|
+
up: () => up$47
|
|
12
30
|
});
|
|
13
31
|
/**
|
|
14
32
|
* Initial schema migration
|
|
@@ -17,7 +35,7 @@ var _001_initial_exports = /* @__PURE__ */ __exportAll({
|
|
|
17
35
|
* by the SchemaRegistry when collections are added via the admin UI.
|
|
18
36
|
* This migration only creates system tables.
|
|
19
37
|
*/
|
|
20
|
-
async function up$
|
|
38
|
+
async function up$47(db) {
|
|
21
39
|
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(db))).execute();
|
|
22
40
|
await db.schema.createIndex("idx_revisions_entry").ifNotExists().on("revisions").columns(["collection", "entry_id"]).execute();
|
|
23
41
|
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();
|
|
@@ -37,7 +55,7 @@ async function up$44(db) {
|
|
|
37
55
|
await db.schema.createIndex("idx_audit_action").ifNotExists().on("audit_logs").column("action").execute();
|
|
38
56
|
await db.schema.createIndex("idx_audit_timestamp").ifNotExists().on("audit_logs").column("timestamp").execute();
|
|
39
57
|
}
|
|
40
|
-
async function down$
|
|
58
|
+
async function down$47(db) {
|
|
41
59
|
await db.schema.dropTable("audit_logs").execute();
|
|
42
60
|
await db.schema.dropTable("options").execute();
|
|
43
61
|
await db.schema.dropTable("users").execute();
|
|
@@ -50,26 +68,26 @@ async function down$44(db) {
|
|
|
50
68
|
//#endregion
|
|
51
69
|
//#region src/database/migrations/002_media_status.ts
|
|
52
70
|
var _002_media_status_exports = /* @__PURE__ */ __exportAll({
|
|
53
|
-
down: () => down$
|
|
54
|
-
up: () => up$
|
|
71
|
+
down: () => down$46,
|
|
72
|
+
up: () => up$46
|
|
55
73
|
});
|
|
56
74
|
/**
|
|
57
75
|
* Add status column to media table for tracking upload state.
|
|
58
76
|
* Status values: 'pending' | 'ready' | 'failed'
|
|
59
77
|
*/
|
|
60
|
-
async function up$
|
|
78
|
+
async function up$46(db) {
|
|
61
79
|
await db.schema.alterTable("media").addColumn("status", "text", (col) => col.notNull().defaultTo("ready")).execute();
|
|
62
80
|
await db.schema.createIndex("idx_media_status").on("media").column("status").execute();
|
|
63
81
|
}
|
|
64
|
-
async function down$
|
|
82
|
+
async function down$46(db) {
|
|
65
83
|
await db.schema.dropIndex("idx_media_status").execute();
|
|
66
84
|
}
|
|
67
85
|
|
|
68
86
|
//#endregion
|
|
69
87
|
//#region src/database/migrations/003_schema_registry.ts
|
|
70
88
|
var _003_schema_registry_exports = /* @__PURE__ */ __exportAll({
|
|
71
|
-
down: () => down$
|
|
72
|
-
up: () => up$
|
|
89
|
+
down: () => down$45,
|
|
90
|
+
up: () => up$45
|
|
73
91
|
});
|
|
74
92
|
/**
|
|
75
93
|
* Migration: Schema Registry Tables
|
|
@@ -77,14 +95,14 @@ var _003_schema_registry_exports = /* @__PURE__ */ __exportAll({
|
|
|
77
95
|
* Creates the schema registry tables that store collection and field definitions.
|
|
78
96
|
* This enables dynamic schema management where the database is the source of truth.
|
|
79
97
|
*/
|
|
80
|
-
async function up$
|
|
98
|
+
async function up$45(db) {
|
|
81
99
|
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(db))).addColumn("updated_at", "text", (col) => col.defaultTo(currentTimestamp(db))).execute();
|
|
82
100
|
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(db))).addForeignKeyConstraint("fields_collection_fk", ["collection_id"], "_dineway_collections", ["id"], (cb) => cb.onDelete("cascade")).execute();
|
|
83
101
|
await db.schema.createIndex("idx_fields_collection_slug").on("_dineway_fields").columns(["collection_id", "slug"]).unique().execute();
|
|
84
102
|
await db.schema.createIndex("idx_fields_collection").on("_dineway_fields").column("collection_id").execute();
|
|
85
103
|
await db.schema.createIndex("idx_fields_sort").on("_dineway_fields").columns(["collection_id", "sort_order"]).execute();
|
|
86
104
|
}
|
|
87
|
-
async function down$
|
|
105
|
+
async function down$45(db) {
|
|
88
106
|
await db.schema.dropTable("_dineway_fields").execute();
|
|
89
107
|
await db.schema.dropTable("_dineway_collections").execute();
|
|
90
108
|
}
|
|
@@ -92,8 +110,8 @@ async function down$42(db) {
|
|
|
92
110
|
//#endregion
|
|
93
111
|
//#region src/database/migrations/004_plugins.ts
|
|
94
112
|
var _004_plugins_exports = /* @__PURE__ */ __exportAll({
|
|
95
|
-
down: () => down$
|
|
96
|
-
up: () => up$
|
|
113
|
+
down: () => down$44,
|
|
114
|
+
up: () => up$44
|
|
97
115
|
});
|
|
98
116
|
/**
|
|
99
117
|
* Migration: Plugin System Tables
|
|
@@ -103,7 +121,7 @@ var _004_plugins_exports = /* @__PURE__ */ __exportAll({
|
|
|
103
121
|
*
|
|
104
122
|
* @see PLUGIN-SYSTEM.md § Plugin Storage
|
|
105
123
|
*/
|
|
106
|
-
async function up$
|
|
124
|
+
async function up$44(db) {
|
|
107
125
|
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(db))).addColumn("updated_at", "text", (col) => col.defaultTo(currentTimestamp(db))).addPrimaryKeyConstraint("pk_plugin_storage", [
|
|
108
126
|
"plugin_id",
|
|
109
127
|
"collection",
|
|
@@ -121,7 +139,7 @@ async function up$41(db) {
|
|
|
121
139
|
"index_name"
|
|
122
140
|
]).execute();
|
|
123
141
|
}
|
|
124
|
-
async function down$
|
|
142
|
+
async function down$44(db) {
|
|
125
143
|
await db.schema.dropTable("_plugin_indexes").execute();
|
|
126
144
|
await db.schema.dropTable("_plugin_state").execute();
|
|
127
145
|
await db.schema.dropTable("_plugin_storage").execute();
|
|
@@ -130,8 +148,8 @@ async function down$41(db) {
|
|
|
130
148
|
//#endregion
|
|
131
149
|
//#region src/database/migrations/005_menus.ts
|
|
132
150
|
var _005_menus_exports = /* @__PURE__ */ __exportAll({
|
|
133
|
-
down: () => down$
|
|
134
|
-
up: () => up$
|
|
151
|
+
down: () => down$43,
|
|
152
|
+
up: () => up$43
|
|
135
153
|
});
|
|
136
154
|
/**
|
|
137
155
|
* Navigation Menus migration
|
|
@@ -139,13 +157,13 @@ var _005_menus_exports = /* @__PURE__ */ __exportAll({
|
|
|
139
157
|
* Creates tables for admin-editable navigation menus.
|
|
140
158
|
* Menu items can reference content entries, taxonomy terms, or custom URLs.
|
|
141
159
|
*/
|
|
142
|
-
async function up$
|
|
160
|
+
async function up$43(db) {
|
|
143
161
|
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(db))).addColumn("updated_at", "text", (col) => col.defaultTo(currentTimestamp(db))).execute();
|
|
144
162
|
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(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();
|
|
145
163
|
await db.schema.createIndex("idx_menu_items_menu").on("_dineway_menu_items").columns(["menu_id", "sort_order"]).execute();
|
|
146
164
|
await db.schema.createIndex("idx_menu_items_parent").on("_dineway_menu_items").column("parent_id").execute();
|
|
147
165
|
}
|
|
148
|
-
async function down$
|
|
166
|
+
async function down$43(db) {
|
|
149
167
|
await db.schema.dropTable("_dineway_menu_items").execute();
|
|
150
168
|
await db.schema.dropTable("_dineway_menus").execute();
|
|
151
169
|
}
|
|
@@ -153,8 +171,8 @@ async function down$40(db) {
|
|
|
153
171
|
//#endregion
|
|
154
172
|
//#region src/database/migrations/006_taxonomy_defs.ts
|
|
155
173
|
var _006_taxonomy_defs_exports = /* @__PURE__ */ __exportAll({
|
|
156
|
-
down: () => down$
|
|
157
|
-
up: () => up$
|
|
174
|
+
down: () => down$42,
|
|
175
|
+
up: () => up$42
|
|
158
176
|
});
|
|
159
177
|
/**
|
|
160
178
|
* Taxonomy definitions migration
|
|
@@ -162,7 +180,7 @@ var _006_taxonomy_defs_exports = /* @__PURE__ */ __exportAll({
|
|
|
162
180
|
* Adds _dineway_taxonomy_defs table to store taxonomy definitions (category, tag, custom)
|
|
163
181
|
* and seeds default category and tag taxonomies.
|
|
164
182
|
*/
|
|
165
|
-
async function up$
|
|
183
|
+
async function up$42(db) {
|
|
166
184
|
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(db))).execute();
|
|
167
185
|
await db.insertInto("_dineway_taxonomy_defs").values([{
|
|
168
186
|
id: "taxdef_category",
|
|
@@ -180,22 +198,22 @@ async function up$39(db) {
|
|
|
180
198
|
collections: JSON.stringify(["posts"])
|
|
181
199
|
}]).execute();
|
|
182
200
|
}
|
|
183
|
-
async function down$
|
|
201
|
+
async function down$42(db) {
|
|
184
202
|
await db.schema.dropTable("_dineway_taxonomy_defs").execute();
|
|
185
203
|
}
|
|
186
204
|
|
|
187
205
|
//#endregion
|
|
188
206
|
//#region src/database/migrations/007_widgets.ts
|
|
189
207
|
var _007_widgets_exports = /* @__PURE__ */ __exportAll({
|
|
190
|
-
down: () => down$
|
|
191
|
-
up: () => up$
|
|
208
|
+
down: () => down$41,
|
|
209
|
+
up: () => up$41
|
|
192
210
|
});
|
|
193
|
-
async function up$
|
|
211
|
+
async function up$41(db) {
|
|
194
212
|
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();
|
|
195
213
|
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();
|
|
196
214
|
await db.schema.createIndex("idx_widgets_area").on("_dineway_widgets").columns(["area_id", "sort_order"]).execute();
|
|
197
215
|
}
|
|
198
|
-
async function down$
|
|
216
|
+
async function down$41(db) {
|
|
199
217
|
await db.schema.dropTable("_dineway_widgets").execute();
|
|
200
218
|
await db.schema.dropTable("_dineway_widget_areas").execute();
|
|
201
219
|
}
|
|
@@ -203,8 +221,8 @@ async function down$38(db) {
|
|
|
203
221
|
//#endregion
|
|
204
222
|
//#region src/database/migrations/008_auth.ts
|
|
205
223
|
var _008_auth_exports = /* @__PURE__ */ __exportAll({
|
|
206
|
-
down: () => down$
|
|
207
|
-
up: () => up$
|
|
224
|
+
down: () => down$40,
|
|
225
|
+
up: () => up$40
|
|
208
226
|
});
|
|
209
227
|
/**
|
|
210
228
|
* Auth migration - passkey-first authentication
|
|
@@ -218,7 +236,7 @@ var _008_auth_exports = /* @__PURE__ */ __exportAll({
|
|
|
218
236
|
* - Creates oauth_accounts table (external provider links)
|
|
219
237
|
* - Creates allowed_domains table (self-signup)
|
|
220
238
|
*/
|
|
221
|
-
async function up$
|
|
239
|
+
async function up$40(db) {
|
|
222
240
|
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(db))).addColumn("updated_at", "text", (col) => col.defaultTo(currentTimestamp(db))).execute();
|
|
223
241
|
await sql`
|
|
224
242
|
INSERT INTO users_new (id, email, name, role, data, created_at, updated_at)
|
|
@@ -251,7 +269,7 @@ async function up$37(db) {
|
|
|
251
269
|
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(db))).execute();
|
|
252
270
|
await db.schema.createIndex("idx_auth_challenges_expires").on("auth_challenges").column("expires_at").execute();
|
|
253
271
|
}
|
|
254
|
-
async function down$
|
|
272
|
+
async function down$40(db) {
|
|
255
273
|
await db.schema.dropTable("auth_challenges").execute();
|
|
256
274
|
await db.schema.dropTable("allowed_domains").execute();
|
|
257
275
|
await db.schema.dropTable("oauth_accounts").execute();
|
|
@@ -284,8 +302,8 @@ async function down$37(db) {
|
|
|
284
302
|
//#endregion
|
|
285
303
|
//#region src/database/migrations/009_user_disabled.ts
|
|
286
304
|
var _009_user_disabled_exports = /* @__PURE__ */ __exportAll({
|
|
287
|
-
down: () => down$
|
|
288
|
-
up: () => up$
|
|
305
|
+
down: () => down$39,
|
|
306
|
+
up: () => up$39
|
|
289
307
|
});
|
|
290
308
|
/**
|
|
291
309
|
* User disabled column - for soft-disabling users
|
|
@@ -294,19 +312,19 @@ var _009_user_disabled_exports = /* @__PURE__ */ __exportAll({
|
|
|
294
312
|
* - Adds disabled column to users table (INTEGER, default 0)
|
|
295
313
|
* - Disabled users cannot log in
|
|
296
314
|
*/
|
|
297
|
-
async function up$
|
|
315
|
+
async function up$39(db) {
|
|
298
316
|
await sql`ALTER TABLE users ADD COLUMN disabled INTEGER NOT NULL DEFAULT 0`.execute(db);
|
|
299
317
|
await db.schema.createIndex("idx_users_disabled").on("users").column("disabled").execute();
|
|
300
318
|
}
|
|
301
|
-
async function down$
|
|
319
|
+
async function down$39(db) {
|
|
302
320
|
await db.schema.dropIndex("idx_users_disabled").execute();
|
|
303
321
|
}
|
|
304
322
|
|
|
305
323
|
//#endregion
|
|
306
324
|
//#region src/database/migrations/011_sections.ts
|
|
307
325
|
var _011_sections_exports = /* @__PURE__ */ __exportAll({
|
|
308
|
-
down: () => down$
|
|
309
|
-
up: () => up$
|
|
326
|
+
down: () => down$38,
|
|
327
|
+
up: () => up$38
|
|
310
328
|
});
|
|
311
329
|
/**
|
|
312
330
|
* Migration: Add sections tables and performance indexes
|
|
@@ -315,13 +333,13 @@ var _011_sections_exports = /* @__PURE__ */ __exportAll({
|
|
|
315
333
|
* They provide a library of pre-built page sections (heroes, CTAs, testimonials, etc.)
|
|
316
334
|
* that content authors can browse and insert with a single click.
|
|
317
335
|
*/
|
|
318
|
-
async function up$
|
|
336
|
+
async function up$38(db) {
|
|
319
337
|
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();
|
|
320
338
|
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();
|
|
321
339
|
await db.schema.createIndex("idx_sections_category").on("_dineway_sections").columns(["category_id"]).execute();
|
|
322
340
|
await db.schema.createIndex("idx_sections_source").on("_dineway_sections").columns(["source"]).execute();
|
|
323
341
|
}
|
|
324
|
-
async function down$
|
|
342
|
+
async function down$38(db) {
|
|
325
343
|
await db.schema.dropIndex("idx_sections_source").execute();
|
|
326
344
|
await db.schema.dropIndex("idx_sections_category").execute();
|
|
327
345
|
await db.schema.dropTable("_dineway_sections").execute();
|
|
@@ -331,8 +349,8 @@ async function down$35(db) {
|
|
|
331
349
|
//#endregion
|
|
332
350
|
//#region src/database/migrations/012_search.ts
|
|
333
351
|
var _012_search_exports = /* @__PURE__ */ __exportAll({
|
|
334
|
-
down: () => down$
|
|
335
|
-
up: () => up$
|
|
352
|
+
down: () => down$37,
|
|
353
|
+
up: () => up$37
|
|
336
354
|
});
|
|
337
355
|
/**
|
|
338
356
|
* Migration: Search Support
|
|
@@ -340,11 +358,11 @@ var _012_search_exports = /* @__PURE__ */ __exportAll({
|
|
|
340
358
|
* Adds search configuration to collections and searchable flag to fields.
|
|
341
359
|
* FTS5 tables are created dynamically when search is enabled for a collection.
|
|
342
360
|
*/
|
|
343
|
-
async function up$
|
|
361
|
+
async function up$37(db) {
|
|
344
362
|
await db.schema.alterTable("_dineway_collections").addColumn("search_config", "text").execute();
|
|
345
363
|
await db.schema.alterTable("_dineway_fields").addColumn("searchable", "integer", (col) => col.defaultTo(0)).execute();
|
|
346
364
|
}
|
|
347
|
-
async function down$
|
|
365
|
+
async function down$37(db) {
|
|
348
366
|
await db.schema.alterTable("_dineway_fields").dropColumn("searchable").execute();
|
|
349
367
|
await db.schema.alterTable("_dineway_collections").dropColumn("search_config").execute();
|
|
350
368
|
}
|
|
@@ -352,8 +370,8 @@ async function down$34(db) {
|
|
|
352
370
|
//#endregion
|
|
353
371
|
//#region src/database/migrations/013_scheduled_publishing.ts
|
|
354
372
|
var _013_scheduled_publishing_exports = /* @__PURE__ */ __exportAll({
|
|
355
|
-
down: () => down$
|
|
356
|
-
up: () => up$
|
|
373
|
+
down: () => down$36,
|
|
374
|
+
up: () => up$36
|
|
357
375
|
});
|
|
358
376
|
/**
|
|
359
377
|
* Migration: Add scheduled publishing support
|
|
@@ -362,7 +380,7 @@ var _013_scheduled_publishing_exports = /* @__PURE__ */ __exportAll({
|
|
|
362
380
|
* When scheduled_at is set and status is 'scheduled', the content
|
|
363
381
|
* will be auto-published when the scheduled time is reached.
|
|
364
382
|
*/
|
|
365
|
-
async function up$
|
|
383
|
+
async function up$36(db) {
|
|
366
384
|
const tableNames = await listTablesLike(db, "ec_%");
|
|
367
385
|
for (const tableName of tableNames) {
|
|
368
386
|
const table = { name: tableName };
|
|
@@ -377,7 +395,7 @@ async function up$33(db) {
|
|
|
377
395
|
`.execute(db);
|
|
378
396
|
}
|
|
379
397
|
}
|
|
380
|
-
async function down$
|
|
398
|
+
async function down$36(db) {
|
|
381
399
|
const tableNames = await listTablesLike(db, "ec_%");
|
|
382
400
|
for (const tableName of tableNames) {
|
|
383
401
|
const table = { name: tableName };
|
|
@@ -394,10 +412,10 @@ async function down$33(db) {
|
|
|
394
412
|
//#endregion
|
|
395
413
|
//#region src/database/migrations/014_draft_revisions.ts
|
|
396
414
|
var _014_draft_revisions_exports = /* @__PURE__ */ __exportAll({
|
|
397
|
-
down: () => down$
|
|
398
|
-
up: () => up$
|
|
415
|
+
down: () => down$35,
|
|
416
|
+
up: () => up$35
|
|
399
417
|
});
|
|
400
|
-
async function up$
|
|
418
|
+
async function up$35(db) {
|
|
401
419
|
const tables = await db.selectFrom("_dineway_collections").select("slug").execute();
|
|
402
420
|
for (const row of tables) {
|
|
403
421
|
const tableName = `ec_${row.slug}`;
|
|
@@ -419,7 +437,7 @@ async function up$32(db) {
|
|
|
419
437
|
`.execute(db);
|
|
420
438
|
}
|
|
421
439
|
}
|
|
422
|
-
async function down$
|
|
440
|
+
async function down$35(db) {
|
|
423
441
|
const tables = await db.selectFrom("_dineway_collections").select("slug").execute();
|
|
424
442
|
for (const row of tables) {
|
|
425
443
|
const tableName = `ec_${row.slug}`;
|
|
@@ -443,8 +461,8 @@ async function down$32(db) {
|
|
|
443
461
|
//#endregion
|
|
444
462
|
//#region src/database/migrations/015_indexes.ts
|
|
445
463
|
var _015_indexes_exports = /* @__PURE__ */ __exportAll({
|
|
446
|
-
down: () => down$
|
|
447
|
-
up: () => up$
|
|
464
|
+
down: () => down$34,
|
|
465
|
+
up: () => up$34
|
|
448
466
|
});
|
|
449
467
|
/**
|
|
450
468
|
* Add performance indexes for common query patterns.
|
|
@@ -457,7 +475,7 @@ var _015_indexes_exports = /* @__PURE__ */ __exportAll({
|
|
|
457
475
|
* 5. Retroactive author_id + updated_at on existing ec_* content tables
|
|
458
476
|
* (new tables get these from createContentTable() in registry.ts)
|
|
459
477
|
*/
|
|
460
|
-
async function up$
|
|
478
|
+
async function up$34(db) {
|
|
461
479
|
await db.schema.createIndex("idx_media_mime_type").on("media").column("mime_type").execute();
|
|
462
480
|
await db.schema.createIndex("idx_media_filename").on("media").column("filename").execute();
|
|
463
481
|
await db.schema.createIndex("idx_media_created_at").on("media").column("created_at").execute();
|
|
@@ -477,7 +495,7 @@ async function up$31(db) {
|
|
|
477
495
|
`.execute(db);
|
|
478
496
|
}
|
|
479
497
|
}
|
|
480
|
-
async function down$
|
|
498
|
+
async function down$34(db) {
|
|
481
499
|
const tableNames = await listTablesLike(db, "ec_%");
|
|
482
500
|
for (const tableName of tableNames) {
|
|
483
501
|
const table = { name: tableName };
|
|
@@ -495,8 +513,8 @@ async function down$31(db) {
|
|
|
495
513
|
//#endregion
|
|
496
514
|
//#region src/database/migrations/016_api_tokens.ts
|
|
497
515
|
var _016_api_tokens_exports = /* @__PURE__ */ __exportAll({
|
|
498
|
-
down: () => down$
|
|
499
|
-
up: () => up$
|
|
516
|
+
down: () => down$33,
|
|
517
|
+
up: () => up$33
|
|
500
518
|
});
|
|
501
519
|
/**
|
|
502
520
|
* API token tables for programmatic access.
|
|
@@ -510,7 +528,7 @@ var _016_api_tokens_exports = /* @__PURE__ */ __exportAll({
|
|
|
510
528
|
* created only part of the schema before failing and never recorded the
|
|
511
529
|
* migration as applied.
|
|
512
530
|
*/
|
|
513
|
-
async function up$
|
|
531
|
+
async function up$33(db) {
|
|
514
532
|
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(db))).addForeignKeyConstraint("api_tokens_user_fk", ["user_id"], "users", ["id"], (cb) => cb.onDelete("cascade")).execute();
|
|
515
533
|
await db.schema.createIndex("idx_api_tokens_token_hash").ifNotExists().on("_dineway_api_tokens").column("token_hash").execute();
|
|
516
534
|
await db.schema.createIndex("idx_api_tokens_user_id").ifNotExists().on("_dineway_api_tokens").column("user_id").execute();
|
|
@@ -519,7 +537,7 @@ async function up$30(db) {
|
|
|
519
537
|
await db.schema.createIndex("idx_oauth_tokens_expires").ifNotExists().on("_dineway_oauth_tokens").column("expires_at").execute();
|
|
520
538
|
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(db))).execute();
|
|
521
539
|
}
|
|
522
|
-
async function down$
|
|
540
|
+
async function down$33(db) {
|
|
523
541
|
await db.schema.dropTable("_dineway_device_codes").ifExists().execute();
|
|
524
542
|
await db.schema.dropTable("_dineway_oauth_tokens").ifExists().execute();
|
|
525
543
|
await db.schema.dropTable("_dineway_api_tokens").ifExists().execute();
|
|
@@ -528,8 +546,8 @@ async function down$30(db) {
|
|
|
528
546
|
//#endregion
|
|
529
547
|
//#region src/database/migrations/017_authorization_codes.ts
|
|
530
548
|
var _017_authorization_codes_exports = /* @__PURE__ */ __exportAll({
|
|
531
|
-
down: () => down$
|
|
532
|
-
up: () => up$
|
|
549
|
+
down: () => down$32,
|
|
550
|
+
up: () => up$32
|
|
533
551
|
});
|
|
534
552
|
/**
|
|
535
553
|
* Authorization codes for OAuth 2.1 Authorization Code + PKCE flow.
|
|
@@ -539,20 +557,20 @@ var _017_authorization_codes_exports = /* @__PURE__ */ __exportAll({
|
|
|
539
557
|
*
|
|
540
558
|
* Also adds client_id tracking to oauth_tokens for per-client revocation.
|
|
541
559
|
*/
|
|
542
|
-
async function up$
|
|
560
|
+
async function up$32(db) {
|
|
543
561
|
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(db))).addForeignKeyConstraint("auth_codes_user_fk", ["user_id"], "users", ["id"], (cb) => cb.onDelete("cascade")).execute();
|
|
544
562
|
await db.schema.createIndex("idx_auth_codes_expires").on("_dineway_authorization_codes").column("expires_at").execute();
|
|
545
563
|
await sql`ALTER TABLE _dineway_oauth_tokens ADD COLUMN client_id TEXT`.execute(db);
|
|
546
564
|
}
|
|
547
|
-
async function down$
|
|
565
|
+
async function down$32(db) {
|
|
548
566
|
await db.schema.dropTable("_dineway_authorization_codes").execute();
|
|
549
567
|
}
|
|
550
568
|
|
|
551
569
|
//#endregion
|
|
552
570
|
//#region src/database/migrations/018_seo.ts
|
|
553
571
|
var _018_seo_exports = /* @__PURE__ */ __exportAll({
|
|
554
|
-
down: () => down$
|
|
555
|
-
up: () => up$
|
|
572
|
+
down: () => down$31,
|
|
573
|
+
up: () => up$31
|
|
556
574
|
});
|
|
557
575
|
/**
|
|
558
576
|
* Migration: SEO support
|
|
@@ -565,7 +583,7 @@ var _018_seo_exports = /* @__PURE__ */ __exportAll({
|
|
|
565
583
|
* need it. The `has_seo` flag controls whether the admin shows SEO fields
|
|
566
584
|
* and whether the collection's content appears in sitemaps.
|
|
567
585
|
*/
|
|
568
|
-
async function up$
|
|
586
|
+
async function up$31(db) {
|
|
569
587
|
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(db))).addColumn("updated_at", "text", (col) => col.notNull().defaultTo(currentTimestamp(db))).addPrimaryKeyConstraint("_dineway_seo_pk", ["collection", "content_id"]).execute();
|
|
570
588
|
await sql`
|
|
571
589
|
CREATE INDEX idx_dineway_seo_collection
|
|
@@ -576,7 +594,7 @@ async function up$28(db) {
|
|
|
576
594
|
ADD COLUMN has_seo INTEGER NOT NULL DEFAULT 0
|
|
577
595
|
`.execute(db);
|
|
578
596
|
}
|
|
579
|
-
async function down$
|
|
597
|
+
async function down$31(db) {
|
|
580
598
|
await sql`DROP TABLE IF EXISTS _dineway_seo`.execute(db);
|
|
581
599
|
await sql`
|
|
582
600
|
ALTER TABLE _dineway_collections
|
|
@@ -587,8 +605,8 @@ async function down$28(db) {
|
|
|
587
605
|
//#endregion
|
|
588
606
|
//#region src/database/migrations/019_i18n.ts
|
|
589
607
|
var _019_i18n_exports = /* @__PURE__ */ __exportAll({
|
|
590
|
-
down: () => down$
|
|
591
|
-
up: () => up$
|
|
608
|
+
down: () => down$30,
|
|
609
|
+
up: () => up$30
|
|
592
610
|
});
|
|
593
611
|
/**
|
|
594
612
|
* Quote an identifier for use in raw SQL. Escapes embedded double-quotes
|
|
@@ -664,7 +682,7 @@ async function upPostgres(db) {
|
|
|
664
682
|
if ((await sql`
|
|
665
683
|
SELECT EXISTS(
|
|
666
684
|
SELECT 1 FROM information_schema.columns
|
|
667
|
-
WHERE table_schema =
|
|
685
|
+
WHERE table_schema = current_schema() AND table_name = ${t} AND column_name = 'locale'
|
|
668
686
|
) as exists
|
|
669
687
|
`.execute(db)).rows[0]?.exists === true) continue;
|
|
670
688
|
await sql`ALTER TABLE ${sql.ref(t)} ADD COLUMN locale TEXT NOT NULL DEFAULT 'en'`.execute(db);
|
|
@@ -694,14 +712,14 @@ async function upPostgres(db) {
|
|
|
694
712
|
if ((await sql`
|
|
695
713
|
SELECT EXISTS(
|
|
696
714
|
SELECT 1 FROM information_schema.columns
|
|
697
|
-
WHERE table_schema =
|
|
715
|
+
WHERE table_schema = current_schema() AND table_name = '_dineway_fields' AND column_name = 'translatable'
|
|
698
716
|
) as exists
|
|
699
717
|
`.execute(db)).rows[0]?.exists !== true) await sql`
|
|
700
718
|
ALTER TABLE _dineway_fields
|
|
701
719
|
ADD COLUMN translatable INTEGER NOT NULL DEFAULT 1
|
|
702
720
|
`.execute(db);
|
|
703
721
|
}
|
|
704
|
-
async function up$
|
|
722
|
+
async function up$30(db) {
|
|
705
723
|
if (!isSqlite(db)) return upPostgres(db);
|
|
706
724
|
const orphanedTmps = await listTablesLike(db, "ec_%_i18n_tmp");
|
|
707
725
|
for (const tmpName of orphanedTmps) {
|
|
@@ -818,7 +836,7 @@ async function downPostgres(db) {
|
|
|
818
836
|
await sql`ALTER TABLE ${sql.ref(t)} DROP COLUMN translation_group`.execute(db);
|
|
819
837
|
}
|
|
820
838
|
}
|
|
821
|
-
async function down$
|
|
839
|
+
async function down$30(db) {
|
|
822
840
|
if (!isSqlite(db)) return downPostgres(db);
|
|
823
841
|
await sql`
|
|
824
842
|
ALTER TABLE _dineway_fields
|
|
@@ -925,8 +943,8 @@ async function down$27(db) {
|
|
|
925
943
|
//#endregion
|
|
926
944
|
//#region src/database/migrations/020_collection_url_pattern.ts
|
|
927
945
|
var _020_collection_url_pattern_exports = /* @__PURE__ */ __exportAll({
|
|
928
|
-
down: () => down$
|
|
929
|
-
up: () => up$
|
|
946
|
+
down: () => down$29,
|
|
947
|
+
up: () => up$29
|
|
930
948
|
});
|
|
931
949
|
/**
|
|
932
950
|
* Migration: URL pattern for collections
|
|
@@ -935,13 +953,13 @@ var _020_collection_url_pattern_exports = /* @__PURE__ */ __exportAll({
|
|
|
935
953
|
* can declare its own URL structure (e.g. "/{slug}" for pages, "/blog/{slug}"
|
|
936
954
|
* for posts). Used for menu URL resolution, sitemaps, and path-based lookups.
|
|
937
955
|
*/
|
|
938
|
-
async function up$
|
|
956
|
+
async function up$29(db) {
|
|
939
957
|
await sql`
|
|
940
958
|
ALTER TABLE _dineway_collections
|
|
941
959
|
ADD COLUMN url_pattern TEXT
|
|
942
960
|
`.execute(db);
|
|
943
961
|
}
|
|
944
|
-
async function down$
|
|
962
|
+
async function down$29(db) {
|
|
945
963
|
await sql`
|
|
946
964
|
ALTER TABLE _dineway_collections
|
|
947
965
|
DROP COLUMN url_pattern
|
|
@@ -951,8 +969,8 @@ async function down$26(db) {
|
|
|
951
969
|
//#endregion
|
|
952
970
|
//#region src/database/migrations/021_remove_section_categories.ts
|
|
953
971
|
var _021_remove_section_categories_exports = /* @__PURE__ */ __exportAll({
|
|
954
|
-
down: () => down$
|
|
955
|
-
up: () => up$
|
|
972
|
+
down: () => down$28,
|
|
973
|
+
up: () => up$28
|
|
956
974
|
});
|
|
957
975
|
/**
|
|
958
976
|
* Migration: Remove section categories
|
|
@@ -961,12 +979,12 @@ var _021_remove_section_categories_exports = /* @__PURE__ */ __exportAll({
|
|
|
961
979
|
* Rather than building the missing UI for a feature with very little need at this stage,
|
|
962
980
|
* we're removing the feature entirely.
|
|
963
981
|
*/
|
|
964
|
-
async function up$
|
|
982
|
+
async function up$28(db) {
|
|
965
983
|
await db.schema.dropIndex("idx_sections_category").ifExists().execute();
|
|
966
984
|
await db.schema.alterTable("_dineway_sections").dropColumn("category_id").execute();
|
|
967
985
|
await db.schema.dropTable("_dineway_section_categories").execute();
|
|
968
986
|
}
|
|
969
|
-
async function down$
|
|
987
|
+
async function down$28(db) {
|
|
970
988
|
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();
|
|
971
989
|
await db.schema.alterTable("_dineway_sections").addColumn("category_id", "text", (col) => col.references("_dineway_section_categories.id").onDelete("set null")).execute();
|
|
972
990
|
await db.schema.createIndex("idx_sections_category").on("_dineway_sections").columns(["category_id"]).execute();
|
|
@@ -975,8 +993,8 @@ async function down$25(db) {
|
|
|
975
993
|
//#endregion
|
|
976
994
|
//#region src/database/migrations/022_marketplace_plugin_state.ts
|
|
977
995
|
var _022_marketplace_plugin_state_exports = /* @__PURE__ */ __exportAll({
|
|
978
|
-
down: () => down$
|
|
979
|
-
up: () => up$
|
|
996
|
+
down: () => down$27,
|
|
997
|
+
up: () => up$27
|
|
980
998
|
});
|
|
981
999
|
/**
|
|
982
1000
|
* Migration: Add marketplace fields to _plugin_state
|
|
@@ -985,7 +1003,7 @@ var _022_marketplace_plugin_state_exports = /* @__PURE__ */ __exportAll({
|
|
|
985
1003
|
* whether a plugin was installed from config or marketplace,
|
|
986
1004
|
* and which marketplace version is installed.
|
|
987
1005
|
*/
|
|
988
|
-
async function up$
|
|
1006
|
+
async function up$27(db) {
|
|
989
1007
|
await sql`
|
|
990
1008
|
ALTER TABLE _plugin_state
|
|
991
1009
|
ADD COLUMN source TEXT NOT NULL DEFAULT 'config'
|
|
@@ -1000,7 +1018,7 @@ async function up$24(db) {
|
|
|
1000
1018
|
WHERE source = 'marketplace'
|
|
1001
1019
|
`.execute(db);
|
|
1002
1020
|
}
|
|
1003
|
-
async function down$
|
|
1021
|
+
async function down$27(db) {
|
|
1004
1022
|
await sql`
|
|
1005
1023
|
DROP INDEX IF EXISTS idx_plugin_state_source
|
|
1006
1024
|
`.execute(db);
|
|
@@ -1017,8 +1035,8 @@ async function down$24(db) {
|
|
|
1017
1035
|
//#endregion
|
|
1018
1036
|
//#region src/database/migrations/023_plugin_metadata.ts
|
|
1019
1037
|
var _023_plugin_metadata_exports = /* @__PURE__ */ __exportAll({
|
|
1020
|
-
down: () => down$
|
|
1021
|
-
up: () => up$
|
|
1038
|
+
down: () => down$26,
|
|
1039
|
+
up: () => up$26
|
|
1022
1040
|
});
|
|
1023
1041
|
/**
|
|
1024
1042
|
* Migration: Add display metadata to _plugin_state
|
|
@@ -1027,7 +1045,7 @@ var _023_plugin_metadata_exports = /* @__PURE__ */ __exportAll({
|
|
|
1027
1045
|
* so the admin UI can show meaningful info without re-fetching
|
|
1028
1046
|
* from the marketplace on every page load.
|
|
1029
1047
|
*/
|
|
1030
|
-
async function up$
|
|
1048
|
+
async function up$26(db) {
|
|
1031
1049
|
await sql`
|
|
1032
1050
|
ALTER TABLE _plugin_state
|
|
1033
1051
|
ADD COLUMN display_name TEXT
|
|
@@ -1037,7 +1055,7 @@ async function up$23(db) {
|
|
|
1037
1055
|
ADD COLUMN description TEXT
|
|
1038
1056
|
`.execute(db);
|
|
1039
1057
|
}
|
|
1040
|
-
async function down$
|
|
1058
|
+
async function down$26(db) {
|
|
1041
1059
|
await sql`
|
|
1042
1060
|
ALTER TABLE _plugin_state
|
|
1043
1061
|
DROP COLUMN description
|
|
@@ -1051,8 +1069,8 @@ async function down$23(db) {
|
|
|
1051
1069
|
//#endregion
|
|
1052
1070
|
//#region src/database/migrations/024_media_placeholders.ts
|
|
1053
1071
|
var _024_media_placeholders_exports = /* @__PURE__ */ __exportAll({
|
|
1054
|
-
down: () => down$
|
|
1055
|
-
up: () => up$
|
|
1072
|
+
down: () => down$25,
|
|
1073
|
+
up: () => up$25
|
|
1056
1074
|
});
|
|
1057
1075
|
/**
|
|
1058
1076
|
* Migration: Add placeholder columns to media table
|
|
@@ -1060,7 +1078,7 @@ var _024_media_placeholders_exports = /* @__PURE__ */ __exportAll({
|
|
|
1060
1078
|
* Stores blurhash and dominant_color for LQIP (Low Quality Image Placeholder)
|
|
1061
1079
|
* support. Generated at upload time from image pixel data.
|
|
1062
1080
|
*/
|
|
1063
|
-
async function up$
|
|
1081
|
+
async function up$25(db) {
|
|
1064
1082
|
await sql`
|
|
1065
1083
|
ALTER TABLE media
|
|
1066
1084
|
ADD COLUMN blurhash TEXT
|
|
@@ -1070,7 +1088,7 @@ async function up$22(db) {
|
|
|
1070
1088
|
ADD COLUMN dominant_color TEXT
|
|
1071
1089
|
`.execute(db);
|
|
1072
1090
|
}
|
|
1073
|
-
async function down$
|
|
1091
|
+
async function down$25(db) {
|
|
1074
1092
|
await sql`
|
|
1075
1093
|
ALTER TABLE media
|
|
1076
1094
|
DROP COLUMN dominant_color
|
|
@@ -1084,8 +1102,8 @@ async function down$22(db) {
|
|
|
1084
1102
|
//#endregion
|
|
1085
1103
|
//#region src/database/migrations/025_oauth_clients.ts
|
|
1086
1104
|
var _025_oauth_clients_exports = /* @__PURE__ */ __exportAll({
|
|
1087
|
-
down: () => down$
|
|
1088
|
-
up: () => up$
|
|
1105
|
+
down: () => down$24,
|
|
1106
|
+
up: () => up$24
|
|
1089
1107
|
});
|
|
1090
1108
|
/**
|
|
1091
1109
|
* Migration: Create OAuth clients table
|
|
@@ -1096,18 +1114,18 @@ var _025_oauth_clients_exports = /* @__PURE__ */ __exportAll({
|
|
|
1096
1114
|
* Each client has a set of pre-registered redirect URIs (JSON array).
|
|
1097
1115
|
* The authorize endpoint rejects any redirect_uri not in the client's list.
|
|
1098
1116
|
*/
|
|
1099
|
-
async function up$
|
|
1117
|
+
async function up$24(db) {
|
|
1100
1118
|
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(db))).addColumn("updated_at", "text", (col) => col.defaultTo(currentTimestamp(db))).execute();
|
|
1101
1119
|
}
|
|
1102
|
-
async function down$
|
|
1120
|
+
async function down$24(db) {
|
|
1103
1121
|
await db.schema.dropTable("_dineway_oauth_clients").execute();
|
|
1104
1122
|
}
|
|
1105
1123
|
|
|
1106
1124
|
//#endregion
|
|
1107
1125
|
//#region src/database/migrations/026_cron_tasks.ts
|
|
1108
1126
|
var _026_cron_tasks_exports = /* @__PURE__ */ __exportAll({
|
|
1109
|
-
down: () => down$
|
|
1110
|
-
up: () => up$
|
|
1127
|
+
down: () => down$23,
|
|
1128
|
+
up: () => up$23
|
|
1111
1129
|
});
|
|
1112
1130
|
/**
|
|
1113
1131
|
* Migration: Create cron tasks table for plugin scheduled tasks.
|
|
@@ -1118,7 +1136,7 @@ var _026_cron_tasks_exports = /* @__PURE__ */ __exportAll({
|
|
|
1118
1136
|
* The `next_run_at` + `status` + `enabled` index drives the "find overdue
|
|
1119
1137
|
* tasks" query used by CronExecutor.tick().
|
|
1120
1138
|
*/
|
|
1121
|
-
async function up$
|
|
1139
|
+
async function up$23(db) {
|
|
1122
1140
|
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(db))).addUniqueConstraint("uq_cron_tasks_plugin_task", ["plugin_id", "task_name"]).execute();
|
|
1123
1141
|
await db.schema.createIndex("idx_cron_tasks_due").on("_dineway_cron_tasks").columns([
|
|
1124
1142
|
"enabled",
|
|
@@ -1127,17 +1145,17 @@ async function up$20(db) {
|
|
|
1127
1145
|
]).execute();
|
|
1128
1146
|
await db.schema.createIndex("idx_cron_tasks_plugin").on("_dineway_cron_tasks").column("plugin_id").execute();
|
|
1129
1147
|
}
|
|
1130
|
-
async function down$
|
|
1148
|
+
async function down$23(db) {
|
|
1131
1149
|
await db.schema.dropTable("_dineway_cron_tasks").execute();
|
|
1132
1150
|
}
|
|
1133
1151
|
|
|
1134
1152
|
//#endregion
|
|
1135
1153
|
//#region src/database/migrations/027_comments.ts
|
|
1136
1154
|
var _027_comments_exports = /* @__PURE__ */ __exportAll({
|
|
1137
|
-
down: () => down$
|
|
1138
|
-
up: () => up$
|
|
1155
|
+
down: () => down$22,
|
|
1156
|
+
up: () => up$22
|
|
1139
1157
|
});
|
|
1140
|
-
async function up$
|
|
1158
|
+
async function up$22(db) {
|
|
1141
1159
|
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(db))).addColumn("updated_at", "text", (col) => col.defaultTo(currentTimestamp(db))).execute();
|
|
1142
1160
|
await db.schema.createIndex("idx_comments_content").on("_dineway_comments").columns([
|
|
1143
1161
|
"collection",
|
|
@@ -1153,30 +1171,30 @@ async function up$19(db) {
|
|
|
1153
1171
|
await db.schema.alterTable("_dineway_collections").addColumn("comments_closed_after_days", "integer", (col) => col.defaultTo(90)).execute();
|
|
1154
1172
|
await db.schema.alterTable("_dineway_collections").addColumn("comments_auto_approve_users", "integer", (col) => col.defaultTo(1)).execute();
|
|
1155
1173
|
}
|
|
1156
|
-
async function down$
|
|
1174
|
+
async function down$22(db) {
|
|
1157
1175
|
await db.schema.dropTable("_dineway_comments").execute();
|
|
1158
1176
|
}
|
|
1159
1177
|
|
|
1160
1178
|
//#endregion
|
|
1161
1179
|
//#region src/database/migrations/028_drop_author_url.ts
|
|
1162
1180
|
var _028_drop_author_url_exports = /* @__PURE__ */ __exportAll({
|
|
1163
|
-
down: () => down$
|
|
1164
|
-
up: () => up$
|
|
1181
|
+
down: () => down$21,
|
|
1182
|
+
up: () => up$21
|
|
1165
1183
|
});
|
|
1166
|
-
async function up$
|
|
1184
|
+
async function up$21(db) {
|
|
1167
1185
|
await sql`ALTER TABLE _dineway_comments DROP COLUMN author_url`.execute(db);
|
|
1168
1186
|
}
|
|
1169
|
-
async function down$
|
|
1187
|
+
async function down$21(db) {
|
|
1170
1188
|
await db.schema.alterTable("_dineway_comments").addColumn("author_url", "text").execute();
|
|
1171
1189
|
}
|
|
1172
1190
|
|
|
1173
1191
|
//#endregion
|
|
1174
1192
|
//#region src/database/migrations/029_redirects.ts
|
|
1175
1193
|
var _029_redirects_exports = /* @__PURE__ */ __exportAll({
|
|
1176
|
-
down: () => down$
|
|
1177
|
-
up: () => up$
|
|
1194
|
+
down: () => down$20,
|
|
1195
|
+
up: () => up$20
|
|
1178
1196
|
});
|
|
1179
|
-
async function up$
|
|
1197
|
+
async function up$20(db) {
|
|
1180
1198
|
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(db))).addColumn("updated_at", "text", (col) => col.defaultTo(currentTimestamp(db))).execute();
|
|
1181
1199
|
await db.schema.createIndex("idx_redirects_source").on("_dineway_redirects").column("source").execute();
|
|
1182
1200
|
await db.schema.createIndex("idx_redirects_enabled").on("_dineway_redirects").column("enabled").execute();
|
|
@@ -1185,7 +1203,7 @@ async function up$17(db) {
|
|
|
1185
1203
|
await db.schema.createIndex("idx_404_log_path").on("_dineway_404_log").column("path").execute();
|
|
1186
1204
|
await db.schema.createIndex("idx_404_log_created").on("_dineway_404_log").column("created_at").execute();
|
|
1187
1205
|
}
|
|
1188
|
-
async function down$
|
|
1206
|
+
async function down$20(db) {
|
|
1189
1207
|
await db.schema.dropTable("_dineway_404_log").execute();
|
|
1190
1208
|
await db.schema.dropTable("_dineway_redirects").execute();
|
|
1191
1209
|
}
|
|
@@ -1193,8 +1211,8 @@ async function down$17(db) {
|
|
|
1193
1211
|
//#endregion
|
|
1194
1212
|
//#region src/database/migrations/030_widen_scheduled_index.ts
|
|
1195
1213
|
var _030_widen_scheduled_index_exports = /* @__PURE__ */ __exportAll({
|
|
1196
|
-
down: () => down$
|
|
1197
|
-
up: () => up$
|
|
1214
|
+
down: () => down$19,
|
|
1215
|
+
up: () => up$19
|
|
1198
1216
|
});
|
|
1199
1217
|
/**
|
|
1200
1218
|
* Migration: Widen scheduled publishing index
|
|
@@ -1203,7 +1221,7 @@ var _030_widen_scheduled_index_exports = /* @__PURE__ */ __exportAll({
|
|
|
1203
1221
|
* Published posts can now have scheduled draft changes, so widen the
|
|
1204
1222
|
* index to cover all rows where scheduled_at IS NOT NULL.
|
|
1205
1223
|
*/
|
|
1206
|
-
async function up$
|
|
1224
|
+
async function up$19(db) {
|
|
1207
1225
|
const tableNames = await listTablesLike(db, "ec_%");
|
|
1208
1226
|
for (const tableName of tableNames) {
|
|
1209
1227
|
const table = { name: tableName };
|
|
@@ -1217,7 +1235,7 @@ async function up$16(db) {
|
|
|
1217
1235
|
`.execute(db);
|
|
1218
1236
|
}
|
|
1219
1237
|
}
|
|
1220
|
-
async function down$
|
|
1238
|
+
async function down$19(db) {
|
|
1221
1239
|
const tableNames = await listTablesLike(db, "ec_%");
|
|
1222
1240
|
for (const tableName of tableNames) {
|
|
1223
1241
|
const table = { name: tableName };
|
|
@@ -1235,10 +1253,10 @@ async function down$16(db) {
|
|
|
1235
1253
|
//#endregion
|
|
1236
1254
|
//#region src/database/migrations/031_bylines.ts
|
|
1237
1255
|
var _031_bylines_exports = /* @__PURE__ */ __exportAll({
|
|
1238
|
-
down: () => down$
|
|
1239
|
-
up: () => up$
|
|
1256
|
+
down: () => down$18,
|
|
1257
|
+
up: () => up$18
|
|
1240
1258
|
});
|
|
1241
|
-
async function up$
|
|
1259
|
+
async function up$18(db) {
|
|
1242
1260
|
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(db))).addColumn("updated_at", "text", (col) => col.defaultTo(currentTimestamp(db))).execute();
|
|
1243
1261
|
await sql`
|
|
1244
1262
|
CREATE UNIQUE INDEX ${sql.ref("idx_bylines_user_id_unique")}
|
|
@@ -1270,7 +1288,7 @@ async function up$15(db) {
|
|
|
1270
1288
|
`.execute(db);
|
|
1271
1289
|
}
|
|
1272
1290
|
}
|
|
1273
|
-
async function down$
|
|
1291
|
+
async function down$18(db) {
|
|
1274
1292
|
const tableNames = await listTablesLike(db, "ec_%");
|
|
1275
1293
|
for (const tableName of tableNames) {
|
|
1276
1294
|
await sql`
|
|
@@ -1288,8 +1306,8 @@ async function down$15(db) {
|
|
|
1288
1306
|
//#endregion
|
|
1289
1307
|
//#region src/database/migrations/032_rate_limits.ts
|
|
1290
1308
|
var _032_rate_limits_exports = /* @__PURE__ */ __exportAll({
|
|
1291
|
-
down: () => down$
|
|
1292
|
-
up: () => up$
|
|
1309
|
+
down: () => down$17,
|
|
1310
|
+
up: () => up$17
|
|
1293
1311
|
});
|
|
1294
1312
|
/**
|
|
1295
1313
|
* Migration: Rate limits table + device code polling tracking.
|
|
@@ -1300,12 +1318,12 @@ var _032_rate_limits_exports = /* @__PURE__ */ __exportAll({
|
|
|
1300
1318
|
* 2. Add last_polled_at column to _dineway_device_codes for
|
|
1301
1319
|
* RFC 8628 slow_down enforcement.
|
|
1302
1320
|
*/
|
|
1303
|
-
async function up$
|
|
1321
|
+
async function up$17(db) {
|
|
1304
1322
|
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();
|
|
1305
1323
|
await db.schema.createIndex("idx_rate_limits_window").on("_dineway_rate_limits").column("window").execute();
|
|
1306
1324
|
await db.schema.alterTable("_dineway_device_codes").addColumn("last_polled_at", "text").execute();
|
|
1307
1325
|
}
|
|
1308
|
-
async function down$
|
|
1326
|
+
async function down$17(db) {
|
|
1309
1327
|
await db.schema.dropTable("_dineway_rate_limits").execute();
|
|
1310
1328
|
await db.schema.alterTable("_dineway_device_codes").dropColumn("last_polled_at").execute();
|
|
1311
1329
|
}
|
|
@@ -1313,8 +1331,8 @@ async function down$14(db) {
|
|
|
1313
1331
|
//#endregion
|
|
1314
1332
|
//#region src/database/migrations/033_optimize_content_indexes.ts
|
|
1315
1333
|
var _033_optimize_content_indexes_exports = /* @__PURE__ */ __exportAll({
|
|
1316
|
-
down: () => down$
|
|
1317
|
-
up: () => up$
|
|
1334
|
+
down: () => down$16,
|
|
1335
|
+
up: () => up$16
|
|
1318
1336
|
});
|
|
1319
1337
|
/**
|
|
1320
1338
|
* Migration: Optimize content table indexes for SQLite-compatible performance
|
|
@@ -1327,7 +1345,7 @@ var _033_optimize_content_indexes_exports = /* @__PURE__ */ __exportAll({
|
|
|
1327
1345
|
*
|
|
1328
1346
|
* Impact: Reduces row reads by 90%+ for admin panel operations on SQLite-compatible adapters.
|
|
1329
1347
|
*/
|
|
1330
|
-
async function up$
|
|
1348
|
+
async function up$16(db) {
|
|
1331
1349
|
const tableNames = await listTablesLike(db, "ec_%");
|
|
1332
1350
|
for (const tableName of tableNames) {
|
|
1333
1351
|
const table = { name: tableName };
|
|
@@ -1369,7 +1387,7 @@ async function up$13(db) {
|
|
|
1369
1387
|
WHERE status = 'trash'
|
|
1370
1388
|
`.execute(db);
|
|
1371
1389
|
}
|
|
1372
|
-
async function down$
|
|
1390
|
+
async function down$16(db) {
|
|
1373
1391
|
const tableNames = await listTablesLike(db, "ec_%");
|
|
1374
1392
|
for (const tableName of tableNames) {
|
|
1375
1393
|
const table = { name: tableName };
|
|
@@ -1402,10 +1420,10 @@ async function down$13(db) {
|
|
|
1402
1420
|
//#endregion
|
|
1403
1421
|
//#region src/database/migrations/034_published_at_index.ts
|
|
1404
1422
|
var _034_published_at_index_exports = /* @__PURE__ */ __exportAll({
|
|
1405
|
-
down: () => down$
|
|
1406
|
-
up: () => up$
|
|
1423
|
+
down: () => down$15,
|
|
1424
|
+
up: () => up$15
|
|
1407
1425
|
});
|
|
1408
|
-
async function up$
|
|
1426
|
+
async function up$15(db) {
|
|
1409
1427
|
const tableNames = await listTablesLike(db, "ec_%");
|
|
1410
1428
|
for (const tableName of tableNames) {
|
|
1411
1429
|
const table = { name: tableName };
|
|
@@ -1415,7 +1433,7 @@ async function up$12(db) {
|
|
|
1415
1433
|
`.execute(db);
|
|
1416
1434
|
}
|
|
1417
1435
|
}
|
|
1418
|
-
async function down$
|
|
1436
|
+
async function down$15(db) {
|
|
1419
1437
|
const tableNames = await listTablesLike(db, "ec_%");
|
|
1420
1438
|
for (const tableName of tableNames) {
|
|
1421
1439
|
const table = { name: tableName };
|
|
@@ -1426,15 +1444,15 @@ async function down$12(db) {
|
|
|
1426
1444
|
//#endregion
|
|
1427
1445
|
//#region src/database/migrations/035_backfill_url_patterns.ts
|
|
1428
1446
|
var _035_backfill_url_patterns_exports = /* @__PURE__ */ __exportAll({
|
|
1429
|
-
down: () => down$
|
|
1430
|
-
up: () => up$
|
|
1447
|
+
down: () => down$14,
|
|
1448
|
+
up: () => up$14
|
|
1431
1449
|
});
|
|
1432
1450
|
/**
|
|
1433
1451
|
* Backfill default URL patterns for the built-in posts and pages collections.
|
|
1434
1452
|
*
|
|
1435
1453
|
* Existing rows keep custom patterns; only missing defaults are filled.
|
|
1436
1454
|
*/
|
|
1437
|
-
async function up$
|
|
1455
|
+
async function up$14(db) {
|
|
1438
1456
|
await sql`
|
|
1439
1457
|
UPDATE _dineway_collections
|
|
1440
1458
|
SET url_pattern = '/posts/{slug}'
|
|
@@ -1446,7 +1464,7 @@ async function up$11(db) {
|
|
|
1446
1464
|
WHERE slug = 'pages' AND url_pattern IS NULL
|
|
1447
1465
|
`.execute(db);
|
|
1448
1466
|
}
|
|
1449
|
-
async function down$
|
|
1467
|
+
async function down$14(db) {
|
|
1450
1468
|
await sql`
|
|
1451
1469
|
UPDATE _dineway_collections
|
|
1452
1470
|
SET url_pattern = NULL
|
|
@@ -1462,8 +1480,8 @@ async function down$11(db) {
|
|
|
1462
1480
|
//#endregion
|
|
1463
1481
|
//#region src/database/migrations/036_activity_log.ts
|
|
1464
1482
|
var _036_activity_log_exports = /* @__PURE__ */ __exportAll({
|
|
1465
|
-
down: () => down$
|
|
1466
|
-
up: () => up$
|
|
1483
|
+
down: () => down$13,
|
|
1484
|
+
up: () => up$13
|
|
1467
1485
|
});
|
|
1468
1486
|
/**
|
|
1469
1487
|
* Site Context Engine activity foundation.
|
|
@@ -1472,7 +1490,7 @@ var _036_activity_log_exports = /* @__PURE__ */ __exportAll({
|
|
|
1472
1490
|
* not a request log. Actor IDs intentionally have no foreign key because the
|
|
1473
1491
|
* actor source can be users, API tokens, or a stable system actor.
|
|
1474
1492
|
*/
|
|
1475
|
-
async function up$
|
|
1493
|
+
async function up$13(db) {
|
|
1476
1494
|
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(db))).execute();
|
|
1477
1495
|
await db.schema.createIndex("idx_dineway_activity_actor").on("_dineway_activity_log").columns([
|
|
1478
1496
|
"actor_type",
|
|
@@ -1499,15 +1517,15 @@ async function up$10(db) {
|
|
|
1499
1517
|
await db.schema.createIndex("idx_dineway_activity_result_status").on("_dineway_activity_log").columns(["result_status", "created_at"]).execute();
|
|
1500
1518
|
await db.schema.createIndex("idx_dineway_activity_created_at").on("_dineway_activity_log").column("created_at").execute();
|
|
1501
1519
|
}
|
|
1502
|
-
async function down$
|
|
1520
|
+
async function down$13(db) {
|
|
1503
1521
|
await db.schema.dropTable("_dineway_activity_log").execute();
|
|
1504
1522
|
}
|
|
1505
1523
|
|
|
1506
1524
|
//#endregion
|
|
1507
1525
|
//#region src/database/migrations/037_context_entries.ts
|
|
1508
1526
|
var _037_context_entries_exports = /* @__PURE__ */ __exportAll({
|
|
1509
|
-
down: () => down$
|
|
1510
|
-
up: () => up$
|
|
1527
|
+
down: () => down$12,
|
|
1528
|
+
up: () => up$12
|
|
1511
1529
|
});
|
|
1512
1530
|
const CONTEXT_TYPE_SQL = [
|
|
1513
1531
|
"brand_voice",
|
|
@@ -1532,7 +1550,7 @@ const CONTEXT_TYPE_SQL = [
|
|
|
1532
1550
|
* marking old entries non-current and linking replacements through
|
|
1533
1551
|
* `supersedes_id`.
|
|
1534
1552
|
*/
|
|
1535
|
-
async function up$
|
|
1553
|
+
async function up$12(db) {
|
|
1536
1554
|
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(db))).addColumn("updated_at", "text", (col) => col.notNull().defaultTo(currentTimestamp(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();
|
|
1537
1555
|
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();
|
|
1538
1556
|
await db.schema.createIndex("idx_dineway_context_scope_current").on("_dineway_context_entries").columns([
|
|
@@ -1557,7 +1575,7 @@ async function up$9(db) {
|
|
|
1557
1575
|
await db.schema.createIndex("idx_dineway_context_created_at").on("_dineway_context_entries").column("created_at").execute();
|
|
1558
1576
|
await db.schema.createIndex("idx_dineway_context_tags_tag").on("_dineway_context_tags").columns(["tag", "context_entry_id"]).execute();
|
|
1559
1577
|
}
|
|
1560
|
-
async function down$
|
|
1578
|
+
async function down$12(db) {
|
|
1561
1579
|
await db.schema.dropTable("_dineway_context_tags").execute();
|
|
1562
1580
|
await db.schema.dropTable("_dineway_context_entries").execute();
|
|
1563
1581
|
}
|
|
@@ -1565,8 +1583,8 @@ async function down$9(db) {
|
|
|
1565
1583
|
//#endregion
|
|
1566
1584
|
//#region src/database/migrations/038_review_requests.ts
|
|
1567
1585
|
var _038_review_requests_exports = /* @__PURE__ */ __exportAll({
|
|
1568
|
-
down: () => down$
|
|
1569
|
-
up: () => up$
|
|
1586
|
+
down: () => down$11,
|
|
1587
|
+
up: () => up$11
|
|
1570
1588
|
});
|
|
1571
1589
|
/**
|
|
1572
1590
|
* Lightweight content review requests for Phase 5a.
|
|
@@ -1574,7 +1592,7 @@ var _038_review_requests_exports = /* @__PURE__ */ __exportAll({
|
|
|
1574
1592
|
* Review requests bind human approval to immutable content revision/action
|
|
1575
1593
|
* identifiers so an approval cannot be reused after the draft or action changes.
|
|
1576
1594
|
*/
|
|
1577
|
-
async function up$
|
|
1595
|
+
async function up$11(db) {
|
|
1578
1596
|
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(db))).addColumn("updated_at", "text", (col) => col.notNull().defaultTo(currentTimestamp(db))).addColumn("resolved_at", "text").execute();
|
|
1579
1597
|
await db.schema.createIndex("idx_dineway_review_status_created").on("_dineway_review_requests").columns(["status", "created_at"]).execute();
|
|
1580
1598
|
await db.schema.createIndex("idx_dineway_review_target").on("_dineway_review_requests").columns([
|
|
@@ -1595,15 +1613,15 @@ async function up$8(db) {
|
|
|
1595
1613
|
]).execute();
|
|
1596
1614
|
await db.schema.createIndex("idx_dineway_review_resolved_at").on("_dineway_review_requests").column("resolved_at").execute();
|
|
1597
1615
|
}
|
|
1598
|
-
async function down$
|
|
1616
|
+
async function down$11(db) {
|
|
1599
1617
|
await db.schema.dropTable("_dineway_review_requests").execute();
|
|
1600
1618
|
}
|
|
1601
1619
|
|
|
1602
1620
|
//#endregion
|
|
1603
1621
|
//#region src/database/migrations/039_entity_aliases.ts
|
|
1604
1622
|
var _039_entity_aliases_exports = /* @__PURE__ */ __exportAll({
|
|
1605
|
-
down: () => down$
|
|
1606
|
-
up: () => up$
|
|
1623
|
+
down: () => down$10,
|
|
1624
|
+
up: () => up$10
|
|
1607
1625
|
});
|
|
1608
1626
|
const ENTITY_ALIAS_TYPES = [
|
|
1609
1627
|
"content",
|
|
@@ -1618,7 +1636,7 @@ const ENTITY_ALIAS_TYPES = [
|
|
|
1618
1636
|
* This replaces CRMy's PostgreSQL-specific alias arrays with a normalized
|
|
1619
1637
|
* mapping table that works across SQLite/libSQL and PostgreSQL.
|
|
1620
1638
|
*/
|
|
1621
|
-
async function up$
|
|
1639
|
+
async function up$10(db) {
|
|
1622
1640
|
const entityTypesSql = sql.join(ENTITY_ALIAS_TYPES.map((value) => sql.lit(value)), sql`, `);
|
|
1623
1641
|
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(db))).execute();
|
|
1624
1642
|
await db.schema.createIndex("idx_dineway_entity_alias_lookup").on("_dineway_entity_aliases").columns(["entity_type", "normalized_alias"]).execute();
|
|
@@ -1635,15 +1653,15 @@ async function up$7(db) {
|
|
|
1635
1653
|
"normalized_alias"
|
|
1636
1654
|
]).unique().execute();
|
|
1637
1655
|
}
|
|
1638
|
-
async function down$
|
|
1656
|
+
async function down$10(db) {
|
|
1639
1657
|
await db.schema.dropTable("_dineway_entity_aliases").execute();
|
|
1640
1658
|
}
|
|
1641
1659
|
|
|
1642
1660
|
//#endregion
|
|
1643
1661
|
//#region src/database/migrations/040_handoff_snapshots.ts
|
|
1644
1662
|
var _040_handoff_snapshots_exports = /* @__PURE__ */ __exportAll({
|
|
1645
|
-
down: () => down$
|
|
1646
|
-
up: () => up$
|
|
1663
|
+
down: () => down$9,
|
|
1664
|
+
up: () => up$9
|
|
1647
1665
|
});
|
|
1648
1666
|
const ACTOR_TYPES$2 = [
|
|
1649
1667
|
"user",
|
|
@@ -1656,7 +1674,7 @@ const HANDOFF_KINDS = [
|
|
|
1656
1674
|
"assignment"
|
|
1657
1675
|
];
|
|
1658
1676
|
const REFERENCE_TYPES = ["review_request", "assignment"];
|
|
1659
|
-
async function up$
|
|
1677
|
+
async function up$9(db) {
|
|
1660
1678
|
const actorTypesSql = sql.join(ACTOR_TYPES$2.map((value) => sql.lit(value)), sql`, `);
|
|
1661
1679
|
const handoffKindsSql = sql.join(HANDOFF_KINDS.map((value) => sql.lit(value)), sql`, `);
|
|
1662
1680
|
const referenceTypesSql = sql.join(REFERENCE_TYPES.map((value) => sql.lit(value)), sql`, `);
|
|
@@ -1670,15 +1688,15 @@ async function up$6(db) {
|
|
|
1670
1688
|
await db.schema.createIndex("idx_dineway_handoff_kind_created").on("_dineway_handoff_snapshots").columns(["handoff_kind", "created_at"]).execute();
|
|
1671
1689
|
await db.schema.createIndex("idx_dineway_handoff_reference").on("_dineway_handoff_snapshots").columns(["reference_type", "reference_id"]).execute();
|
|
1672
1690
|
}
|
|
1673
|
-
async function down$
|
|
1691
|
+
async function down$9(db) {
|
|
1674
1692
|
await db.schema.dropTable("_dineway_handoff_snapshots").execute();
|
|
1675
1693
|
}
|
|
1676
1694
|
|
|
1677
1695
|
//#endregion
|
|
1678
1696
|
//#region src/database/migrations/041_assignments.ts
|
|
1679
1697
|
var _041_assignments_exports = /* @__PURE__ */ __exportAll({
|
|
1680
|
-
down: () => down$
|
|
1681
|
-
up: () => up$
|
|
1698
|
+
down: () => down$8,
|
|
1699
|
+
up: () => up$8
|
|
1682
1700
|
});
|
|
1683
1701
|
const ACTOR_TYPES$1 = [
|
|
1684
1702
|
"user",
|
|
@@ -1700,7 +1718,7 @@ const ASSIGNMENT_PRIORITIES = [
|
|
|
1700
1718
|
"high",
|
|
1701
1719
|
"urgent"
|
|
1702
1720
|
];
|
|
1703
|
-
async function up$
|
|
1721
|
+
async function up$8(db) {
|
|
1704
1722
|
const actorTypesSql = sql.join(ACTOR_TYPES$1.map((value) => sql.lit(value)), sql`, `);
|
|
1705
1723
|
const statusesSql = sql.join(ASSIGNMENT_STATUSES.map((value) => sql.lit(value)), sql`, `);
|
|
1706
1724
|
const prioritiesSql = sql.join(ASSIGNMENT_PRIORITIES.map((value) => sql.lit(value)), sql`, `);
|
|
@@ -1732,15 +1750,15 @@ async function up$5(db) {
|
|
|
1732
1750
|
await db.schema.createIndex("idx_dineway_assignment_due_at").on("_dineway_assignments").column("due_at").execute();
|
|
1733
1751
|
await db.schema.createIndex("idx_dineway_assignment_handoff").on("_dineway_assignments").column("related_handoff_snapshot_id").execute();
|
|
1734
1752
|
}
|
|
1735
|
-
async function down$
|
|
1753
|
+
async function down$8(db) {
|
|
1736
1754
|
await db.schema.dropTable("_dineway_assignments").execute();
|
|
1737
1755
|
}
|
|
1738
1756
|
|
|
1739
1757
|
//#endregion
|
|
1740
1758
|
//#region src/database/migrations/042_hitl_requests.ts
|
|
1741
1759
|
var _042_hitl_requests_exports = /* @__PURE__ */ __exportAll({
|
|
1742
|
-
down: () => down$
|
|
1743
|
-
up: () => up$
|
|
1760
|
+
down: () => down$7,
|
|
1761
|
+
up: () => up$7
|
|
1744
1762
|
});
|
|
1745
1763
|
const ACTOR_TYPES = [
|
|
1746
1764
|
"user",
|
|
@@ -1758,7 +1776,7 @@ const HITL_PRIORITIES = [
|
|
|
1758
1776
|
"high",
|
|
1759
1777
|
"urgent"
|
|
1760
1778
|
];
|
|
1761
|
-
async function up$
|
|
1779
|
+
async function up$7(db) {
|
|
1762
1780
|
const actorTypesSql = sql.join(ACTOR_TYPES.map((value) => sql.lit(value)), sql`, `);
|
|
1763
1781
|
const statusesSql = sql.join(HITL_STATUSES.map((value) => sql.lit(value)), sql`, `);
|
|
1764
1782
|
const prioritiesSql = sql.join(HITL_PRIORITIES.map((value) => sql.lit(value)), sql`, `);
|
|
@@ -1793,7 +1811,7 @@ async function up$4(db) {
|
|
|
1793
1811
|
await db.schema.createIndex("idx_dineway_hitl_sla_due_at").on("_dineway_hitl_requests").column("sla_due_at").execute();
|
|
1794
1812
|
await db.schema.createIndex("idx_dineway_assignment_hitl").on("_dineway_assignments").column("related_hitl_request_id").execute();
|
|
1795
1813
|
}
|
|
1796
|
-
async function down$
|
|
1814
|
+
async function down$7(db) {
|
|
1797
1815
|
await db.schema.dropIndex("idx_dineway_assignment_hitl").execute();
|
|
1798
1816
|
await db.schema.alterTable("_dineway_assignments").dropColumn("related_hitl_request_id").execute();
|
|
1799
1817
|
await db.schema.dropTable("_dineway_hitl_requests").execute();
|
|
@@ -1802,8 +1820,8 @@ async function down$4(db) {
|
|
|
1802
1820
|
//#endregion
|
|
1803
1821
|
//#region src/database/migrations/043_bounded_404_log.ts
|
|
1804
1822
|
var _043_bounded_404_log_exports = /* @__PURE__ */ __exportAll({
|
|
1805
|
-
down: () => down$
|
|
1806
|
-
up: () => up$
|
|
1823
|
+
down: () => down$6,
|
|
1824
|
+
up: () => up$6
|
|
1807
1825
|
});
|
|
1808
1826
|
/**
|
|
1809
1827
|
* Migration: Bounded 404 logging
|
|
@@ -1812,7 +1830,7 @@ var _043_bounded_404_log_exports = /* @__PURE__ */ __exportAll({
|
|
|
1812
1830
|
* Previously every 404 inserted a new row, so a requester could grow the
|
|
1813
1831
|
* table without bound by hitting unique URLs.
|
|
1814
1832
|
*/
|
|
1815
|
-
async function up$
|
|
1833
|
+
async function up$6(db) {
|
|
1816
1834
|
await db.schema.alterTable("_dineway_404_log").addColumn("hits", "integer", (col) => col.notNull().defaultTo(1)).execute();
|
|
1817
1835
|
await db.schema.alterTable("_dineway_404_log").addColumn("last_seen_at", "text").execute();
|
|
1818
1836
|
await sql`
|
|
@@ -1858,7 +1876,7 @@ async function up$3(db) {
|
|
|
1858
1876
|
await db.schema.dropIndex("idx_404_log_path").execute();
|
|
1859
1877
|
await db.schema.createIndex("idx_404_log_last_seen").on("_dineway_404_log").column("last_seen_at").execute();
|
|
1860
1878
|
}
|
|
1861
|
-
async function down$
|
|
1879
|
+
async function down$6(db) {
|
|
1862
1880
|
await db.schema.dropIndex("idx_404_log_last_seen").execute();
|
|
1863
1881
|
await db.schema.dropIndex("idx_404_log_path_unique").execute();
|
|
1864
1882
|
await db.schema.createIndex("idx_404_log_path").on("_dineway_404_log").column("path").execute();
|
|
@@ -1869,21 +1887,21 @@ async function down$3(db) {
|
|
|
1869
1887
|
//#endregion
|
|
1870
1888
|
//#region src/database/migrations/044_credential_algorithm.ts
|
|
1871
1889
|
var _044_credential_algorithm_exports = /* @__PURE__ */ __exportAll({
|
|
1872
|
-
down: () => down$
|
|
1873
|
-
up: () => up$
|
|
1890
|
+
down: () => down$5,
|
|
1891
|
+
up: () => up$5
|
|
1874
1892
|
});
|
|
1875
|
-
async function up$
|
|
1893
|
+
async function up$5(db) {
|
|
1876
1894
|
if (!await columnExists(db, "credentials", "algorithm")) await db.schema.alterTable("credentials").addColumn("algorithm", "integer", (col) => col.notNull().defaultTo(-7)).execute();
|
|
1877
1895
|
}
|
|
1878
|
-
async function down$
|
|
1896
|
+
async function down$5(db) {
|
|
1879
1897
|
if (await columnExists(db, "credentials", "algorithm")) await db.schema.alterTable("credentials").dropColumn("algorithm").execute();
|
|
1880
1898
|
}
|
|
1881
1899
|
|
|
1882
1900
|
//#endregion
|
|
1883
1901
|
//#region src/database/migrations/045_i18n_menus_and_taxonomies.ts
|
|
1884
1902
|
var _045_i18n_menus_and_taxonomies_exports = /* @__PURE__ */ __exportAll({
|
|
1885
|
-
down: () => down$
|
|
1886
|
-
up: () => up$
|
|
1903
|
+
down: () => down$4,
|
|
1904
|
+
up: () => up$4
|
|
1887
1905
|
});
|
|
1888
1906
|
/**
|
|
1889
1907
|
* i18n for menus + taxonomies. Adds `locale` + `translation_group` to system
|
|
@@ -1891,11 +1909,11 @@ var _045_i18n_menus_and_taxonomies_exports = /* @__PURE__ */ __exportAll({
|
|
|
1891
1909
|
* `_dineway_menu_items.reference_id` and `content_taxonomies.taxonomy_id`.
|
|
1892
1910
|
* Backfill locale and column DEFAULTs use the site's configured defaultLocale.
|
|
1893
1911
|
*/
|
|
1894
|
-
function getDefaultLocale() {
|
|
1912
|
+
function getDefaultLocale$1() {
|
|
1895
1913
|
return getI18nConfig()?.defaultLocale ?? "en";
|
|
1896
1914
|
}
|
|
1897
|
-
async function up$
|
|
1898
|
-
const defaultLocale = getDefaultLocale();
|
|
1915
|
+
async function up$4(db) {
|
|
1916
|
+
const defaultLocale = getDefaultLocale$1();
|
|
1899
1917
|
if (isSqlite(db)) {
|
|
1900
1918
|
await sql.raw(`PRAGMA foreign_keys = OFF`).execute(db);
|
|
1901
1919
|
try {
|
|
@@ -1922,7 +1940,7 @@ async function up$1(db) {
|
|
|
1922
1940
|
await remapMenuItemRefs(db);
|
|
1923
1941
|
}
|
|
1924
1942
|
async function rebuildMenus(db, defaultLocale) {
|
|
1925
|
-
if (await hasColumn(db, "_dineway_menus", "locale")) return;
|
|
1943
|
+
if (await hasColumn$1(db, "_dineway_menus", "locale")) return;
|
|
1926
1944
|
await sql.raw(`DROP TABLE IF EXISTS "_dineway_menus_new"`).execute(db);
|
|
1927
1945
|
await db.schema.createTable("_dineway_menus_new").addColumn("id", "text", (c) => c.primaryKey()).addColumn("name", "text", (c) => c.notNull()).addColumn("label", "text", (c) => c.notNull()).addColumn("created_at", "text", (c) => c.defaultTo(currentTimestamp(db))).addColumn("updated_at", "text", (c) => c.defaultTo(currentTimestamp(db))).addColumn("locale", "text", (c) => c.notNull().defaultTo(defaultLocale)).addColumn("translation_group", "text").addUniqueConstraint("_dineway_menus_name_locale_unique", ["name", "locale"]).execute();
|
|
1928
1946
|
await sql`
|
|
@@ -1935,7 +1953,7 @@ async function rebuildMenus(db, defaultLocale) {
|
|
|
1935
1953
|
await db.schema.createIndex("idx__dineway_menus_translation_group").on("_dineway_menus").column("translation_group").execute();
|
|
1936
1954
|
}
|
|
1937
1955
|
async function addItemColumns(db, defaultLocale) {
|
|
1938
|
-
if (await hasColumn(db, "_dineway_menu_items", "locale")) return;
|
|
1956
|
+
if (await hasColumn$1(db, "_dineway_menu_items", "locale")) return;
|
|
1939
1957
|
await db.schema.alterTable("_dineway_menu_items").addColumn("locale", "text", (c) => c.notNull().defaultTo(defaultLocale)).execute();
|
|
1940
1958
|
await db.schema.alterTable("_dineway_menu_items").addColumn("translation_group", "text").execute();
|
|
1941
1959
|
await sql`UPDATE _dineway_menu_items SET translation_group = id`.execute(db);
|
|
@@ -1943,7 +1961,7 @@ async function addItemColumns(db, defaultLocale) {
|
|
|
1943
1961
|
await db.schema.createIndex("idx__dineway_menu_items_translation_group").on("_dineway_menu_items").column("translation_group").execute();
|
|
1944
1962
|
}
|
|
1945
1963
|
async function rebuildTaxonomies(db, defaultLocale) {
|
|
1946
|
-
if (await hasColumn(db, "taxonomies", "locale")) return;
|
|
1964
|
+
if (await hasColumn$1(db, "taxonomies", "locale")) return;
|
|
1947
1965
|
await sql.raw(`DROP TABLE IF EXISTS "taxonomies_new"`).execute(db);
|
|
1948
1966
|
await sql`DROP INDEX IF EXISTS idx_taxonomies_name`.execute(db);
|
|
1949
1967
|
await db.schema.createTable("taxonomies_new").addColumn("id", "text", (c) => c.primaryKey()).addColumn("name", "text", (c) => c.notNull()).addColumn("slug", "text", (c) => c.notNull()).addColumn("label", "text", (c) => c.notNull()).addColumn("parent_id", "text").addColumn("data", "text").addColumn("locale", "text", (c) => c.notNull().defaultTo(defaultLocale)).addColumn("translation_group", "text").addUniqueConstraint("taxonomies_name_slug_locale_unique", [
|
|
@@ -1962,7 +1980,7 @@ async function rebuildTaxonomies(db, defaultLocale) {
|
|
|
1962
1980
|
await db.schema.createIndex("idx_taxonomies_translation_group").on("taxonomies").column("translation_group").execute();
|
|
1963
1981
|
}
|
|
1964
1982
|
async function rebuildTaxonomyDefs(db, defaultLocale) {
|
|
1965
|
-
if (await hasColumn(db, "_dineway_taxonomy_defs", "locale")) return;
|
|
1983
|
+
if (await hasColumn$1(db, "_dineway_taxonomy_defs", "locale")) return;
|
|
1966
1984
|
await sql.raw(`DROP TABLE IF EXISTS "_dineway_taxonomy_defs_new"`).execute(db);
|
|
1967
1985
|
await db.schema.createTable("_dineway_taxonomy_defs_new").addColumn("id", "text", (c) => c.primaryKey()).addColumn("name", "text", (c) => c.notNull()).addColumn("label", "text", (c) => c.notNull()).addColumn("label_singular", "text").addColumn("hierarchical", "integer", (c) => c.defaultTo(0)).addColumn("collections", "text").addColumn("created_at", "text", (c) => c.defaultTo(currentTimestamp(db))).addColumn("locale", "text", (c) => c.notNull().defaultTo(defaultLocale)).addColumn("translation_group", "text").addUniqueConstraint("_dineway_taxonomy_defs_name_locale_unique", ["name", "locale"]).execute();
|
|
1968
1986
|
await sql`
|
|
@@ -2057,7 +2075,7 @@ async function pgRemapContentTaxonomies(db) {
|
|
|
2057
2075
|
FROM taxonomies t WHERE t.id = content_taxonomies.taxonomy_id
|
|
2058
2076
|
`.execute(db);
|
|
2059
2077
|
}
|
|
2060
|
-
async function hasColumn(db, table, column) {
|
|
2078
|
+
async function hasColumn$1(db, table, column) {
|
|
2061
2079
|
return (await sql`PRAGMA table_info(${sql.ref(table)})`.execute(db)).rows.some((r) => r.name === column);
|
|
2062
2080
|
}
|
|
2063
2081
|
const SYSTEM_IDENT = /^[_a-z][a-z0-9_]*$/;
|
|
@@ -2069,7 +2087,7 @@ function validateSystemIdent(name) {
|
|
|
2069
2087
|
* translated rows onto an ambiguous unique key). Refuse to run when any row
|
|
2070
2088
|
* sits at a locale other than the configured defaultLocale.
|
|
2071
2089
|
*/
|
|
2072
|
-
async function assertSingleLocale(db, defaultLocale) {
|
|
2090
|
+
async function assertSingleLocale$1(db, defaultLocale) {
|
|
2073
2091
|
for (const table of [
|
|
2074
2092
|
"_dineway_menus",
|
|
2075
2093
|
"_dineway_menu_items",
|
|
@@ -2084,9 +2102,9 @@ async function assertSingleLocale(db, defaultLocale) {
|
|
|
2084
2102
|
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.`);
|
|
2085
2103
|
}
|
|
2086
2104
|
}
|
|
2087
|
-
async function down$
|
|
2088
|
-
const defaultLocale = getDefaultLocale();
|
|
2089
|
-
await assertSingleLocale(db, defaultLocale);
|
|
2105
|
+
async function down$4(db) {
|
|
2106
|
+
const defaultLocale = getDefaultLocale$1();
|
|
2107
|
+
await assertSingleLocale$1(db, defaultLocale);
|
|
2090
2108
|
const widenedTables = [
|
|
2091
2109
|
"_dineway_menus",
|
|
2092
2110
|
"_dineway_menu_items",
|
|
@@ -2177,14 +2195,371 @@ async function rebuildTaxonomyDefsDown(db) {
|
|
|
2177
2195
|
//#endregion
|
|
2178
2196
|
//#region src/database/migrations/046_astro_sessions.ts
|
|
2179
2197
|
var _046_astro_sessions_exports = /* @__PURE__ */ __exportAll({
|
|
2198
|
+
down: () => down$3,
|
|
2199
|
+
up: () => up$3
|
|
2200
|
+
});
|
|
2201
|
+
async function up$3(db) {
|
|
2202
|
+
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(db))).execute();
|
|
2203
|
+
}
|
|
2204
|
+
async function down$3(db) {
|
|
2205
|
+
await db.schema.dropTable("_dineway_sessions").ifExists().execute();
|
|
2206
|
+
}
|
|
2207
|
+
|
|
2208
|
+
//#endregion
|
|
2209
|
+
//#region src/database/migrations/047_content_locale_list_index.ts
|
|
2210
|
+
var _047_content_locale_list_index_exports = /* @__PURE__ */ __exportAll({
|
|
2211
|
+
down: () => down$2,
|
|
2212
|
+
up: () => up$2
|
|
2213
|
+
});
|
|
2214
|
+
/**
|
|
2215
|
+
* Add locale-aware composite indexes for content list queries.
|
|
2216
|
+
*
|
|
2217
|
+
* When i18n is enabled the admin content list filters by locale and orders by
|
|
2218
|
+
* updated_at/created_at. The existing composite indexes cover the ordered list
|
|
2219
|
+
* path but omit locale, so locale-filtered lists cannot be served by one index
|
|
2220
|
+
* on large tables.
|
|
2221
|
+
*/
|
|
2222
|
+
async function up$2(db) {
|
|
2223
|
+
const tableNames = await listTablesLike(db, "ec_%");
|
|
2224
|
+
for (const tableName of tableNames) {
|
|
2225
|
+
await sql`
|
|
2226
|
+
CREATE INDEX IF NOT EXISTS ${sql.ref(contentLocaleUpdatedIndexName(tableName))}
|
|
2227
|
+
ON ${sql.ref(tableName)} (deleted_at, locale, updated_at DESC, id DESC)
|
|
2228
|
+
`.execute(db);
|
|
2229
|
+
await sql`
|
|
2230
|
+
CREATE INDEX IF NOT EXISTS ${sql.ref(contentLocaleCreatedIndexName(tableName))}
|
|
2231
|
+
ON ${sql.ref(tableName)} (deleted_at, locale, created_at DESC, id DESC)
|
|
2232
|
+
`.execute(db);
|
|
2233
|
+
}
|
|
2234
|
+
}
|
|
2235
|
+
async function down$2(db) {
|
|
2236
|
+
const tableNames = await listTablesLike(db, "ec_%");
|
|
2237
|
+
for (const tableName of tableNames) {
|
|
2238
|
+
await sql`DROP INDEX IF EXISTS ${sql.ref(contentLocaleUpdatedIndexName(tableName))}`.execute(db);
|
|
2239
|
+
await sql`DROP INDEX IF EXISTS ${sql.ref(contentLocaleCreatedIndexName(tableName))}`.execute(db);
|
|
2240
|
+
}
|
|
2241
|
+
}
|
|
2242
|
+
|
|
2243
|
+
//#endregion
|
|
2244
|
+
//#region src/database/migrations/048_byline_i18n.ts
|
|
2245
|
+
var _048_byline_i18n_exports = /* @__PURE__ */ __exportAll({
|
|
2246
|
+
down: () => down$1,
|
|
2247
|
+
up: () => up$1
|
|
2248
|
+
});
|
|
2249
|
+
/**
|
|
2250
|
+
* Adds row-per-locale bylines.
|
|
2251
|
+
*
|
|
2252
|
+
* Bylines are stored as one row per locale variant. Rows that translate the
|
|
2253
|
+
* same profile share `translation_group`, and content credit tables store that
|
|
2254
|
+
* group rather than a specific byline row id. Rendering remains strict per
|
|
2255
|
+
* locale: a credit appears only when a byline row exists for the entry locale.
|
|
2256
|
+
*/
|
|
2257
|
+
function getDefaultLocale() {
|
|
2258
|
+
return getI18nConfig()?.defaultLocale ?? "en";
|
|
2259
|
+
}
|
|
2260
|
+
async function up$1(db) {
|
|
2261
|
+
const defaultLocale = getDefaultLocale();
|
|
2262
|
+
if (isSqlite(db)) {
|
|
2263
|
+
await rebuildContentBylines(db);
|
|
2264
|
+
await rebuildBylines(db, defaultLocale);
|
|
2265
|
+
await remapPrimaryBylineIds(db);
|
|
2266
|
+
return;
|
|
2267
|
+
}
|
|
2268
|
+
await pgWidenBylines(db, defaultLocale);
|
|
2269
|
+
await pgDropContentBylinesFk(db);
|
|
2270
|
+
await remapPrimaryBylineIds(db);
|
|
2271
|
+
}
|
|
2272
|
+
async function rebuildContentBylines(db) {
|
|
2273
|
+
if ((await sql`PRAGMA foreign_key_list(_dineway_content_bylines)`.execute(db)).rows.length === 0) return;
|
|
2274
|
+
await sql.raw(`DROP TABLE IF EXISTS "_dineway_content_bylines_new"`).execute(db);
|
|
2275
|
+
await db.schema.createTable("_dineway_content_bylines_new").addColumn("id", "text", (c) => c.primaryKey()).addColumn("collection_slug", "text", (c) => c.notNull()).addColumn("content_id", "text", (c) => c.notNull()).addColumn("byline_id", "text", (c) => c.notNull()).addColumn("sort_order", "integer", (c) => c.notNull().defaultTo(0)).addColumn("role_label", "text").addColumn("created_at", "text", (c) => c.defaultTo(currentTimestamp(db))).addUniqueConstraint("content_bylines_unique", [
|
|
2276
|
+
"collection_slug",
|
|
2277
|
+
"content_id",
|
|
2278
|
+
"byline_id"
|
|
2279
|
+
]).execute();
|
|
2280
|
+
await sql`
|
|
2281
|
+
INSERT INTO _dineway_content_bylines_new
|
|
2282
|
+
(id, collection_slug, content_id, byline_id, sort_order, role_label, created_at)
|
|
2283
|
+
SELECT id, collection_slug, content_id, byline_id, sort_order, role_label, created_at
|
|
2284
|
+
FROM _dineway_content_bylines
|
|
2285
|
+
`.execute(db);
|
|
2286
|
+
await db.schema.dropTable("_dineway_content_bylines").execute();
|
|
2287
|
+
await sql`
|
|
2288
|
+
ALTER TABLE _dineway_content_bylines_new
|
|
2289
|
+
RENAME TO _dineway_content_bylines
|
|
2290
|
+
`.execute(db);
|
|
2291
|
+
await db.schema.createIndex("idx_content_bylines_content").on("_dineway_content_bylines").columns([
|
|
2292
|
+
"collection_slug",
|
|
2293
|
+
"content_id",
|
|
2294
|
+
"sort_order"
|
|
2295
|
+
]).execute();
|
|
2296
|
+
await db.schema.createIndex("idx_content_bylines_byline").on("_dineway_content_bylines").column("byline_id").execute();
|
|
2297
|
+
}
|
|
2298
|
+
async function rebuildBylines(db, defaultLocale) {
|
|
2299
|
+
if (await hasColumn(db, "_dineway_bylines", "locale")) return;
|
|
2300
|
+
await sql.raw(`DROP TABLE IF EXISTS "_dineway_bylines_new"`).execute(db);
|
|
2301
|
+
await db.schema.createTable("_dineway_bylines_new").addColumn("id", "text", (c) => c.primaryKey()).addColumn("slug", "text", (c) => c.notNull()).addColumn("display_name", "text", (c) => c.notNull()).addColumn("bio", "text").addColumn("avatar_media_id", "text", (c) => c.references("media.id").onDelete("set null")).addColumn("website_url", "text").addColumn("user_id", "text", (c) => c.references("users.id").onDelete("set null")).addColumn("is_guest", "integer", (c) => c.notNull().defaultTo(0)).addColumn("created_at", "text", (c) => c.defaultTo(currentTimestamp(db))).addColumn("updated_at", "text", (c) => c.defaultTo(currentTimestamp(db))).addColumn("locale", "text", (c) => c.notNull().defaultTo(defaultLocale)).addColumn("translation_group", "text").addUniqueConstraint("_dineway_bylines_slug_locale_unique", ["slug", "locale"]).execute();
|
|
2302
|
+
await sql`
|
|
2303
|
+
INSERT INTO _dineway_bylines_new (
|
|
2304
|
+
id, slug, display_name, bio, avatar_media_id, website_url,
|
|
2305
|
+
user_id, is_guest, created_at, updated_at, locale, translation_group
|
|
2306
|
+
)
|
|
2307
|
+
SELECT
|
|
2308
|
+
id, slug, display_name, bio, avatar_media_id, website_url,
|
|
2309
|
+
user_id, is_guest, created_at, updated_at, ${defaultLocale}, id
|
|
2310
|
+
FROM _dineway_bylines
|
|
2311
|
+
`.execute(db);
|
|
2312
|
+
await db.schema.dropTable("_dineway_bylines").execute();
|
|
2313
|
+
await sql`ALTER TABLE _dineway_bylines_new RENAME TO _dineway_bylines`.execute(db);
|
|
2314
|
+
await db.schema.createIndex("idx_bylines_slug").on("_dineway_bylines").column("slug").execute();
|
|
2315
|
+
await db.schema.createIndex("idx_bylines_display_name").on("_dineway_bylines").column("display_name").execute();
|
|
2316
|
+
await sql`
|
|
2317
|
+
CREATE UNIQUE INDEX ${sql.ref("idx_bylines_user_id_locale_unique")}
|
|
2318
|
+
ON ${sql.ref("_dineway_bylines")} (user_id, locale)
|
|
2319
|
+
WHERE user_id IS NOT NULL
|
|
2320
|
+
`.execute(db);
|
|
2321
|
+
await db.schema.createIndex("idx__dineway_bylines_locale").on("_dineway_bylines").column("locale").execute();
|
|
2322
|
+
await db.schema.createIndex("idx__dineway_bylines_translation_group").on("_dineway_bylines").column("translation_group").execute();
|
|
2323
|
+
await sql`
|
|
2324
|
+
CREATE UNIQUE INDEX ${sql.ref("idx_bylines_group_locale_unique")}
|
|
2325
|
+
ON ${sql.ref("_dineway_bylines")} (translation_group, locale)
|
|
2326
|
+
WHERE translation_group IS NOT NULL
|
|
2327
|
+
`.execute(db);
|
|
2328
|
+
}
|
|
2329
|
+
async function remapPrimaryBylineIds(db) {
|
|
2330
|
+
const collections = await listTablesLike(db, "ec_%");
|
|
2331
|
+
for (const table of collections) {
|
|
2332
|
+
validateIdentifier(table, "content table");
|
|
2333
|
+
await sql`
|
|
2334
|
+
UPDATE ${sql.ref(table)}
|
|
2335
|
+
SET primary_byline_id = (
|
|
2336
|
+
SELECT translation_group FROM _dineway_bylines
|
|
2337
|
+
WHERE _dineway_bylines.id = ${sql.ref(table)}.primary_byline_id
|
|
2338
|
+
)
|
|
2339
|
+
WHERE primary_byline_id IS NOT NULL
|
|
2340
|
+
AND EXISTS (
|
|
2341
|
+
SELECT 1 FROM _dineway_bylines
|
|
2342
|
+
WHERE _dineway_bylines.id = ${sql.ref(table)}.primary_byline_id
|
|
2343
|
+
)
|
|
2344
|
+
`.execute(db);
|
|
2345
|
+
}
|
|
2346
|
+
}
|
|
2347
|
+
async function pgWidenBylines(db, defaultLocale) {
|
|
2348
|
+
const ref = sql.ref("_dineway_bylines");
|
|
2349
|
+
await sql`
|
|
2350
|
+
ALTER TABLE ${ref}
|
|
2351
|
+
ADD COLUMN IF NOT EXISTS locale TEXT NOT NULL DEFAULT ${sql.lit(defaultLocale)}
|
|
2352
|
+
`.execute(db);
|
|
2353
|
+
await sql`ALTER TABLE ${ref} ADD COLUMN IF NOT EXISTS translation_group TEXT`.execute(db);
|
|
2354
|
+
await sql`UPDATE ${ref} SET translation_group = id WHERE translation_group IS NULL`.execute(db);
|
|
2355
|
+
await sql`
|
|
2356
|
+
CREATE INDEX IF NOT EXISTS ${sql.ref("idx__dineway_bylines_locale")}
|
|
2357
|
+
ON ${ref} (locale)
|
|
2358
|
+
`.execute(db);
|
|
2359
|
+
await sql`
|
|
2360
|
+
CREATE INDEX IF NOT EXISTS ${sql.ref("idx__dineway_bylines_translation_group")}
|
|
2361
|
+
ON ${ref} (translation_group)
|
|
2362
|
+
`.execute(db);
|
|
2363
|
+
const slugConstraints = await sql`
|
|
2364
|
+
SELECT conname FROM pg_constraint c
|
|
2365
|
+
WHERE c.conrelid = '_dineway_bylines'::regclass AND c.contype = 'u'
|
|
2366
|
+
AND array_length(c.conkey, 1) = 1
|
|
2367
|
+
AND (
|
|
2368
|
+
SELECT array_agg(a.attname ORDER BY pos.ord)
|
|
2369
|
+
FROM unnest(c.conkey) WITH ORDINALITY AS pos(attnum, ord)
|
|
2370
|
+
JOIN pg_attribute a ON a.attrelid = c.conrelid AND a.attnum = pos.attnum
|
|
2371
|
+
)::text[] = ARRAY['slug']
|
|
2372
|
+
`.execute(db);
|
|
2373
|
+
for (const constraint of slugConstraints.rows) await sql`ALTER TABLE ${ref} DROP CONSTRAINT ${sql.ref(constraint.conname)}`.execute(db);
|
|
2374
|
+
await sql`
|
|
2375
|
+
ALTER TABLE ${ref}
|
|
2376
|
+
ADD CONSTRAINT _dineway_bylines_slug_locale_unique UNIQUE (slug, locale)
|
|
2377
|
+
`.execute(db);
|
|
2378
|
+
await sql`DROP INDEX IF EXISTS idx_bylines_user_id_unique`.execute(db);
|
|
2379
|
+
await sql`
|
|
2380
|
+
CREATE UNIQUE INDEX IF NOT EXISTS ${sql.ref("idx_bylines_user_id_locale_unique")}
|
|
2381
|
+
ON ${ref} (user_id, locale) WHERE user_id IS NOT NULL
|
|
2382
|
+
`.execute(db);
|
|
2383
|
+
await sql`
|
|
2384
|
+
CREATE UNIQUE INDEX IF NOT EXISTS ${sql.ref("idx_bylines_group_locale_unique")}
|
|
2385
|
+
ON ${ref} (translation_group, locale) WHERE translation_group IS NOT NULL
|
|
2386
|
+
`.execute(db);
|
|
2387
|
+
}
|
|
2388
|
+
async function pgDropContentBylinesFk(db) {
|
|
2389
|
+
const fks = await sql`
|
|
2390
|
+
SELECT conname FROM pg_constraint
|
|
2391
|
+
WHERE conrelid = '_dineway_content_bylines'::regclass AND contype = 'f'
|
|
2392
|
+
`.execute(db);
|
|
2393
|
+
for (const fk of fks.rows) await sql`
|
|
2394
|
+
ALTER TABLE _dineway_content_bylines
|
|
2395
|
+
DROP CONSTRAINT ${sql.ref(fk.conname)}
|
|
2396
|
+
`.execute(db);
|
|
2397
|
+
}
|
|
2398
|
+
async function hasColumn(db, table, column) {
|
|
2399
|
+
return (await sql`PRAGMA table_info(${sql.ref(table)})`.execute(db)).rows.some((r) => r.name === column);
|
|
2400
|
+
}
|
|
2401
|
+
async function assertContentBylinesResolve(db, defaultLocale) {
|
|
2402
|
+
const result = await sql`
|
|
2403
|
+
SELECT COUNT(*) AS count FROM _dineway_content_bylines cb
|
|
2404
|
+
WHERE NOT EXISTS (
|
|
2405
|
+
SELECT 1 FROM _dineway_bylines b
|
|
2406
|
+
WHERE b.translation_group = cb.byline_id AND b.locale = ${defaultLocale}
|
|
2407
|
+
)
|
|
2408
|
+
`.execute(db);
|
|
2409
|
+
const count = Number(result.rows[0]?.count ?? 0);
|
|
2410
|
+
if (count > 0) throw new Error(`Cannot revert migration 048_byline_i18n: ${count} row(s) in "_dineway_content_bylines" reference a translation group with no "_dineway_bylines" row at locale="${defaultLocale}".`);
|
|
2411
|
+
}
|
|
2412
|
+
async function assertSingleLocale(db, defaultLocale) {
|
|
2413
|
+
const result = await sql`
|
|
2414
|
+
SELECT COUNT(*) AS count FROM _dineway_bylines WHERE locale != ${defaultLocale}
|
|
2415
|
+
`.execute(db);
|
|
2416
|
+
const count = Number(result.rows[0]?.count ?? 0);
|
|
2417
|
+
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}").`);
|
|
2418
|
+
}
|
|
2419
|
+
async function down$1(db) {
|
|
2420
|
+
const defaultLocale = getDefaultLocale();
|
|
2421
|
+
await assertSingleLocale(db, defaultLocale);
|
|
2422
|
+
await assertContentBylinesResolve(db, defaultLocale);
|
|
2423
|
+
if (isSqlite(db)) {
|
|
2424
|
+
await sql.raw(`DROP INDEX IF EXISTS idx__dineway_bylines_locale`).execute(db);
|
|
2425
|
+
await sql.raw(`DROP INDEX IF EXISTS idx__dineway_bylines_translation_group`).execute(db);
|
|
2426
|
+
await sql.raw(`DROP INDEX IF EXISTS idx_bylines_user_id_locale_unique`).execute(db);
|
|
2427
|
+
await sql.raw(`DROP INDEX IF EXISTS idx_bylines_group_locale_unique`).execute(db);
|
|
2428
|
+
await remapPrimaryBylineIdsDown(db, defaultLocale);
|
|
2429
|
+
await remapContentBylinesDown(db, defaultLocale);
|
|
2430
|
+
await rebuildBylinesDown(db);
|
|
2431
|
+
await restoreContentBylinesFk(db);
|
|
2432
|
+
return;
|
|
2433
|
+
}
|
|
2434
|
+
await remapPrimaryBylineIdsDown(db, defaultLocale);
|
|
2435
|
+
await sql`
|
|
2436
|
+
UPDATE _dineway_content_bylines
|
|
2437
|
+
SET byline_id = COALESCE(
|
|
2438
|
+
(SELECT b.id FROM _dineway_bylines b
|
|
2439
|
+
WHERE b.translation_group = _dineway_content_bylines.byline_id
|
|
2440
|
+
AND b.locale = ${defaultLocale}),
|
|
2441
|
+
byline_id
|
|
2442
|
+
)
|
|
2443
|
+
`.execute(db);
|
|
2444
|
+
await sql.raw(`DROP INDEX IF EXISTS idx__dineway_bylines_locale`).execute(db);
|
|
2445
|
+
await sql.raw(`DROP INDEX IF EXISTS idx__dineway_bylines_translation_group`).execute(db);
|
|
2446
|
+
await sql.raw(`DROP INDEX IF EXISTS idx_bylines_user_id_locale_unique`).execute(db);
|
|
2447
|
+
await sql.raw(`DROP INDEX IF EXISTS idx_bylines_group_locale_unique`).execute(db);
|
|
2448
|
+
await sql.raw(`ALTER TABLE "_dineway_bylines" DROP CONSTRAINT IF EXISTS _dineway_bylines_slug_locale_unique`).execute(db);
|
|
2449
|
+
await sql.raw(`ALTER TABLE "_dineway_bylines" DROP COLUMN IF EXISTS locale`).execute(db);
|
|
2450
|
+
await sql.raw(`ALTER TABLE "_dineway_bylines" DROP COLUMN IF EXISTS translation_group`).execute(db);
|
|
2451
|
+
await sql.raw(`ALTER TABLE "_dineway_bylines" ADD CONSTRAINT _dineway_bylines_slug_unique UNIQUE (slug)`).execute(db);
|
|
2452
|
+
await sql`
|
|
2453
|
+
CREATE UNIQUE INDEX IF NOT EXISTS ${sql.ref("idx_bylines_user_id_unique")}
|
|
2454
|
+
ON _dineway_bylines (user_id) WHERE user_id IS NOT NULL
|
|
2455
|
+
`.execute(db);
|
|
2456
|
+
await sql`
|
|
2457
|
+
ALTER TABLE _dineway_content_bylines
|
|
2458
|
+
ADD CONSTRAINT _dineway_content_bylines_byline_fk
|
|
2459
|
+
FOREIGN KEY (byline_id) REFERENCES _dineway_bylines(id) ON DELETE CASCADE
|
|
2460
|
+
`.execute(db);
|
|
2461
|
+
}
|
|
2462
|
+
async function remapPrimaryBylineIdsDown(db, defaultLocale) {
|
|
2463
|
+
const collections = await listTablesLike(db, "ec_%");
|
|
2464
|
+
for (const table of collections) {
|
|
2465
|
+
validateIdentifier(table, "content table");
|
|
2466
|
+
await sql`
|
|
2467
|
+
UPDATE ${sql.ref(table)}
|
|
2468
|
+
SET primary_byline_id = COALESCE(
|
|
2469
|
+
(SELECT b.id FROM _dineway_bylines b
|
|
2470
|
+
WHERE b.translation_group = ${sql.ref(table)}.primary_byline_id
|
|
2471
|
+
AND b.locale = ${defaultLocale}),
|
|
2472
|
+
primary_byline_id
|
|
2473
|
+
)
|
|
2474
|
+
WHERE primary_byline_id IS NOT NULL
|
|
2475
|
+
`.execute(db);
|
|
2476
|
+
}
|
|
2477
|
+
}
|
|
2478
|
+
async function remapContentBylinesDown(db, defaultLocale) {
|
|
2479
|
+
await sql`
|
|
2480
|
+
UPDATE _dineway_content_bylines
|
|
2481
|
+
SET byline_id = COALESCE(
|
|
2482
|
+
(SELECT b.id FROM _dineway_bylines b
|
|
2483
|
+
WHERE b.translation_group = _dineway_content_bylines.byline_id
|
|
2484
|
+
AND b.locale = ${defaultLocale}),
|
|
2485
|
+
byline_id
|
|
2486
|
+
)
|
|
2487
|
+
`.execute(db);
|
|
2488
|
+
}
|
|
2489
|
+
async function rebuildBylinesDown(db) {
|
|
2490
|
+
await sql.raw(`DROP TABLE IF EXISTS "_dineway_bylines_old"`).execute(db);
|
|
2491
|
+
await db.schema.createTable("_dineway_bylines_old").addColumn("id", "text", (c) => c.primaryKey()).addColumn("slug", "text", (c) => c.notNull().unique()).addColumn("display_name", "text", (c) => c.notNull()).addColumn("bio", "text").addColumn("avatar_media_id", "text", (c) => c.references("media.id").onDelete("set null")).addColumn("website_url", "text").addColumn("user_id", "text", (c) => c.references("users.id").onDelete("set null")).addColumn("is_guest", "integer", (c) => c.notNull().defaultTo(0)).addColumn("created_at", "text", (c) => c.defaultTo(currentTimestamp(db))).addColumn("updated_at", "text", (c) => c.defaultTo(currentTimestamp(db))).execute();
|
|
2492
|
+
await sql`
|
|
2493
|
+
INSERT INTO _dineway_bylines_old (
|
|
2494
|
+
id, slug, display_name, bio, avatar_media_id, website_url,
|
|
2495
|
+
user_id, is_guest, created_at, updated_at
|
|
2496
|
+
)
|
|
2497
|
+
SELECT
|
|
2498
|
+
id, slug, display_name, bio, avatar_media_id, website_url,
|
|
2499
|
+
user_id, is_guest, created_at, updated_at
|
|
2500
|
+
FROM _dineway_bylines
|
|
2501
|
+
`.execute(db);
|
|
2502
|
+
await db.schema.dropTable("_dineway_bylines").execute();
|
|
2503
|
+
await sql`ALTER TABLE _dineway_bylines_old RENAME TO _dineway_bylines`.execute(db);
|
|
2504
|
+
await db.schema.createIndex("idx_bylines_slug").on("_dineway_bylines").column("slug").execute();
|
|
2505
|
+
await db.schema.createIndex("idx_bylines_display_name").on("_dineway_bylines").column("display_name").execute();
|
|
2506
|
+
await sql`
|
|
2507
|
+
CREATE UNIQUE INDEX ${sql.ref("idx_bylines_user_id_unique")}
|
|
2508
|
+
ON ${sql.ref("_dineway_bylines")} (user_id)
|
|
2509
|
+
WHERE user_id IS NOT NULL
|
|
2510
|
+
`.execute(db);
|
|
2511
|
+
}
|
|
2512
|
+
async function restoreContentBylinesFk(db) {
|
|
2513
|
+
await sql.raw(`DROP TABLE IF EXISTS "_dineway_content_bylines_old"`).execute(db);
|
|
2514
|
+
await db.schema.createTable("_dineway_content_bylines_old").addColumn("id", "text", (c) => c.primaryKey()).addColumn("collection_slug", "text", (c) => c.notNull()).addColumn("content_id", "text", (c) => c.notNull()).addColumn("byline_id", "text", (c) => c.notNull().references("_dineway_bylines.id").onDelete("cascade")).addColumn("sort_order", "integer", (c) => c.notNull().defaultTo(0)).addColumn("role_label", "text").addColumn("created_at", "text", (c) => c.defaultTo(currentTimestamp(db))).addUniqueConstraint("content_bylines_unique", [
|
|
2515
|
+
"collection_slug",
|
|
2516
|
+
"content_id",
|
|
2517
|
+
"byline_id"
|
|
2518
|
+
]).execute();
|
|
2519
|
+
await sql`
|
|
2520
|
+
INSERT INTO _dineway_content_bylines_old
|
|
2521
|
+
(id, collection_slug, content_id, byline_id, sort_order, role_label, created_at)
|
|
2522
|
+
SELECT id, collection_slug, content_id, byline_id, sort_order, role_label, created_at
|
|
2523
|
+
FROM _dineway_content_bylines
|
|
2524
|
+
`.execute(db);
|
|
2525
|
+
await db.schema.dropTable("_dineway_content_bylines").execute();
|
|
2526
|
+
await sql`
|
|
2527
|
+
ALTER TABLE _dineway_content_bylines_old
|
|
2528
|
+
RENAME TO _dineway_content_bylines
|
|
2529
|
+
`.execute(db);
|
|
2530
|
+
await db.schema.createIndex("idx_content_bylines_content").on("_dineway_content_bylines").columns([
|
|
2531
|
+
"collection_slug",
|
|
2532
|
+
"content_id",
|
|
2533
|
+
"sort_order"
|
|
2534
|
+
]).execute();
|
|
2535
|
+
await db.schema.createIndex("idx_content_bylines_byline").on("_dineway_content_bylines").column("byline_id").execute();
|
|
2536
|
+
}
|
|
2537
|
+
|
|
2538
|
+
//#endregion
|
|
2539
|
+
//#region src/database/migrations/049_byline_fields.ts
|
|
2540
|
+
var _049_byline_fields_exports = /* @__PURE__ */ __exportAll({
|
|
2180
2541
|
down: () => down,
|
|
2181
2542
|
up: () => up
|
|
2182
2543
|
});
|
|
2183
2544
|
async function up(db) {
|
|
2184
|
-
await db.schema.createTable("
|
|
2545
|
+
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(db))).addColumn("updated_at", "text", (col) => col.defaultTo(currentTimestamp(db))).execute();
|
|
2546
|
+
await db.schema.createIndex("idx__dineway_byline_fields_sort_order").ifNotExists().on("_dineway_byline_fields").column("sort_order").execute();
|
|
2547
|
+
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(db))).addColumn("updated_at", "text", (col) => col.defaultTo(currentTimestamp(db))).addPrimaryKeyConstraint("_dineway_byline_field_values_pk", ["byline_id", "field_id"]).execute();
|
|
2548
|
+
await db.schema.createIndex("idx__dineway_byline_field_values_byline").ifNotExists().on("_dineway_byline_field_values").column("byline_id").execute();
|
|
2549
|
+
await db.schema.createIndex("idx__dineway_byline_field_values_field").ifNotExists().on("_dineway_byline_field_values").column("field_id").execute();
|
|
2550
|
+
await db.schema.createTable("_dineway_byline_field_group_values").ifNotExists().addColumn("translation_group", "text", (col) => col.notNull()).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(db))).addColumn("updated_at", "text", (col) => col.defaultTo(currentTimestamp(db))).addPrimaryKeyConstraint("_dineway_byline_field_group_values_pk", ["translation_group", "field_id"]).execute();
|
|
2551
|
+
await db.schema.createIndex("idx__dineway_byline_field_group_values_group").ifNotExists().on("_dineway_byline_field_group_values").column("translation_group").execute();
|
|
2552
|
+
await db.schema.createIndex("idx__dineway_byline_field_group_values_field").ifNotExists().on("_dineway_byline_field_group_values").column("field_id").execute();
|
|
2553
|
+
await sql`
|
|
2554
|
+
INSERT INTO options (name, value) VALUES ('byline_fields_version', '0')
|
|
2555
|
+
ON CONFLICT (name) DO NOTHING
|
|
2556
|
+
`.execute(db);
|
|
2185
2557
|
}
|
|
2186
2558
|
async function down(db) {
|
|
2187
|
-
await db.schema.dropTable("
|
|
2559
|
+
await db.schema.dropTable("_dineway_byline_field_group_values").ifExists().execute();
|
|
2560
|
+
await db.schema.dropTable("_dineway_byline_field_values").ifExists().execute();
|
|
2561
|
+
await db.schema.dropTable("_dineway_byline_fields").ifExists().execute();
|
|
2562
|
+
await sql`DELETE FROM options WHERE name = 'byline_fields_version'`.execute(db);
|
|
2188
2563
|
}
|
|
2189
2564
|
|
|
2190
2565
|
//#endregion
|
|
@@ -2234,7 +2609,10 @@ const MIGRATIONS = Object.freeze({
|
|
|
2234
2609
|
"043_bounded_404_log": _043_bounded_404_log_exports,
|
|
2235
2610
|
"044_credential_algorithm": _044_credential_algorithm_exports,
|
|
2236
2611
|
"045_i18n_menus_and_taxonomies": _045_i18n_menus_and_taxonomies_exports,
|
|
2237
|
-
"046_astro_sessions": _046_astro_sessions_exports
|
|
2612
|
+
"046_astro_sessions": _046_astro_sessions_exports,
|
|
2613
|
+
"047_content_locale_list_index": _047_content_locale_list_index_exports,
|
|
2614
|
+
"048_byline_i18n": _048_byline_i18n_exports,
|
|
2615
|
+
"049_byline_fields": _049_byline_fields_exports
|
|
2238
2616
|
});
|
|
2239
2617
|
const MIGRATION_NAMES = Object.freeze(Object.keys(MIGRATIONS).toSorted());
|
|
2240
2618
|
/** Total number of registered migrations. Exported for use in tests. */
|
|
@@ -2320,4 +2698,4 @@ async function rollbackMigration(db) {
|
|
|
2320
2698
|
}
|
|
2321
2699
|
|
|
2322
2700
|
//#endregion
|
|
2323
|
-
export { runMigrations as i, getMigrationStatus as n, rollbackMigration as r, getMigrationFingerprint as t };
|
|
2701
|
+
export { __exportAll as a, runMigrations as i, getMigrationStatus as n, rollbackMigration as r, getMigrationFingerprint as t };
|