void 0.10.4 → 0.10.6
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/agents-Bmr5tFFb.mjs +1454 -0
- package/dist/{auth-cmd-CblKzAdD.mjs → auth-cmd-DlgNwByu.mjs} +10 -10
- package/dist/{better-auth-shared-D0Mbmx5V.mjs → better-auth-shared-BQooDxbw.mjs} +1 -1
- package/dist/{better-auth-shared-jkksALri.d.mts → better-auth-shared-BvnM9px6.d.mts} +2 -2
- package/dist/{build-cmd-CJQSRupz.mjs → build-cmd-Br8qL0rA.mjs} +15 -17
- package/dist/{cache-CMzjhxHh.mjs → cache-wH-mP8UE.mjs} +10 -12
- package/dist/{cancel-deploy-S2N8NSv6.mjs → cancel-deploy-BEBOEgtu.mjs} +16 -18
- package/dist/cli/cli.mjs +62 -51
- package/dist/{client-YIzxv2ZO.mjs → client-Cj96iiBH.mjs} +118 -8
- package/dist/{config-8dLIngKW.mjs → config-1twldYCW.mjs} +10 -10
- package/dist/{config--wXmVOoe.mjs → config-BdUctCZD.mjs} +6 -6
- package/dist/{create-project-pLQdzEPe.mjs → create-project-DD9n8Ho-.mjs} +28 -23
- package/dist/{db-hAmBumot.mjs → db-DjKE2-A-.mjs} +151 -150
- package/dist/{delete-CfSe3EJO.mjs → delete-D2kr3Kmk.mjs} +13 -15
- package/dist/{deploy-DpOdwtla.mjs → deploy-C4PbkFyE.mjs} +114 -119
- package/dist/{discover-C8N1I4tK.mjs → discover-BuVVSAum.mjs} +4 -4
- package/dist/{dist-5cGIJHQQ.mjs → dist-BuiRJkTd.mjs} +59 -27
- package/dist/{domain-CkowysQx.mjs → domain-_luIsM_B.mjs} +14 -16
- package/dist/{env-CIwG2y7G.mjs → env-CO5XAS9t.mjs} +23 -25
- package/dist/{env-helpers-B_ks681T.d.mts → env-helpers-z4stu8uc.d.mts} +1 -1
- package/dist/{env-types-CaJaIRXU.mjs → env-types-D51bnR-c.mjs} +4 -4
- package/dist/{env-validation-LH6eoyW-.mjs → env-validation-CeC2FL66.mjs} +4 -4
- package/dist/{fetch-error-C6qffTl2.mjs → fetch-error-Dj3crt0e.mjs} +3 -3
- package/dist/{gen-q6McxXgE.mjs → gen-Cf79J4aw.mjs} +42 -44
- package/dist/{github-cmd-BvEKQmcD.mjs → github-cmd-DnqxyOsb.mjs} +197 -91
- package/dist/{handler-B7rCOy21.d.mts → handler-imD0UVDT.d.mts} +4 -5
- package/dist/{headers-BNWymgnH.mjs → headers-BwvFGhkx.mjs} +3 -3
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +102 -83
- package/dist/{init-CZP69LJu.mjs → init-KirOzVDs.mjs} +132 -134
- package/dist/link-CUmiosyb.mjs +45 -0
- package/dist/{list-B7qXBBjo.mjs → list-3GEw7b6m.mjs} +10 -12
- package/dist/{login-B3l_sDwT.mjs → login-DJReaT_Q.mjs} +14 -15
- package/dist/{logs-AXm660MB.mjs → logs-D-rQ56Lq.mjs} +9 -11
- package/dist/{magic-string.es-C1Fb0uxq.mjs → magic-string.es-ZQjdJFFn.mjs} +3 -3
- package/dist/{mcp-D2plINxM.mjs → mcp-D7yc0dXY.mjs} +2 -3
- package/dist/{node-B07cZs0d.mjs → node-yFFk626c.mjs} +6 -6
- package/dist/{package-json-Bg_GJdJB.mjs → package-json-B0NuUWGd.mjs} +1 -1
- package/dist/pages/client.d.mts +1 -1
- package/dist/pages/client.mjs +2 -1
- package/dist/pages/head-client.d.mts +1 -1
- package/dist/pages/head.d.mts +1 -1
- package/dist/pages/index.d.mts +2 -2
- package/dist/pages/index.mjs +5 -5
- package/dist/pages/islands-plugin.d.mts +1 -1
- package/dist/pages/islands-plugin.mjs +3 -3
- package/dist/pages/protocol.d.mts +2 -2
- package/dist/pages/protocol.mjs +5 -2
- package/dist/{plugin-inference-C3fLzFvP.mjs → plugin-inference-CJxi_fWI.mjs} +4 -4
- package/dist/{prepare-DRRboRqH.mjs → prepare-C_cVurhP.mjs} +15 -18
- package/dist/{preset-B7ZQZn0u.mjs → preset-CVvwCeIy.mjs} +4 -4
- package/dist/{project-cmd-InegJruy.mjs → project-cmd-DnU7u9QF.mjs} +13 -14
- package/dist/{project-paths-CCMrHYQm.mjs → project-paths-tpdR1mJR.mjs} +2 -2
- package/dist/{project-tsconfig-BTNuNoJ0.mjs → project-tsconfig-D9uSVVpA.mjs} +4 -4
- package/dist/{protocol-6UZCowS1.d.mts → protocol-6hTJ04T1.d.mts} +3 -3
- package/dist/{resolve-project-D4O1_fZz.mjs → resolve-project-D2HI3TrG.mjs} +2 -2
- package/dist/{rollback-CHVE-DeT.mjs → rollback-Yh7bCKob.mjs} +21 -23
- package/dist/{route-types-D03ryMXz.mjs → route-types-CfKfhbIg.mjs} +234 -3
- package/dist/{runner-BQyKUqAL.mjs → runner-h272wcPj.mjs} +4 -5
- package/dist/{runner-pg-EuhrFW3D.mjs → runner-pg-waxJOnBb.mjs} +1 -1
- package/dist/runtime/ai.mjs +2 -2
- package/dist/runtime/auth.d.mts +1 -1
- package/dist/runtime/better-auth-pg.d.mts +1 -1
- package/dist/runtime/better-auth-pg.mjs +3 -3
- package/dist/runtime/better-auth.d.mts +1 -1
- package/dist/runtime/better-auth.mjs +2 -2
- package/dist/runtime/client-react.d.mts +2 -2
- package/dist/runtime/client-react.mjs +1 -1
- package/dist/runtime/client-solid.d.mts +2 -2
- package/dist/runtime/client-solid.mjs +1 -1
- package/dist/runtime/client-svelte.d.mts +2 -2
- package/dist/runtime/client-svelte.mjs +1 -1
- package/dist/runtime/client-vue.d.mts +2 -2
- package/dist/runtime/client-vue.mjs +1 -1
- package/dist/runtime/client.d.mts +2 -2
- package/dist/runtime/client.mjs +1 -1
- package/dist/runtime/db-pg.d.mts +1 -1
- package/dist/runtime/env-helpers.d.mts +1 -1
- package/dist/runtime/env-public-client.d.mts +1 -1
- package/dist/runtime/env-public-client.mjs +2 -0
- package/dist/runtime/env-public.d.mts +3 -4
- package/dist/runtime/env-public.mjs +3 -1
- package/dist/runtime/env.mjs +1 -1
- package/dist/runtime/fetch-stream.d.mts +1 -1
- package/dist/runtime/fetch-stream.mjs +1 -1
- package/dist/runtime/fetch.d.mts +1 -1
- package/dist/runtime/fetch.mjs +1 -1
- package/dist/runtime/handler.d.mts +2 -2
- package/dist/runtime/handler.mjs +1 -1
- package/dist/runtime/isr.mjs +1 -1
- package/dist/runtime/live-server.mjs +2 -0
- package/dist/runtime/live.d.mts +2 -2
- package/dist/runtime/live.mjs +3 -1
- package/dist/runtime/migration-handler-pg.mjs +1 -1
- package/dist/runtime/migration-handler.mjs +1 -1
- package/dist/runtime/remote/index.mjs +11 -1
- package/dist/runtime/sandbox.d.mts +1 -4
- package/dist/runtime/sandbox.mjs +1 -1
- package/dist/runtime/validator.d.mts +1 -1
- package/dist/runtime/ws-server.d.mts +2 -2
- package/dist/runtime/ws-server.mjs +2 -0
- package/dist/runtime/ws.d.mts +3 -3
- package/dist/runtime/ws.mjs +2 -0
- package/dist/{scan-VCAM1oh3.mjs → scan-Dp_Gyzs3.mjs} +3 -3
- package/dist/{scan-DGEp1-1Q.mjs → scan-i7Yz54fv.mjs} +26 -8
- package/dist/{secret-CVKwIOm3.mjs → secret-u7FRvg8d.mjs} +22 -24
- package/dist/{skills-Dl3u05da.mjs → skills-DsdNDtX3.mjs} +6 -7
- package/dist/{subcommand-prompt-B8ng0FTS.mjs → subcommand-prompt-DtES-oP6.mjs} +34 -35
- package/dist/sveltekit.mjs +2 -2
- package/dist/validate-DT7nFMlf.mjs +504 -0
- package/dist/{yarn-pnp-WLW2IHUY.mjs → yarn-pnp-CW8LB6g_.mjs} +1 -1
- package/package.json +19 -19
- package/skills/void/docs/node_modules/void/node_modules/@clack/prompts/CHANGELOG.md +94 -0
- package/skills/void/docs/node_modules/void/node_modules/@clack/prompts/README.md +32 -11
- package/skills/void/docs/node_modules/void/node_modules/@cloudflare/sandbox/README.md +45 -0
- package/skills/void/docs/node_modules/void/node_modules/@electric-sql/pglite/README.md +5 -5
- package/skills/void/docs/node_modules/void/node_modules/@types/node/README.md +1 -1
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/@types/node/README.md +1 -1
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/markdown-exit/README.md +4 -1
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/markdown-it-attrs/README.md +29 -12
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/tinyglobby/README.md +1 -1
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/AGENTS.md +1 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/README.md +18 -6
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/config/build.md +1 -1
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/config/check.md +35 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/config/create.md +70 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/config/fmt.md +3 -1
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/config/index.md +11 -7
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/config/lint.md +3 -1
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/config/pack.md +1 -1
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/config/run.md +141 -26
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/config/staged.md +1 -1
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/config/test.md +1 -1
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/automatic-data-tracking.md +145 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/cache.md +16 -28
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/check.md +16 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/ci.md +15 -17
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/commit-hooks.md +9 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/create.md +255 -2
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/docker.md +175 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/env.md +70 -5
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/github-actions-cache.md +165 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/ide-integration.md +2 -2
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/index.md +9 -3
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/install.md +63 -11
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/migrate-rules.md +347 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/migrate.md +27 -3
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/monorepo.md +176 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/pack.md +8 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/run.md +36 -4
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/troubleshooting.md +11 -35
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/upgrade.md +65 -13
- package/skills/void/docs/node_modules/void/node_modules/es-module-lexer/README.md +403 -390
- package/skills/void/docs/node_modules/void/node_modules/pg/README.md +2 -1
- package/skills/void/docs/node_modules/void/node_modules/tinyglobby/README.md +1 -1
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/AGENTS.md +1 -0
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/README.md +18 -6
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/config/build.md +1 -1
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/config/check.md +35 -0
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/config/create.md +70 -0
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/config/fmt.md +3 -1
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/config/index.md +11 -7
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/config/lint.md +3 -1
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/config/pack.md +1 -1
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/config/run.md +141 -26
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/config/staged.md +1 -1
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/config/test.md +1 -1
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/automatic-data-tracking.md +145 -0
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/cache.md +16 -28
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/check.md +16 -0
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/ci.md +15 -17
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/commit-hooks.md +9 -0
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/create.md +255 -2
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/docker.md +175 -0
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/env.md +70 -5
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/github-actions-cache.md +165 -0
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/ide-integration.md +2 -2
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/index.md +9 -3
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/install.md +63 -11
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/migrate-rules.md +347 -0
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/migrate.md +27 -3
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/monorepo.md +176 -0
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/pack.md +8 -0
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/run.md +36 -4
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/troubleshooting.md +11 -35
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/upgrade.md +65 -13
- package/skills/void/docs/reference/cli.md +19 -1
- package/dist/agents-MhSzNMiC.mjs +0 -151
- package/dist/collect-9rO3JFNM.mjs +0 -55
- package/dist/config-hhMYPVRT.mjs +0 -21
- package/dist/dist-abzUneor.mjs +0 -1287
- package/dist/drizzle-DqstQTGq.mjs +0 -232
- package/dist/link-BKLElphS.mjs +0 -47
- package/dist/output-DeiS4oEX.mjs +0 -139
- package/dist/plan-aD3wRDqF.mjs +0 -271
- package/dist/project-CH9pdo16.mjs +0 -72
- package/dist/project-slug-rX3kTOfY.mjs +0 -10
- package/dist/validate-CNWm-PsL.mjs +0 -186
- /package/dist/{auth-migrations-BP-hMzYl.mjs → auth-migrations-BTZ-ATvQ.mjs} +0 -0
- /package/dist/{auth-Dz2CCn4T.d.mts → auth-qgMlYp7Z.d.mts} +0 -0
- /package/dist/{canonical-json-CEyQaVDa.mjs → canonical-json-DuDiiUsQ.mjs} +0 -0
- /package/dist/{cf-access-DKDsgwOU.mjs → cf-access-Bqw81xAf.mjs} +0 -0
- /package/dist/{defer-C-bdSM_b.mjs → defer-YsYDUoii.mjs} +0 -0
- /package/dist/{dotenv-lS94ymhM.mjs → dotenv-D_UbC_vc.mjs} +0 -0
- /package/dist/{env-raw-Dtj1UAoK.mjs → env-raw-CoS20LHP.mjs} +0 -0
- /package/dist/{fetch-error-B6RaJ-eZ.d.mts → fetch-error-Sp1R4mZv.d.mts} +0 -0
- /package/dist/{git-metadata-Ce0AtSZL.mjs → git-metadata-CBKaL0v5.mjs} +0 -0
- /package/dist/{head-eOUCWUNy.d.mts → head-nmvOgFjd.d.mts} +0 -0
- /package/dist/{log-BdD_Fpms.mjs → log-ChfPKsVd.mjs} +0 -0
- /package/dist/{pathe.M-eThtNZ-BrPhGF_K.mjs → pathe.M-eThtNZ-CQzLbt4c.mjs} +0 -0
- /package/dist/{pg-CempqvEJ.mjs → pg-J2HbZIkX.mjs} +0 -0
- /package/dist/{providers-BJIoduK9.d.mts → providers-BNKRacMr.d.mts} +0 -0
- /package/dist/{providers-BwPbdHdi.mjs → providers-CJlNS3kT.mjs} +0 -0
- /package/dist/{proxy-M3pxItg2.mjs → proxy-D-3_D-Gl.mjs} +0 -0
- /package/dist/{chunk-DJd-R1mw.mjs → rolldown-runtime-DJK8HYOj.mjs} +0 -0
- /package/dist/{standard-schema-Cy0lfeWv.d.mts → standard-schema-DJ0HW7QP.d.mts} +0 -0
- /package/dist/{types-BodZGegX.d.mts → types-lLjNE9Qp.d.mts} +0 -0
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
import { a as join, c as resolve, r as extname, s as relative } from "./pathe.M-eThtNZ-
|
|
2
|
-
import {
|
|
3
|
-
import { n as readProjectPaths } from "./project-paths-
|
|
4
|
-
import { t as cfAccessHeaders } from "./cf-access-
|
|
5
|
-
import { f as getToken, m as isStagingMode, n as PlatformClient, t as PlatformApiError } from "./client-
|
|
6
|
-
import { c as
|
|
7
|
-
import { r as
|
|
8
|
-
import { c as
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { n as listDrizzleArtifacts, r as validateMigrations, t as assertJournalCoherence } from "./validate-CNWm-PsL.mjs";
|
|
12
|
-
import { n as STAGING_PROXY_URL, t as DEFAULT_PROXY_URL } from "./proxy-M3pxItg2.mjs";
|
|
13
|
-
import { formatTimestamp } from "./gen-q6McxXgE.mjs";
|
|
1
|
+
import { a as join, c as resolve, r as extname, s as relative } from "./pathe.M-eThtNZ-CQzLbt4c.mjs";
|
|
2
|
+
import { D as outro, S as confirm, T as log, a as cliTitle, j as isCancel, s as dim, u as import_picocolors, w as intro } from "./agents-Bmr5tFFb.mjs";
|
|
3
|
+
import { n as readProjectPaths } from "./project-paths-tpdR1mJR.mjs";
|
|
4
|
+
import { t as cfAccessHeaders } from "./cf-access-Bqw81xAf.mjs";
|
|
5
|
+
import { b as readProjectConfig, f as getToken, m as isStagingMode, n as PlatformClient, t as PlatformApiError } from "./client-Cj96iiBH.mjs";
|
|
6
|
+
import { c as getDatabaseDialect, f as readConfig, p as resolveBindingNames } from "./config-1twldYCW.mjs";
|
|
7
|
+
import { r as detectFramework } from "./plugin-inference-CJxi_fWI.mjs";
|
|
8
|
+
import { c as collectMigrations, d as stripSqlExt, f as writeJournal, n as listDrizzleArtifacts, r as validateMigrations, t as assertJournalCoherence, u as readJournal } from "./validate-DT7nFMlf.mjs";
|
|
9
|
+
import { n as STAGING_PROXY_URL, t as DEFAULT_PROXY_URL } from "./proxy-D-3_D-Gl.mjs";
|
|
10
|
+
import { formatTimestamp } from "./gen-Cf79J4aw.mjs";
|
|
14
11
|
import { existsSync, readFileSync, readdirSync, renameSync, rmSync, writeFileSync } from "node:fs";
|
|
15
12
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
16
13
|
import { execFileSync } from "node:child_process";
|
|
@@ -23,7 +20,7 @@ const DEFAULT_SEED_FILES = [
|
|
|
23
20
|
"db/seed.mjs",
|
|
24
21
|
"db/seed.sql"
|
|
25
22
|
];
|
|
26
|
-
const MODULE_SEED_EXTENSIONS = new Set([
|
|
23
|
+
const MODULE_SEED_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
27
24
|
".ts",
|
|
28
25
|
".mts",
|
|
29
26
|
".js",
|
|
@@ -81,8 +78,10 @@ function validatePendingMigrations(migrations, appliedNames) {
|
|
|
81
78
|
validateMigrations(pending);
|
|
82
79
|
}
|
|
83
80
|
async function runDbCommand(root, args) {
|
|
84
|
-
|
|
85
|
-
|
|
81
|
+
const exportToStdout = args.action === "export" && !args.output;
|
|
82
|
+
if (exportToStdout) process.stderr.write("\n");
|
|
83
|
+
else console.log();
|
|
84
|
+
intro(cliTitle("db"), exportToStdout ? { output: process.stderr } : void 0);
|
|
86
85
|
const dialect = getDatabaseDialect(readConfig(root));
|
|
87
86
|
if (args.action === "push") await runPush(root, dialect);
|
|
88
87
|
else if (args.action === "generate") await runGenerate(root, dialect);
|
|
@@ -97,13 +96,13 @@ async function runDbCommand(root, args) {
|
|
|
97
96
|
else await runExport(root, args, dialect);
|
|
98
97
|
}
|
|
99
98
|
async function runPush(root, dialect) {
|
|
100
|
-
const { writeDrizzleConfig } = await import("./config
|
|
99
|
+
const { writeDrizzleConfig } = await import("./config-BdUctCZD.mjs").then((n) => n.t);
|
|
101
100
|
let configPath;
|
|
102
101
|
if (dialect === "postgresql") configPath = writeDrizzleConfig(root, getPgUrl(root), "postgresql");
|
|
103
102
|
else {
|
|
104
103
|
const { mkdirSync } = await import("node:fs");
|
|
105
104
|
const { dirname } = await import("node:path");
|
|
106
|
-
const { getMiniflareDatabasePath } = await import("./runner-
|
|
105
|
+
const { getMiniflareDatabasePath } = await import("./runner-h272wcPj.mjs");
|
|
107
106
|
const dbPath = getMiniflareDatabasePath(getLocalD1PersistRoot(root), "local");
|
|
108
107
|
mkdirSync(dirname(dbPath), { recursive: true });
|
|
109
108
|
configPath = writeDrizzleConfig(root, dbPath);
|
|
@@ -117,10 +116,10 @@ async function runPush(root, dialect) {
|
|
|
117
116
|
} catch {
|
|
118
117
|
process.exit(1);
|
|
119
118
|
}
|
|
120
|
-
|
|
119
|
+
outro("Done.");
|
|
121
120
|
}
|
|
122
121
|
async function runGenerate(root, dialect) {
|
|
123
|
-
const { writeDrizzleConfig } = await import("./config
|
|
122
|
+
const { writeDrizzleConfig } = await import("./config-BdUctCZD.mjs").then((n) => n.t);
|
|
124
123
|
const configPath = dialect === "postgresql" ? writeDrizzleConfig(root, "postgresql://dummy", "postgresql") : writeDrizzleConfig(root, ":memory:");
|
|
125
124
|
try {
|
|
126
125
|
runDrizzleKit(root, [
|
|
@@ -131,7 +130,7 @@ async function runGenerate(root, dialect) {
|
|
|
131
130
|
} catch {
|
|
132
131
|
process.exit(1);
|
|
133
132
|
}
|
|
134
|
-
|
|
133
|
+
outro("Done.");
|
|
135
134
|
}
|
|
136
135
|
async function runStatus(root, dialect) {
|
|
137
136
|
const paths = readProjectPaths(root);
|
|
@@ -140,12 +139,12 @@ async function runStatus(root, dialect) {
|
|
|
140
139
|
try {
|
|
141
140
|
assertJournalCoherence(migrationsDir, allMigrations);
|
|
142
141
|
} catch (err) {
|
|
143
|
-
|
|
142
|
+
log.error(getErrorMessage(err));
|
|
144
143
|
process.exit(1);
|
|
145
144
|
}
|
|
146
145
|
if (allMigrations.length === 0) {
|
|
147
|
-
|
|
148
|
-
|
|
146
|
+
log.info(`No migration files found in ${paths.sourceRelative("db/migrations")}/`);
|
|
147
|
+
outro("Done.");
|
|
149
148
|
return;
|
|
150
149
|
}
|
|
151
150
|
let localApplied;
|
|
@@ -161,7 +160,7 @@ async function runStatus(root, dialect) {
|
|
|
161
160
|
localApplied = [];
|
|
162
161
|
}
|
|
163
162
|
else {
|
|
164
|
-
const { getMiniflareDatabasePath, getAppliedMigrations } = await import("./runner-
|
|
163
|
+
const { getMiniflareDatabasePath, getAppliedMigrations } = await import("./runner-h272wcPj.mjs");
|
|
165
164
|
localApplied = await getAppliedMigrations(getMiniflareDatabasePath(getLocalD1PersistRoot(root), "local"));
|
|
166
165
|
}
|
|
167
166
|
const localSet = new Set(localApplied.map((m) => m.name));
|
|
@@ -179,7 +178,7 @@ async function runStatus(root, dialect) {
|
|
|
179
178
|
if (remoteSet !== null) remotePart = ` remote: ${remoteSet.has(migration.name) ? import_picocolors.default.green("applied") : import_picocolors.default.yellow("pending")}`;
|
|
180
179
|
lines.push(` ${migration.name} ${dim("local:")} ${localStatus}${remotePart}`);
|
|
181
180
|
}
|
|
182
|
-
|
|
181
|
+
log.info(lines.join("\n"));
|
|
183
182
|
const localPending = allMigrations.length - localSet.size;
|
|
184
183
|
const parts = [`${allMigrations.length} migration(s)`];
|
|
185
184
|
if (localPending > 0) parts.push(`${localPending} pending locally`);
|
|
@@ -187,7 +186,7 @@ async function runStatus(root, dialect) {
|
|
|
187
186
|
const remotePending = allMigrations.length - remoteSet.size;
|
|
188
187
|
if (remotePending > 0) parts.push(`${remotePending} pending remotely`);
|
|
189
188
|
}
|
|
190
|
-
|
|
189
|
+
outro(parts.join(", "));
|
|
191
190
|
}
|
|
192
191
|
async function resetDatabase(root, dialect) {
|
|
193
192
|
const migrationsDir = readProjectPaths(root).migrationsDir;
|
|
@@ -195,7 +194,7 @@ async function resetDatabase(root, dialect) {
|
|
|
195
194
|
try {
|
|
196
195
|
assertJournalCoherence(migrationsDir, migrations);
|
|
197
196
|
} catch (err) {
|
|
198
|
-
|
|
197
|
+
log.error(getErrorMessage(err));
|
|
199
198
|
process.exit(1);
|
|
200
199
|
}
|
|
201
200
|
if (dialect === "postgresql") {
|
|
@@ -219,7 +218,7 @@ async function resetDatabase(root, dialect) {
|
|
|
219
218
|
});
|
|
220
219
|
return migrations.length;
|
|
221
220
|
}
|
|
222
|
-
const { getMiniflareDatabasePath, runMigrations } = await import("./runner-
|
|
221
|
+
const { getMiniflareDatabasePath, runMigrations } = await import("./runner-h272wcPj.mjs");
|
|
223
222
|
const dbPath = getMiniflareDatabasePath(getLocalD1PersistRoot(root), "local");
|
|
224
223
|
rmSync(dbPath, { force: true });
|
|
225
224
|
rmSync(dbPath + "-wal", { force: true });
|
|
@@ -228,13 +227,13 @@ async function resetDatabase(root, dialect) {
|
|
|
228
227
|
}
|
|
229
228
|
async function runReset(root, dialect) {
|
|
230
229
|
const count = await resetDatabase(root, dialect);
|
|
231
|
-
|
|
232
|
-
if (dialect !== "postgresql")
|
|
233
|
-
|
|
230
|
+
log.success(`Database reset. Applied ${count} migration(s).`);
|
|
231
|
+
if (dialect !== "postgresql") log.info(dim("Restart your dev server if it's running."));
|
|
232
|
+
outro("Done.");
|
|
234
233
|
}
|
|
235
234
|
async function runSeed(root, file, dialect) {
|
|
236
235
|
const migrationCount = await resetDatabase(root, dialect);
|
|
237
|
-
|
|
236
|
+
log.step(`Reset database. Applied ${migrationCount} migration(s).`);
|
|
238
237
|
const seed = resolveSeedTarget(root, file);
|
|
239
238
|
if (seed.kind === "sql") {
|
|
240
239
|
const sql = readFileSync(seed.path, "utf-8");
|
|
@@ -242,11 +241,11 @@ async function runSeed(root, file, dialect) {
|
|
|
242
241
|
await withPgClient(root, async (client) => {
|
|
243
242
|
await client.query(sql);
|
|
244
243
|
});
|
|
245
|
-
|
|
246
|
-
|
|
244
|
+
log.success(`Seeded from ${seed.displayPath}.`);
|
|
245
|
+
outro("Done.");
|
|
247
246
|
return;
|
|
248
247
|
}
|
|
249
|
-
const { getMiniflareDatabasePath, openSqliteDatabase } = await import("./runner-
|
|
248
|
+
const { getMiniflareDatabasePath, openSqliteDatabase } = await import("./runner-h272wcPj.mjs");
|
|
250
249
|
const db = await openSqliteDatabase(getMiniflareDatabasePath(getLocalD1PersistRoot(root), "local"));
|
|
251
250
|
try {
|
|
252
251
|
db.exec(sql);
|
|
@@ -254,9 +253,9 @@ async function runSeed(root, file, dialect) {
|
|
|
254
253
|
db.close();
|
|
255
254
|
}
|
|
256
255
|
} else await runSeedModule(root, seed.path, dialect);
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
256
|
+
log.success(`Seeded from ${seed.displayPath}.`);
|
|
257
|
+
log.info(dim("Restart your dev server if it's running."));
|
|
258
|
+
outro("Done.");
|
|
260
259
|
}
|
|
261
260
|
/**
|
|
262
261
|
* Returns true when the SQL is read-only (SELECT / EXPLAIN only).
|
|
@@ -313,7 +312,7 @@ async function fetchRemoteDatabaseUrl(client, projectId) {
|
|
|
313
312
|
return (await client.getDatabaseUrl(projectId)).url;
|
|
314
313
|
} catch (err) {
|
|
315
314
|
if (err instanceof PlatformApiError && err.status === 404) {
|
|
316
|
-
|
|
315
|
+
log.error("This project's database URL isn't stored on the platform yet. Run `void db set-url` once to populate it, then retry.");
|
|
317
316
|
process.exit(1);
|
|
318
317
|
}
|
|
319
318
|
throw err;
|
|
@@ -326,29 +325,29 @@ async function fetchRemoteDatabaseUrl(client, projectId) {
|
|
|
326
325
|
async function confirmDestructiveRemote(sql) {
|
|
327
326
|
if (isSafeStatement(sql)) return true;
|
|
328
327
|
if (!process.stdin.isTTY) return true;
|
|
329
|
-
const ok = await
|
|
330
|
-
if (
|
|
328
|
+
const ok = await confirm({ message: "This will run against your deployed database. Continue?" });
|
|
329
|
+
if (isCancel(ok) || !ok) return false;
|
|
331
330
|
return true;
|
|
332
331
|
}
|
|
333
332
|
async function runExecute(root, command, file, dialect, remote) {
|
|
334
333
|
if (remote) {
|
|
335
334
|
if (dialect !== "postgresql" && file) {
|
|
336
|
-
|
|
335
|
+
log.error("--file is not yet supported with --remote D1; pipe statements through stdin or run them one at a time.");
|
|
337
336
|
process.exit(1);
|
|
338
337
|
}
|
|
339
338
|
const sql = file ? readFileSync(join(root, file), "utf-8") : command;
|
|
340
339
|
const token = getToken(root);
|
|
341
340
|
if (!token) {
|
|
342
|
-
|
|
341
|
+
log.error("Not logged in. Run `void auth login` first.");
|
|
343
342
|
process.exit(1);
|
|
344
343
|
}
|
|
345
344
|
const projectConfig = readProjectConfig(root);
|
|
346
345
|
if (!projectConfig) {
|
|
347
|
-
|
|
346
|
+
log.error("No project linked. Run `void deploy` first or link a project.");
|
|
348
347
|
process.exit(1);
|
|
349
348
|
}
|
|
350
349
|
if (!await confirmDestructiveRemote(sql)) {
|
|
351
|
-
|
|
350
|
+
log.info("Cancelled.");
|
|
352
351
|
process.exit(0);
|
|
353
352
|
}
|
|
354
353
|
if (dialect === "postgresql") {
|
|
@@ -359,11 +358,11 @@ async function runExecute(root, command, file, dialect, remote) {
|
|
|
359
358
|
try {
|
|
360
359
|
const result = await pgClient.query(sql);
|
|
361
360
|
if (result.rows && result.rows.length > 0) printTable(result.rows);
|
|
362
|
-
else
|
|
361
|
+
else log.success("Executed successfully.");
|
|
363
362
|
} finally {
|
|
364
363
|
await pgClient.end();
|
|
365
364
|
}
|
|
366
|
-
|
|
365
|
+
outro("Done.");
|
|
367
366
|
return;
|
|
368
367
|
}
|
|
369
368
|
const platformClient = new PlatformClient(token, { root });
|
|
@@ -390,13 +389,13 @@ async function runExecute(root, command, file, dialect, remote) {
|
|
|
390
389
|
});
|
|
391
390
|
if (!res.ok) {
|
|
392
391
|
const text = await res.text().catch(() => res.statusText);
|
|
393
|
-
|
|
392
|
+
log.error(`db: Proxy request failed with ${res.status}: '${text}'.`);
|
|
394
393
|
process.exit(1);
|
|
395
394
|
}
|
|
396
395
|
const rows = (await res.json()).results ?? [];
|
|
397
396
|
if (rows.length > 0) printTable(rows);
|
|
398
|
-
else
|
|
399
|
-
|
|
397
|
+
else log.success("Executed successfully.");
|
|
398
|
+
outro("Done.");
|
|
400
399
|
return;
|
|
401
400
|
}
|
|
402
401
|
if (dialect === "postgresql") {
|
|
@@ -404,15 +403,15 @@ async function runExecute(root, command, file, dialect, remote) {
|
|
|
404
403
|
await withPgClient(root, async (client) => {
|
|
405
404
|
const result = await client.query(sql);
|
|
406
405
|
if (result.rows && result.rows.length > 0) printTable(result.rows);
|
|
407
|
-
else
|
|
406
|
+
else log.success("Executed successfully.");
|
|
408
407
|
});
|
|
409
|
-
|
|
408
|
+
outro("Done.");
|
|
410
409
|
return;
|
|
411
410
|
}
|
|
412
|
-
const { getMiniflareDatabasePath, openSqliteDatabase } = await import("./runner-
|
|
411
|
+
const { getMiniflareDatabasePath, openSqliteDatabase } = await import("./runner-h272wcPj.mjs");
|
|
413
412
|
const dbPath = getMiniflareDatabasePath(getLocalD1PersistRoot(root), "local");
|
|
414
413
|
if (!existsSync(dbPath)) {
|
|
415
|
-
|
|
414
|
+
log.error("No local database found. Run `void dev` first.");
|
|
416
415
|
process.exit(1);
|
|
417
416
|
}
|
|
418
417
|
const sql = file ? readFileSync(join(root, file), "utf-8") : command;
|
|
@@ -421,16 +420,16 @@ async function runExecute(root, command, file, dialect, remote) {
|
|
|
421
420
|
const trimmed = sql.trimStart();
|
|
422
421
|
if (/^SELECT\b/i.test(trimmed)) {
|
|
423
422
|
const rows = db.prepare(sql).all();
|
|
424
|
-
if (rows.length === 0)
|
|
423
|
+
if (rows.length === 0) log.info("No rows returned.");
|
|
425
424
|
else printTable(rows);
|
|
426
425
|
} else {
|
|
427
426
|
db.exec(sql);
|
|
428
|
-
|
|
427
|
+
log.success("Executed successfully.");
|
|
429
428
|
}
|
|
430
429
|
} finally {
|
|
431
430
|
db.close();
|
|
432
431
|
}
|
|
433
|
-
|
|
432
|
+
outro("Done.");
|
|
434
433
|
}
|
|
435
434
|
function printTable(rows) {
|
|
436
435
|
const cols = Object.keys(rows[0]);
|
|
@@ -453,27 +452,27 @@ async function runMigrate(root, dialect, remote) {
|
|
|
453
452
|
try {
|
|
454
453
|
assertJournalCoherence(migrationsDir, rawMigrations);
|
|
455
454
|
} catch (err) {
|
|
456
|
-
|
|
455
|
+
log.error(getErrorMessage(err));
|
|
457
456
|
process.exit(1);
|
|
458
457
|
}
|
|
459
458
|
if (remote) {
|
|
460
459
|
if (dialect === "postgresql") {
|
|
461
|
-
|
|
460
|
+
log.error("db: `void db migrate --remote` is only supported for D1 projects. PostgreSQL remote migrations run during `void deploy` through the project Hyperdrive binding.");
|
|
462
461
|
process.exit(1);
|
|
463
462
|
}
|
|
464
463
|
const token = getToken(root);
|
|
465
464
|
if (!token) {
|
|
466
|
-
|
|
465
|
+
log.error("Not logged in. Run `void auth login` first.");
|
|
467
466
|
process.exit(1);
|
|
468
467
|
}
|
|
469
468
|
const config = readProjectConfig(root);
|
|
470
469
|
if (!config) {
|
|
471
|
-
|
|
470
|
+
log.error("No project linked. Run `void deploy` first or link a project.");
|
|
472
471
|
process.exit(1);
|
|
473
472
|
}
|
|
474
473
|
if (rawMigrations.length === 0) {
|
|
475
|
-
|
|
476
|
-
|
|
474
|
+
log.info(`No migration files found in ${paths.sourceRelative("db/migrations")}/`);
|
|
475
|
+
outro("Done.");
|
|
477
476
|
return;
|
|
478
477
|
}
|
|
479
478
|
const client = new PlatformClient(token, { root });
|
|
@@ -482,37 +481,37 @@ async function runMigrate(root, dialect, remote) {
|
|
|
482
481
|
const status = await client.getMigrationStatus(config.projectId, dialect);
|
|
483
482
|
remoteApplied = new Set(status.applied.map((m) => m.name));
|
|
484
483
|
} catch (err) {
|
|
485
|
-
|
|
484
|
+
log.error(`db: Failed to fetch remote migration status: '${err instanceof Error ? err.message : String(err)}'.`);
|
|
486
485
|
process.exit(1);
|
|
487
486
|
}
|
|
488
487
|
const pendingMigrations = rawMigrations.filter((m) => !remoteApplied.has(m.name));
|
|
489
488
|
if (pendingMigrations.length === 0) {
|
|
490
|
-
|
|
491
|
-
|
|
489
|
+
log.info("Remote database is up to date.");
|
|
490
|
+
outro("Done.");
|
|
492
491
|
return;
|
|
493
492
|
}
|
|
494
493
|
try {
|
|
495
494
|
validateMigrations(pendingMigrations);
|
|
496
495
|
} catch (err) {
|
|
497
|
-
|
|
496
|
+
log.error(getErrorMessage(err));
|
|
498
497
|
process.exit(1);
|
|
499
498
|
}
|
|
500
499
|
const result = await client.applyRemoteMigrations(config.projectId, pendingMigrations);
|
|
501
500
|
if (!result.ok) {
|
|
502
|
-
|
|
501
|
+
log.error(result.error ? `db: Remote migration failed: '${result.error}'.` : "db: Remote migration failed.");
|
|
503
502
|
process.exit(1);
|
|
504
503
|
}
|
|
505
|
-
if (result.applied.length === 0)
|
|
504
|
+
if (result.applied.length === 0) log.info("Remote database is up to date.");
|
|
506
505
|
else {
|
|
507
|
-
for (const name of result.applied)
|
|
508
|
-
|
|
506
|
+
for (const name of result.applied) log.step(name);
|
|
507
|
+
log.success(`Applied ${result.applied.length} migration(s) to remote database.`);
|
|
509
508
|
}
|
|
510
|
-
for (const warning of result.warnings ?? [])
|
|
511
|
-
|
|
509
|
+
for (const warning of result.warnings ?? []) log.warn(warning);
|
|
510
|
+
outro("Done.");
|
|
512
511
|
return;
|
|
513
512
|
}
|
|
514
513
|
if (dialect === "postgresql") {
|
|
515
|
-
const { applyPgMigrations } = await import("./runner-pg-
|
|
514
|
+
const { applyPgMigrations } = await import("./runner-pg-waxJOnBb.mjs");
|
|
516
515
|
const applied = await withPgClient(root, async (client) => {
|
|
517
516
|
let existingRows = [];
|
|
518
517
|
try {
|
|
@@ -523,57 +522,57 @@ async function runMigrate(root, dialect, remote) {
|
|
|
523
522
|
try {
|
|
524
523
|
validatePendingMigrations(rawMigrations, new Set(existingRows.map((row) => row.name)));
|
|
525
524
|
} catch (err) {
|
|
526
|
-
|
|
525
|
+
log.error(getErrorMessage(err));
|
|
527
526
|
process.exit(1);
|
|
528
527
|
}
|
|
529
528
|
return applyPgMigrations(client, rawMigrations);
|
|
530
529
|
});
|
|
531
|
-
if (applied.length === 0)
|
|
530
|
+
if (applied.length === 0) log.info("All migrations are up to date.");
|
|
532
531
|
else {
|
|
533
|
-
for (const name of applied)
|
|
534
|
-
|
|
532
|
+
for (const name of applied) log.step(name);
|
|
533
|
+
log.success(`Applied ${applied.length} migration(s).`);
|
|
535
534
|
}
|
|
536
|
-
|
|
535
|
+
outro("Done.");
|
|
537
536
|
return;
|
|
538
537
|
}
|
|
539
|
-
const { getMiniflareDatabasePath, getAppliedMigrations, runMigrations } = await import("./runner-
|
|
538
|
+
const { getMiniflareDatabasePath, getAppliedMigrations, runMigrations } = await import("./runner-h272wcPj.mjs");
|
|
540
539
|
const dbPath = getMiniflareDatabasePath(getLocalD1PersistRoot(root), "local");
|
|
541
540
|
try {
|
|
542
541
|
const existingRows = await getAppliedMigrations(dbPath);
|
|
543
542
|
validatePendingMigrations(rawMigrations, new Set(existingRows.map((row) => row.name)));
|
|
544
543
|
} catch (err) {
|
|
545
|
-
|
|
544
|
+
log.error(getErrorMessage(err));
|
|
546
545
|
process.exit(1);
|
|
547
546
|
}
|
|
548
547
|
const applied = await runMigrations(migrationsDir, dbPath);
|
|
549
|
-
if (applied.length === 0)
|
|
548
|
+
if (applied.length === 0) log.info("All migrations are up to date.");
|
|
550
549
|
else {
|
|
551
|
-
for (const name of applied)
|
|
552
|
-
|
|
553
|
-
|
|
550
|
+
for (const name of applied) log.step(name);
|
|
551
|
+
log.success(`Applied ${applied.length} migration(s).`);
|
|
552
|
+
log.info(dim("Restart your dev server if it's running."));
|
|
554
553
|
}
|
|
555
|
-
|
|
554
|
+
outro("Done.");
|
|
556
555
|
}
|
|
557
556
|
async function runStudio(root, dialect, remote) {
|
|
558
557
|
if (remote) {
|
|
559
558
|
if (dialect !== "postgresql") {
|
|
560
|
-
|
|
559
|
+
log.error("Remote D1 studio is not yet supported. Use `void db execute --remote` for ad-hoc queries against your deployed D1 database.");
|
|
561
560
|
process.exit(1);
|
|
562
561
|
}
|
|
563
562
|
const token = getToken(root);
|
|
564
563
|
if (!token) {
|
|
565
|
-
|
|
564
|
+
log.error("Not logged in. Run `void auth login` first.");
|
|
566
565
|
process.exit(1);
|
|
567
566
|
}
|
|
568
567
|
const projectConfig = readProjectConfig(root);
|
|
569
568
|
if (!projectConfig) {
|
|
570
|
-
|
|
569
|
+
log.error("No project linked. Run `void deploy` first or link a project.");
|
|
571
570
|
process.exit(1);
|
|
572
571
|
}
|
|
573
572
|
const dbUrl = await fetchRemoteDatabaseUrl(new PlatformClient(token, { root }), projectConfig.projectId);
|
|
574
|
-
const { writeDrizzleConfig } = await import("./config
|
|
573
|
+
const { writeDrizzleConfig } = await import("./config-BdUctCZD.mjs").then((n) => n.t);
|
|
575
574
|
const configPath = writeDrizzleConfig(root, dbUrl, "postgresql");
|
|
576
|
-
|
|
575
|
+
log.info("Opening Drizzle Studio (remote)...");
|
|
577
576
|
try {
|
|
578
577
|
runDrizzleKit(root, [
|
|
579
578
|
"studio",
|
|
@@ -586,9 +585,9 @@ async function runStudio(root, dialect, remote) {
|
|
|
586
585
|
return;
|
|
587
586
|
}
|
|
588
587
|
if (dialect === "postgresql") {
|
|
589
|
-
const { writeDrizzleConfig } = await import("./config
|
|
588
|
+
const { writeDrizzleConfig } = await import("./config-BdUctCZD.mjs").then((n) => n.t);
|
|
590
589
|
const configPath = writeDrizzleConfig(root, getPgUrl(root), "postgresql");
|
|
591
|
-
|
|
590
|
+
log.info("Opening Drizzle Studio...");
|
|
592
591
|
try {
|
|
593
592
|
runDrizzleKit(root, [
|
|
594
593
|
"studio",
|
|
@@ -600,15 +599,15 @@ async function runStudio(root, dialect, remote) {
|
|
|
600
599
|
}
|
|
601
600
|
return;
|
|
602
601
|
}
|
|
603
|
-
const { writeDrizzleConfig } = await import("./config
|
|
604
|
-
const { getMiniflareDatabasePath } = await import("./runner-
|
|
602
|
+
const { writeDrizzleConfig } = await import("./config-BdUctCZD.mjs").then((n) => n.t);
|
|
603
|
+
const { getMiniflareDatabasePath } = await import("./runner-h272wcPj.mjs");
|
|
605
604
|
const dbPath = getMiniflareDatabasePath(getLocalD1PersistRoot(root), "local");
|
|
606
605
|
if (!existsSync(dbPath)) {
|
|
607
|
-
|
|
606
|
+
log.error("No local database found. Run `void dev` first.");
|
|
608
607
|
process.exit(1);
|
|
609
608
|
}
|
|
610
609
|
const configPath = writeDrizzleConfig(root, dbPath);
|
|
611
|
-
|
|
610
|
+
log.info("Opening Drizzle Studio...");
|
|
612
611
|
try {
|
|
613
612
|
runDrizzleKit(root, [
|
|
614
613
|
"studio",
|
|
@@ -622,26 +621,26 @@ async function runStudio(root, dialect, remote) {
|
|
|
622
621
|
async function runRenameMigrations(root, dialect) {
|
|
623
622
|
const migrationsDir = readProjectPaths(root).migrationsDir;
|
|
624
623
|
if (!existsSync(migrationsDir)) {
|
|
625
|
-
|
|
626
|
-
|
|
624
|
+
log.info("No migrations directory found.");
|
|
625
|
+
outro("Done.");
|
|
627
626
|
return;
|
|
628
627
|
}
|
|
629
628
|
const currentMigrations = collectMigrations(migrationsDir);
|
|
630
629
|
try {
|
|
631
630
|
assertJournalCoherence(migrationsDir, currentMigrations);
|
|
632
631
|
} catch (err) {
|
|
633
|
-
|
|
632
|
+
log.error(getErrorMessage(err));
|
|
634
633
|
process.exit(1);
|
|
635
634
|
}
|
|
636
635
|
if (existsSync(join(migrationsDir, "migrations.js"))) {
|
|
637
|
-
|
|
636
|
+
log.error("This project uses Drizzle's bundled migration format (db/migrations/migrations.js).\n`void db rename-migrations` cannot rename migrations in bundled mode because\n`migrations.js` contains static imports of the SQL files by filename.\n\nDelete db/migrations/migrations.js and re-run `void db generate` to migrate away\nfrom bundled mode, then retry `void db rename-migrations`.");
|
|
638
637
|
process.exit(1);
|
|
639
638
|
}
|
|
640
639
|
const files = readdirSync(migrationsDir).filter((f) => f.endsWith(".sql") && f !== "seed.sql").sort();
|
|
641
640
|
const oldStyleFiles = files.filter((f) => /^\d{1,4}_/.test(f));
|
|
642
641
|
if (oldStyleFiles.length === 0) {
|
|
643
|
-
|
|
644
|
-
|
|
642
|
+
log.info("No migrations with numeric prefixes found. Nothing to rename.");
|
|
643
|
+
outro("Done.");
|
|
645
644
|
return;
|
|
646
645
|
}
|
|
647
646
|
const timestampFiles = files.filter((f) => /^\d{14}_/.test(f));
|
|
@@ -682,9 +681,9 @@ async function runRenameMigrations(root, dialect) {
|
|
|
682
681
|
if (!existsSync(snapshotPathFor(fromTag))) missingSnapshots.push(`meta/${snapshotPrefix(fromTag)}_snapshot.json`);
|
|
683
682
|
}
|
|
684
683
|
if (missingSnapshots.length > 0) {
|
|
685
|
-
|
|
686
|
-
for (const p of missingSnapshots)
|
|
687
|
-
|
|
684
|
+
log.error("db: Cannot rename migrations because one or more Drizzle snapshot files are missing:");
|
|
685
|
+
for (const p of missingSnapshots) log.error(` - db/migrations/${p}`);
|
|
686
|
+
log.error("\nRestore the missing snapshot(s) from version control, or reset the migration directory with `void db generate`, then retry.");
|
|
688
687
|
process.exit(1);
|
|
689
688
|
}
|
|
690
689
|
}
|
|
@@ -692,16 +691,16 @@ async function runRenameMigrations(root, dialect) {
|
|
|
692
691
|
const config = readProjectConfig(root);
|
|
693
692
|
let remoteRenamed = false;
|
|
694
693
|
if (config && !token) {
|
|
695
|
-
|
|
694
|
+
log.error("Project is linked but you are not logged in.\nRun `void auth login` first so remote migration records can be updated.");
|
|
696
695
|
process.exit(1);
|
|
697
696
|
}
|
|
698
697
|
if (token && config) try {
|
|
699
698
|
await new PlatformClient(token, { root }).renameMigrations(config.projectId, renames);
|
|
700
699
|
remoteRenamed = true;
|
|
701
|
-
|
|
700
|
+
log.info("Remote migration records updated.");
|
|
702
701
|
} catch (err) {
|
|
703
|
-
|
|
704
|
-
|
|
702
|
+
log.error("db: Failed to update remote migration records. No local changes were made.\nFix the connection and run `void db rename-migrations` again.");
|
|
703
|
+
log.error(String(err));
|
|
705
704
|
process.exit(1);
|
|
706
705
|
}
|
|
707
706
|
const reverseRemote = async () => {
|
|
@@ -714,7 +713,7 @@ async function runRenameMigrations(root, dialect) {
|
|
|
714
713
|
}));
|
|
715
714
|
await client.renameMigrations(config.projectId, reversed);
|
|
716
715
|
} catch {
|
|
717
|
-
|
|
716
|
+
log.warn("db: Could not reverse remote rename. Run `void deploy` to sync remote records.");
|
|
718
717
|
}
|
|
719
718
|
};
|
|
720
719
|
let journalRewritten = false;
|
|
@@ -723,8 +722,8 @@ async function runRenameMigrations(root, dialect) {
|
|
|
723
722
|
try {
|
|
724
723
|
writeFileSync(journalPath, originalJournalBytes);
|
|
725
724
|
} catch (err) {
|
|
726
|
-
|
|
727
|
-
|
|
725
|
+
log.warn("Could not restore db/migrations/meta/_journal.json after rollback. The journal may be in a partial state.\nRegenerate it with `void db generate`, or restore it from version control.");
|
|
726
|
+
log.warn(String(err));
|
|
728
727
|
}
|
|
729
728
|
};
|
|
730
729
|
const renamed = [];
|
|
@@ -733,8 +732,8 @@ async function runRenameMigrations(root, dialect) {
|
|
|
733
732
|
for (const { from, to } of renamedSnapshots) try {
|
|
734
733
|
renameSync(to, from);
|
|
735
734
|
} catch (err) {
|
|
736
|
-
|
|
737
|
-
|
|
735
|
+
log.warn(`db: Could not reverse snapshot rename for '${from}'. The meta/ directory may be in a partial state.`);
|
|
736
|
+
log.warn(String(err));
|
|
738
737
|
}
|
|
739
738
|
};
|
|
740
739
|
try {
|
|
@@ -744,7 +743,7 @@ async function runRenameMigrations(root, dialect) {
|
|
|
744
743
|
from,
|
|
745
744
|
to
|
|
746
745
|
});
|
|
747
|
-
|
|
746
|
+
log.step(`${from} → ${to}`);
|
|
748
747
|
const fromTag = stripSqlExt(from);
|
|
749
748
|
const toTag = stripSqlExt(to);
|
|
750
749
|
const snapshotFrom = snapshotPathFor(fromTag);
|
|
@@ -764,8 +763,8 @@ async function runRenameMigrations(root, dialect) {
|
|
|
764
763
|
} catch {}
|
|
765
764
|
restoreJournal();
|
|
766
765
|
await reverseRemote();
|
|
767
|
-
|
|
768
|
-
|
|
766
|
+
log.error("db: Failed to rename migration files. All changes have been reverted.");
|
|
767
|
+
log.error(String(err));
|
|
769
768
|
process.exit(1);
|
|
770
769
|
}
|
|
771
770
|
if (originalJournalBytes !== null) try {
|
|
@@ -793,8 +792,8 @@ async function runRenameMigrations(root, dialect) {
|
|
|
793
792
|
} catch {}
|
|
794
793
|
restoreJournal();
|
|
795
794
|
await reverseRemote();
|
|
796
|
-
|
|
797
|
-
|
|
795
|
+
log.error("db: Failed to update db/migrations/meta/_journal.json. File renames have been reverted.");
|
|
796
|
+
log.error(String(err));
|
|
798
797
|
process.exit(1);
|
|
799
798
|
}
|
|
800
799
|
if (dialect === "postgresql") try {
|
|
@@ -816,12 +815,12 @@ async function runRenameMigrations(root, dialect) {
|
|
|
816
815
|
} catch {}
|
|
817
816
|
restoreJournal();
|
|
818
817
|
await reverseRemote();
|
|
819
|
-
|
|
820
|
-
|
|
818
|
+
log.error("db: Failed to update PostgreSQL tracking table. File renames have been reverted.\nFix the database connection and run `void db rename-migrations` again.");
|
|
819
|
+
log.error(String(err));
|
|
821
820
|
process.exit(1);
|
|
822
821
|
}
|
|
823
822
|
else {
|
|
824
|
-
const { getMiniflareDatabasePath, openSqliteDatabase } = await import("./runner-
|
|
823
|
+
const { getMiniflareDatabasePath, openSqliteDatabase } = await import("./runner-h272wcPj.mjs");
|
|
825
824
|
const dbPath = getMiniflareDatabasePath(getLocalD1PersistRoot(root), "local");
|
|
826
825
|
if (existsSync(dbPath)) try {
|
|
827
826
|
const db = await openSqliteDatabase(dbPath);
|
|
@@ -845,22 +844,23 @@ async function runRenameMigrations(root, dialect) {
|
|
|
845
844
|
} catch {}
|
|
846
845
|
restoreJournal();
|
|
847
846
|
await reverseRemote();
|
|
848
|
-
|
|
849
|
-
|
|
847
|
+
log.error("db: Failed to update SQLite tracking table. File renames have been reverted.\nFix the database issue and run `void db rename-migrations` again.");
|
|
848
|
+
log.error(String(err));
|
|
850
849
|
process.exit(1);
|
|
851
850
|
}
|
|
852
851
|
}
|
|
853
|
-
|
|
854
|
-
|
|
852
|
+
log.success(`Renamed ${renames.length} migration(s) to timestamp format.`);
|
|
853
|
+
outro("Done.");
|
|
855
854
|
}
|
|
856
855
|
async function runExport(root, args, dialect) {
|
|
856
|
+
const errOut = { output: process.stderr };
|
|
857
857
|
if (dialect === "postgresql") {
|
|
858
858
|
const parts = [];
|
|
859
859
|
await withPgClient(root, async (client) => {
|
|
860
860
|
let tables;
|
|
861
861
|
if (args.table) {
|
|
862
862
|
if ((await client.query("SELECT tablename FROM pg_tables WHERE schemaname = 'public' AND tablename = $1", [args.table])).rows.length === 0) {
|
|
863
|
-
|
|
863
|
+
log.error(`db: Table '${args.table}' not found.`, errOut);
|
|
864
864
|
process.exit(1);
|
|
865
865
|
}
|
|
866
866
|
tables = [args.table];
|
|
@@ -894,15 +894,15 @@ async function runExport(root, args, dialect) {
|
|
|
894
894
|
const output = parts.join("\n");
|
|
895
895
|
if (args.output) {
|
|
896
896
|
writeFileSync(join(root, args.output), output);
|
|
897
|
-
|
|
898
|
-
|
|
897
|
+
log.success(`Exported to ${args.output}`);
|
|
898
|
+
outro("Done.");
|
|
899
899
|
} else process.stdout.write(output);
|
|
900
900
|
return;
|
|
901
901
|
}
|
|
902
|
-
const { getMiniflareDatabasePath, openSqliteDatabase } = await import("./runner-
|
|
902
|
+
const { getMiniflareDatabasePath, openSqliteDatabase } = await import("./runner-h272wcPj.mjs");
|
|
903
903
|
const dbPath = getMiniflareDatabasePath(getLocalD1PersistRoot(root), "local");
|
|
904
904
|
if (!existsSync(dbPath)) {
|
|
905
|
-
|
|
905
|
+
log.error("No local database found. Run `void dev` first.", errOut);
|
|
906
906
|
process.exit(1);
|
|
907
907
|
}
|
|
908
908
|
const db = await openSqliteDatabase(dbPath, { readonly: true });
|
|
@@ -910,7 +910,7 @@ async function runExport(root, args, dialect) {
|
|
|
910
910
|
let tables;
|
|
911
911
|
if (args.table) {
|
|
912
912
|
if (!db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name=?").get(args.table)) {
|
|
913
|
-
|
|
913
|
+
log.error(`db: Table '${args.table}' not found.`, errOut);
|
|
914
914
|
process.exit(1);
|
|
915
915
|
}
|
|
916
916
|
tables = [args.table];
|
|
@@ -939,30 +939,30 @@ async function runExport(root, args, dialect) {
|
|
|
939
939
|
const output = parts.join("\n");
|
|
940
940
|
if (args.output) {
|
|
941
941
|
writeFileSync(join(root, args.output), output);
|
|
942
|
-
|
|
943
|
-
|
|
942
|
+
log.success(`Exported to ${args.output}`);
|
|
943
|
+
outro("Done.");
|
|
944
944
|
} else process.stdout.write(output);
|
|
945
945
|
} finally {
|
|
946
946
|
db.close();
|
|
947
947
|
}
|
|
948
948
|
}
|
|
949
949
|
async function runSetUrl(root) {
|
|
950
|
-
const { readConfig: readVoidConfig, getDatabaseDialect: getDialect } = await import("./config-
|
|
950
|
+
const { readConfig: readVoidConfig, getDatabaseDialect: getDialect } = await import("./config-1twldYCW.mjs").then((n) => n.n);
|
|
951
951
|
if (getDialect(readVoidConfig(root)) !== "postgresql") {
|
|
952
|
-
|
|
952
|
+
log.error("db: This command is only for PostgreSQL projects. Set \"database\": \"pg\" in void.json.");
|
|
953
953
|
process.exit(1);
|
|
954
954
|
}
|
|
955
955
|
const token = getToken(root);
|
|
956
956
|
if (!token) {
|
|
957
|
-
|
|
957
|
+
log.error("No auth token found. Run `void auth login` first.");
|
|
958
958
|
process.exit(1);
|
|
959
959
|
}
|
|
960
960
|
const projectConfig = readProjectConfig(root);
|
|
961
961
|
if (!projectConfig) {
|
|
962
|
-
|
|
962
|
+
log.error("No project linked. Run `void deploy` first or link a project.");
|
|
963
963
|
process.exit(1);
|
|
964
964
|
}
|
|
965
|
-
const { text: promptText, isCancel: isCancelCheck } = await import("./
|
|
965
|
+
const { text: promptText, isCancel: isCancelCheck } = await import("./agents-Bmr5tFFb.mjs").then((n) => n.C);
|
|
966
966
|
const connectionString = await promptText({
|
|
967
967
|
message: "Enter your PostgreSQL connection string:",
|
|
968
968
|
placeholder: "postgresql://user:pass@host:5432/dbname",
|
|
@@ -972,19 +972,19 @@ async function runSetUrl(root) {
|
|
|
972
972
|
});
|
|
973
973
|
if (isCancelCheck(connectionString)) process.exit(0);
|
|
974
974
|
await new PlatformClient(token, { root }).setDatabaseUrl(projectConfig.projectId, connectionString);
|
|
975
|
-
|
|
976
|
-
|
|
975
|
+
log.success("Database URL updated.");
|
|
976
|
+
outro("Done.");
|
|
977
977
|
}
|
|
978
978
|
function resolveSeedTarget(root, file) {
|
|
979
979
|
if (file) return toSeedTarget(root, resolve(root, file), file);
|
|
980
980
|
const paths = readProjectPaths(root);
|
|
981
981
|
const defaults = DEFAULT_SEED_FILES.map((candidate) => paths.sourceRelative(candidate)).filter((candidate) => existsSync(join(root, candidate)));
|
|
982
982
|
if (defaults.length === 0) {
|
|
983
|
-
|
|
983
|
+
log.error(`db: No seed file found. Create one of: ${DEFAULT_SEED_FILES.map((candidate) => paths.sourceRelative(candidate)).join(", ")} or pass --file <path>.`);
|
|
984
984
|
process.exit(1);
|
|
985
985
|
}
|
|
986
986
|
if (defaults.length > 1) {
|
|
987
|
-
|
|
987
|
+
log.error(`db: Multiple default seed files found: ${defaults.join(", ")}. Use --file <path> to choose one.`);
|
|
988
988
|
process.exit(1);
|
|
989
989
|
}
|
|
990
990
|
const [seedPath] = defaults;
|
|
@@ -992,7 +992,7 @@ function resolveSeedTarget(root, file) {
|
|
|
992
992
|
}
|
|
993
993
|
function toSeedTarget(root, seedPath, displayPath) {
|
|
994
994
|
if (!existsSync(seedPath)) {
|
|
995
|
-
|
|
995
|
+
log.error(`db: Seed file '${seedPath}' not found.`);
|
|
996
996
|
process.exit(1);
|
|
997
997
|
}
|
|
998
998
|
const ext = extname(seedPath);
|
|
@@ -1007,7 +1007,7 @@ function toSeedTarget(root, seedPath, displayPath) {
|
|
|
1007
1007
|
displayPath: normalizedDisplay,
|
|
1008
1008
|
kind: "module"
|
|
1009
1009
|
};
|
|
1010
|
-
|
|
1010
|
+
log.error(`db: Unsupported seed file '${normalizedDisplay}'. Use .sql, .ts, .mts, .js, or .mjs.`);
|
|
1011
1011
|
process.exit(1);
|
|
1012
1012
|
}
|
|
1013
1013
|
async function runSeedModule(root, seedPath, dialect) {
|
|
@@ -1018,16 +1018,17 @@ async function runSeedModule(root, seedPath, dialect) {
|
|
|
1018
1018
|
await withPgClient(root, async (client) => {
|
|
1019
1019
|
const options = getDrizzleSchemaOptions(schema);
|
|
1020
1020
|
const drizzleClient = client;
|
|
1021
|
+
const db = options ? drizzle(drizzleClient, options) : drizzle(drizzleClient);
|
|
1021
1022
|
await seed({
|
|
1022
1023
|
dialect,
|
|
1023
|
-
db
|
|
1024
|
+
db,
|
|
1024
1025
|
schema
|
|
1025
1026
|
});
|
|
1026
1027
|
});
|
|
1027
1028
|
return;
|
|
1028
1029
|
}
|
|
1029
1030
|
const { drizzle } = await import("drizzle-orm/better-sqlite3");
|
|
1030
|
-
const { getMiniflareDatabasePath, openSqliteDatabase } = await import("./runner-
|
|
1031
|
+
const { getMiniflareDatabasePath, openSqliteDatabase } = await import("./runner-h272wcPj.mjs");
|
|
1031
1032
|
const sqlite = await openSqliteDatabase(getMiniflareDatabasePath(getLocalD1PersistRoot(root), "local"));
|
|
1032
1033
|
try {
|
|
1033
1034
|
const options = getDrizzleSchemaOptions(schema);
|
|
@@ -1047,7 +1048,7 @@ async function loadSeedFunction(seedPath) {
|
|
|
1047
1048
|
return seed;
|
|
1048
1049
|
}
|
|
1049
1050
|
async function loadSeedSchema(root) {
|
|
1050
|
-
const { discoverSchema } = await import("./discover-
|
|
1051
|
+
const { discoverSchema } = await import("./discover-BuVVSAum.mjs").then((n) => n.n);
|
|
1051
1052
|
const location = discoverSchema(root, readProjectPaths(root));
|
|
1052
1053
|
if (!location) return {};
|
|
1053
1054
|
if (location.type === "file") {
|