void 0.10.5 → 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-UoCwfDQv.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-CVyuBHjP.mjs → build-cmd-Br8qL0rA.mjs} +15 -17
- package/dist/{cache-ACORQCIq.mjs → cache-wH-mP8UE.mjs} +10 -12
- package/dist/{cancel-deploy-Gi8zmoZC.mjs → cancel-deploy-BEBOEgtu.mjs} +16 -18
- package/dist/cli/cli.mjs +47 -49
- package/dist/{client-BlbnA92X.mjs → client-Cj96iiBH.mjs} +74 -8
- package/dist/{config-8dLIngKW.mjs → config-1twldYCW.mjs} +10 -10
- package/dist/{config-CbJS4Krx.mjs → config-BdUctCZD.mjs} +4 -4
- package/dist/{create-project-LjvkYziS.mjs → create-project-DD9n8Ho-.mjs} +28 -23
- package/dist/{db-C00yjN01.mjs → db-DjKE2-A-.mjs} +147 -149
- package/dist/{delete-CplfvTgU.mjs → delete-D2kr3Kmk.mjs} +13 -15
- package/dist/{deploy-CISNL5uK.mjs → deploy-C4PbkFyE.mjs} +97 -100
- package/dist/{discover-ZWuBvt22.mjs → discover-BuVVSAum.mjs} +3 -3
- package/dist/{dist-5cGIJHQQ.mjs → dist-BuiRJkTd.mjs} +59 -27
- package/dist/{domain-B4HpcgNG.mjs → domain-_luIsM_B.mjs} +14 -16
- package/dist/{env-DNMJpeVF.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-BS8cZead.mjs → env-types-D51bnR-c.mjs} +3 -3
- package/dist/{env-validation-BxbtBbjh.mjs → env-validation-CeC2FL66.mjs} +4 -4
- package/dist/{fetch-error-C6qffTl2.mjs → fetch-error-Dj3crt0e.mjs} +3 -3
- package/dist/{gen-C0pV2gRQ.mjs → gen-Cf79J4aw.mjs} +42 -44
- package/dist/{github-cmd-CwtLD1yI.mjs → github-cmd-DnqxyOsb.mjs} +88 -90
- 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-D58GxCtt.mjs → init-KirOzVDs.mjs} +132 -134
- package/dist/link-CUmiosyb.mjs +45 -0
- package/dist/{list-CbNNjXTm.mjs → list-3GEw7b6m.mjs} +10 -12
- package/dist/{login-CvxxF_9z.mjs → login-DJReaT_Q.mjs} +14 -15
- package/dist/{logs-BDZ9AuhM.mjs → logs-D-rQ56Lq.mjs} +9 -11
- package/dist/{magic-string.es-C1Fb0uxq.mjs → magic-string.es-ZQjdJFFn.mjs} +3 -3
- package/dist/{mcp-C8BjRt_z.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-D04iL1mW.mjs → plugin-inference-CJxi_fWI.mjs} +3 -3
- package/dist/{prepare-DUo9q8cM.mjs → prepare-C_cVurhP.mjs} +15 -18
- package/dist/{preset-D0My64KQ.mjs → preset-CVvwCeIy.mjs} +4 -4
- package/dist/{project-cmd-Dd1gNRdd.mjs → project-cmd-DnU7u9QF.mjs} +13 -14
- package/dist/{project-paths-CCMrHYQm.mjs → project-paths-tpdR1mJR.mjs} +2 -2
- package/dist/{project-tsconfig-DMBV55K2.mjs → project-tsconfig-D9uSVVpA.mjs} +2 -2
- 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-DzmCCrFg.mjs → rollback-Yh7bCKob.mjs} +21 -23
- package/dist/{route-types-BpSJEW20.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---8wfN58.mjs → scan-i7Yz54fv.mjs} +26 -8
- package/dist/{secret-CMLYWkE-.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 +1 -1
- 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 +5 -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-ZFmboqY3.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-C0pV2gRQ.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",
|
|
@@ -84,7 +81,7 @@ async function runDbCommand(root, args) {
|
|
|
84
81
|
const exportToStdout = args.action === "export" && !args.output;
|
|
85
82
|
if (exportToStdout) process.stderr.write("\n");
|
|
86
83
|
else console.log();
|
|
87
|
-
|
|
84
|
+
intro(cliTitle("db"), exportToStdout ? { output: process.stderr } : void 0);
|
|
88
85
|
const dialect = getDatabaseDialect(readConfig(root));
|
|
89
86
|
if (args.action === "push") await runPush(root, dialect);
|
|
90
87
|
else if (args.action === "generate") await runGenerate(root, dialect);
|
|
@@ -99,13 +96,13 @@ async function runDbCommand(root, args) {
|
|
|
99
96
|
else await runExport(root, args, dialect);
|
|
100
97
|
}
|
|
101
98
|
async function runPush(root, dialect) {
|
|
102
|
-
const { writeDrizzleConfig } = await import("./config-
|
|
99
|
+
const { writeDrizzleConfig } = await import("./config-BdUctCZD.mjs").then((n) => n.t);
|
|
103
100
|
let configPath;
|
|
104
101
|
if (dialect === "postgresql") configPath = writeDrizzleConfig(root, getPgUrl(root), "postgresql");
|
|
105
102
|
else {
|
|
106
103
|
const { mkdirSync } = await import("node:fs");
|
|
107
104
|
const { dirname } = await import("node:path");
|
|
108
|
-
const { getMiniflareDatabasePath } = await import("./runner-
|
|
105
|
+
const { getMiniflareDatabasePath } = await import("./runner-h272wcPj.mjs");
|
|
109
106
|
const dbPath = getMiniflareDatabasePath(getLocalD1PersistRoot(root), "local");
|
|
110
107
|
mkdirSync(dirname(dbPath), { recursive: true });
|
|
111
108
|
configPath = writeDrizzleConfig(root, dbPath);
|
|
@@ -119,10 +116,10 @@ async function runPush(root, dialect) {
|
|
|
119
116
|
} catch {
|
|
120
117
|
process.exit(1);
|
|
121
118
|
}
|
|
122
|
-
|
|
119
|
+
outro("Done.");
|
|
123
120
|
}
|
|
124
121
|
async function runGenerate(root, dialect) {
|
|
125
|
-
const { writeDrizzleConfig } = await import("./config-
|
|
122
|
+
const { writeDrizzleConfig } = await import("./config-BdUctCZD.mjs").then((n) => n.t);
|
|
126
123
|
const configPath = dialect === "postgresql" ? writeDrizzleConfig(root, "postgresql://dummy", "postgresql") : writeDrizzleConfig(root, ":memory:");
|
|
127
124
|
try {
|
|
128
125
|
runDrizzleKit(root, [
|
|
@@ -133,7 +130,7 @@ async function runGenerate(root, dialect) {
|
|
|
133
130
|
} catch {
|
|
134
131
|
process.exit(1);
|
|
135
132
|
}
|
|
136
|
-
|
|
133
|
+
outro("Done.");
|
|
137
134
|
}
|
|
138
135
|
async function runStatus(root, dialect) {
|
|
139
136
|
const paths = readProjectPaths(root);
|
|
@@ -142,12 +139,12 @@ async function runStatus(root, dialect) {
|
|
|
142
139
|
try {
|
|
143
140
|
assertJournalCoherence(migrationsDir, allMigrations);
|
|
144
141
|
} catch (err) {
|
|
145
|
-
|
|
142
|
+
log.error(getErrorMessage(err));
|
|
146
143
|
process.exit(1);
|
|
147
144
|
}
|
|
148
145
|
if (allMigrations.length === 0) {
|
|
149
|
-
|
|
150
|
-
|
|
146
|
+
log.info(`No migration files found in ${paths.sourceRelative("db/migrations")}/`);
|
|
147
|
+
outro("Done.");
|
|
151
148
|
return;
|
|
152
149
|
}
|
|
153
150
|
let localApplied;
|
|
@@ -163,7 +160,7 @@ async function runStatus(root, dialect) {
|
|
|
163
160
|
localApplied = [];
|
|
164
161
|
}
|
|
165
162
|
else {
|
|
166
|
-
const { getMiniflareDatabasePath, getAppliedMigrations } = await import("./runner-
|
|
163
|
+
const { getMiniflareDatabasePath, getAppliedMigrations } = await import("./runner-h272wcPj.mjs");
|
|
167
164
|
localApplied = await getAppliedMigrations(getMiniflareDatabasePath(getLocalD1PersistRoot(root), "local"));
|
|
168
165
|
}
|
|
169
166
|
const localSet = new Set(localApplied.map((m) => m.name));
|
|
@@ -181,7 +178,7 @@ async function runStatus(root, dialect) {
|
|
|
181
178
|
if (remoteSet !== null) remotePart = ` remote: ${remoteSet.has(migration.name) ? import_picocolors.default.green("applied") : import_picocolors.default.yellow("pending")}`;
|
|
182
179
|
lines.push(` ${migration.name} ${dim("local:")} ${localStatus}${remotePart}`);
|
|
183
180
|
}
|
|
184
|
-
|
|
181
|
+
log.info(lines.join("\n"));
|
|
185
182
|
const localPending = allMigrations.length - localSet.size;
|
|
186
183
|
const parts = [`${allMigrations.length} migration(s)`];
|
|
187
184
|
if (localPending > 0) parts.push(`${localPending} pending locally`);
|
|
@@ -189,7 +186,7 @@ async function runStatus(root, dialect) {
|
|
|
189
186
|
const remotePending = allMigrations.length - remoteSet.size;
|
|
190
187
|
if (remotePending > 0) parts.push(`${remotePending} pending remotely`);
|
|
191
188
|
}
|
|
192
|
-
|
|
189
|
+
outro(parts.join(", "));
|
|
193
190
|
}
|
|
194
191
|
async function resetDatabase(root, dialect) {
|
|
195
192
|
const migrationsDir = readProjectPaths(root).migrationsDir;
|
|
@@ -197,7 +194,7 @@ async function resetDatabase(root, dialect) {
|
|
|
197
194
|
try {
|
|
198
195
|
assertJournalCoherence(migrationsDir, migrations);
|
|
199
196
|
} catch (err) {
|
|
200
|
-
|
|
197
|
+
log.error(getErrorMessage(err));
|
|
201
198
|
process.exit(1);
|
|
202
199
|
}
|
|
203
200
|
if (dialect === "postgresql") {
|
|
@@ -221,7 +218,7 @@ async function resetDatabase(root, dialect) {
|
|
|
221
218
|
});
|
|
222
219
|
return migrations.length;
|
|
223
220
|
}
|
|
224
|
-
const { getMiniflareDatabasePath, runMigrations } = await import("./runner-
|
|
221
|
+
const { getMiniflareDatabasePath, runMigrations } = await import("./runner-h272wcPj.mjs");
|
|
225
222
|
const dbPath = getMiniflareDatabasePath(getLocalD1PersistRoot(root), "local");
|
|
226
223
|
rmSync(dbPath, { force: true });
|
|
227
224
|
rmSync(dbPath + "-wal", { force: true });
|
|
@@ -230,13 +227,13 @@ async function resetDatabase(root, dialect) {
|
|
|
230
227
|
}
|
|
231
228
|
async function runReset(root, dialect) {
|
|
232
229
|
const count = await resetDatabase(root, dialect);
|
|
233
|
-
|
|
234
|
-
if (dialect !== "postgresql")
|
|
235
|
-
|
|
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.");
|
|
236
233
|
}
|
|
237
234
|
async function runSeed(root, file, dialect) {
|
|
238
235
|
const migrationCount = await resetDatabase(root, dialect);
|
|
239
|
-
|
|
236
|
+
log.step(`Reset database. Applied ${migrationCount} migration(s).`);
|
|
240
237
|
const seed = resolveSeedTarget(root, file);
|
|
241
238
|
if (seed.kind === "sql") {
|
|
242
239
|
const sql = readFileSync(seed.path, "utf-8");
|
|
@@ -244,11 +241,11 @@ async function runSeed(root, file, dialect) {
|
|
|
244
241
|
await withPgClient(root, async (client) => {
|
|
245
242
|
await client.query(sql);
|
|
246
243
|
});
|
|
247
|
-
|
|
248
|
-
|
|
244
|
+
log.success(`Seeded from ${seed.displayPath}.`);
|
|
245
|
+
outro("Done.");
|
|
249
246
|
return;
|
|
250
247
|
}
|
|
251
|
-
const { getMiniflareDatabasePath, openSqliteDatabase } = await import("./runner-
|
|
248
|
+
const { getMiniflareDatabasePath, openSqliteDatabase } = await import("./runner-h272wcPj.mjs");
|
|
252
249
|
const db = await openSqliteDatabase(getMiniflareDatabasePath(getLocalD1PersistRoot(root), "local"));
|
|
253
250
|
try {
|
|
254
251
|
db.exec(sql);
|
|
@@ -256,9 +253,9 @@ async function runSeed(root, file, dialect) {
|
|
|
256
253
|
db.close();
|
|
257
254
|
}
|
|
258
255
|
} else await runSeedModule(root, seed.path, dialect);
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
256
|
+
log.success(`Seeded from ${seed.displayPath}.`);
|
|
257
|
+
log.info(dim("Restart your dev server if it's running."));
|
|
258
|
+
outro("Done.");
|
|
262
259
|
}
|
|
263
260
|
/**
|
|
264
261
|
* Returns true when the SQL is read-only (SELECT / EXPLAIN only).
|
|
@@ -315,7 +312,7 @@ async function fetchRemoteDatabaseUrl(client, projectId) {
|
|
|
315
312
|
return (await client.getDatabaseUrl(projectId)).url;
|
|
316
313
|
} catch (err) {
|
|
317
314
|
if (err instanceof PlatformApiError && err.status === 404) {
|
|
318
|
-
|
|
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.");
|
|
319
316
|
process.exit(1);
|
|
320
317
|
}
|
|
321
318
|
throw err;
|
|
@@ -328,29 +325,29 @@ async function fetchRemoteDatabaseUrl(client, projectId) {
|
|
|
328
325
|
async function confirmDestructiveRemote(sql) {
|
|
329
326
|
if (isSafeStatement(sql)) return true;
|
|
330
327
|
if (!process.stdin.isTTY) return true;
|
|
331
|
-
const ok = await
|
|
332
|
-
if (
|
|
328
|
+
const ok = await confirm({ message: "This will run against your deployed database. Continue?" });
|
|
329
|
+
if (isCancel(ok) || !ok) return false;
|
|
333
330
|
return true;
|
|
334
331
|
}
|
|
335
332
|
async function runExecute(root, command, file, dialect, remote) {
|
|
336
333
|
if (remote) {
|
|
337
334
|
if (dialect !== "postgresql" && file) {
|
|
338
|
-
|
|
335
|
+
log.error("--file is not yet supported with --remote D1; pipe statements through stdin or run them one at a time.");
|
|
339
336
|
process.exit(1);
|
|
340
337
|
}
|
|
341
338
|
const sql = file ? readFileSync(join(root, file), "utf-8") : command;
|
|
342
339
|
const token = getToken(root);
|
|
343
340
|
if (!token) {
|
|
344
|
-
|
|
341
|
+
log.error("Not logged in. Run `void auth login` first.");
|
|
345
342
|
process.exit(1);
|
|
346
343
|
}
|
|
347
344
|
const projectConfig = readProjectConfig(root);
|
|
348
345
|
if (!projectConfig) {
|
|
349
|
-
|
|
346
|
+
log.error("No project linked. Run `void deploy` first or link a project.");
|
|
350
347
|
process.exit(1);
|
|
351
348
|
}
|
|
352
349
|
if (!await confirmDestructiveRemote(sql)) {
|
|
353
|
-
|
|
350
|
+
log.info("Cancelled.");
|
|
354
351
|
process.exit(0);
|
|
355
352
|
}
|
|
356
353
|
if (dialect === "postgresql") {
|
|
@@ -361,11 +358,11 @@ async function runExecute(root, command, file, dialect, remote) {
|
|
|
361
358
|
try {
|
|
362
359
|
const result = await pgClient.query(sql);
|
|
363
360
|
if (result.rows && result.rows.length > 0) printTable(result.rows);
|
|
364
|
-
else
|
|
361
|
+
else log.success("Executed successfully.");
|
|
365
362
|
} finally {
|
|
366
363
|
await pgClient.end();
|
|
367
364
|
}
|
|
368
|
-
|
|
365
|
+
outro("Done.");
|
|
369
366
|
return;
|
|
370
367
|
}
|
|
371
368
|
const platformClient = new PlatformClient(token, { root });
|
|
@@ -392,13 +389,13 @@ async function runExecute(root, command, file, dialect, remote) {
|
|
|
392
389
|
});
|
|
393
390
|
if (!res.ok) {
|
|
394
391
|
const text = await res.text().catch(() => res.statusText);
|
|
395
|
-
|
|
392
|
+
log.error(`db: Proxy request failed with ${res.status}: '${text}'.`);
|
|
396
393
|
process.exit(1);
|
|
397
394
|
}
|
|
398
395
|
const rows = (await res.json()).results ?? [];
|
|
399
396
|
if (rows.length > 0) printTable(rows);
|
|
400
|
-
else
|
|
401
|
-
|
|
397
|
+
else log.success("Executed successfully.");
|
|
398
|
+
outro("Done.");
|
|
402
399
|
return;
|
|
403
400
|
}
|
|
404
401
|
if (dialect === "postgresql") {
|
|
@@ -406,15 +403,15 @@ async function runExecute(root, command, file, dialect, remote) {
|
|
|
406
403
|
await withPgClient(root, async (client) => {
|
|
407
404
|
const result = await client.query(sql);
|
|
408
405
|
if (result.rows && result.rows.length > 0) printTable(result.rows);
|
|
409
|
-
else
|
|
406
|
+
else log.success("Executed successfully.");
|
|
410
407
|
});
|
|
411
|
-
|
|
408
|
+
outro("Done.");
|
|
412
409
|
return;
|
|
413
410
|
}
|
|
414
|
-
const { getMiniflareDatabasePath, openSqliteDatabase } = await import("./runner-
|
|
411
|
+
const { getMiniflareDatabasePath, openSqliteDatabase } = await import("./runner-h272wcPj.mjs");
|
|
415
412
|
const dbPath = getMiniflareDatabasePath(getLocalD1PersistRoot(root), "local");
|
|
416
413
|
if (!existsSync(dbPath)) {
|
|
417
|
-
|
|
414
|
+
log.error("No local database found. Run `void dev` first.");
|
|
418
415
|
process.exit(1);
|
|
419
416
|
}
|
|
420
417
|
const sql = file ? readFileSync(join(root, file), "utf-8") : command;
|
|
@@ -423,16 +420,16 @@ async function runExecute(root, command, file, dialect, remote) {
|
|
|
423
420
|
const trimmed = sql.trimStart();
|
|
424
421
|
if (/^SELECT\b/i.test(trimmed)) {
|
|
425
422
|
const rows = db.prepare(sql).all();
|
|
426
|
-
if (rows.length === 0)
|
|
423
|
+
if (rows.length === 0) log.info("No rows returned.");
|
|
427
424
|
else printTable(rows);
|
|
428
425
|
} else {
|
|
429
426
|
db.exec(sql);
|
|
430
|
-
|
|
427
|
+
log.success("Executed successfully.");
|
|
431
428
|
}
|
|
432
429
|
} finally {
|
|
433
430
|
db.close();
|
|
434
431
|
}
|
|
435
|
-
|
|
432
|
+
outro("Done.");
|
|
436
433
|
}
|
|
437
434
|
function printTable(rows) {
|
|
438
435
|
const cols = Object.keys(rows[0]);
|
|
@@ -455,27 +452,27 @@ async function runMigrate(root, dialect, remote) {
|
|
|
455
452
|
try {
|
|
456
453
|
assertJournalCoherence(migrationsDir, rawMigrations);
|
|
457
454
|
} catch (err) {
|
|
458
|
-
|
|
455
|
+
log.error(getErrorMessage(err));
|
|
459
456
|
process.exit(1);
|
|
460
457
|
}
|
|
461
458
|
if (remote) {
|
|
462
459
|
if (dialect === "postgresql") {
|
|
463
|
-
|
|
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.");
|
|
464
461
|
process.exit(1);
|
|
465
462
|
}
|
|
466
463
|
const token = getToken(root);
|
|
467
464
|
if (!token) {
|
|
468
|
-
|
|
465
|
+
log.error("Not logged in. Run `void auth login` first.");
|
|
469
466
|
process.exit(1);
|
|
470
467
|
}
|
|
471
468
|
const config = readProjectConfig(root);
|
|
472
469
|
if (!config) {
|
|
473
|
-
|
|
470
|
+
log.error("No project linked. Run `void deploy` first or link a project.");
|
|
474
471
|
process.exit(1);
|
|
475
472
|
}
|
|
476
473
|
if (rawMigrations.length === 0) {
|
|
477
|
-
|
|
478
|
-
|
|
474
|
+
log.info(`No migration files found in ${paths.sourceRelative("db/migrations")}/`);
|
|
475
|
+
outro("Done.");
|
|
479
476
|
return;
|
|
480
477
|
}
|
|
481
478
|
const client = new PlatformClient(token, { root });
|
|
@@ -484,37 +481,37 @@ async function runMigrate(root, dialect, remote) {
|
|
|
484
481
|
const status = await client.getMigrationStatus(config.projectId, dialect);
|
|
485
482
|
remoteApplied = new Set(status.applied.map((m) => m.name));
|
|
486
483
|
} catch (err) {
|
|
487
|
-
|
|
484
|
+
log.error(`db: Failed to fetch remote migration status: '${err instanceof Error ? err.message : String(err)}'.`);
|
|
488
485
|
process.exit(1);
|
|
489
486
|
}
|
|
490
487
|
const pendingMigrations = rawMigrations.filter((m) => !remoteApplied.has(m.name));
|
|
491
488
|
if (pendingMigrations.length === 0) {
|
|
492
|
-
|
|
493
|
-
|
|
489
|
+
log.info("Remote database is up to date.");
|
|
490
|
+
outro("Done.");
|
|
494
491
|
return;
|
|
495
492
|
}
|
|
496
493
|
try {
|
|
497
494
|
validateMigrations(pendingMigrations);
|
|
498
495
|
} catch (err) {
|
|
499
|
-
|
|
496
|
+
log.error(getErrorMessage(err));
|
|
500
497
|
process.exit(1);
|
|
501
498
|
}
|
|
502
499
|
const result = await client.applyRemoteMigrations(config.projectId, pendingMigrations);
|
|
503
500
|
if (!result.ok) {
|
|
504
|
-
|
|
501
|
+
log.error(result.error ? `db: Remote migration failed: '${result.error}'.` : "db: Remote migration failed.");
|
|
505
502
|
process.exit(1);
|
|
506
503
|
}
|
|
507
|
-
if (result.applied.length === 0)
|
|
504
|
+
if (result.applied.length === 0) log.info("Remote database is up to date.");
|
|
508
505
|
else {
|
|
509
|
-
for (const name of result.applied)
|
|
510
|
-
|
|
506
|
+
for (const name of result.applied) log.step(name);
|
|
507
|
+
log.success(`Applied ${result.applied.length} migration(s) to remote database.`);
|
|
511
508
|
}
|
|
512
|
-
for (const warning of result.warnings ?? [])
|
|
513
|
-
|
|
509
|
+
for (const warning of result.warnings ?? []) log.warn(warning);
|
|
510
|
+
outro("Done.");
|
|
514
511
|
return;
|
|
515
512
|
}
|
|
516
513
|
if (dialect === "postgresql") {
|
|
517
|
-
const { applyPgMigrations } = await import("./runner-pg-
|
|
514
|
+
const { applyPgMigrations } = await import("./runner-pg-waxJOnBb.mjs");
|
|
518
515
|
const applied = await withPgClient(root, async (client) => {
|
|
519
516
|
let existingRows = [];
|
|
520
517
|
try {
|
|
@@ -525,57 +522,57 @@ async function runMigrate(root, dialect, remote) {
|
|
|
525
522
|
try {
|
|
526
523
|
validatePendingMigrations(rawMigrations, new Set(existingRows.map((row) => row.name)));
|
|
527
524
|
} catch (err) {
|
|
528
|
-
|
|
525
|
+
log.error(getErrorMessage(err));
|
|
529
526
|
process.exit(1);
|
|
530
527
|
}
|
|
531
528
|
return applyPgMigrations(client, rawMigrations);
|
|
532
529
|
});
|
|
533
|
-
if (applied.length === 0)
|
|
530
|
+
if (applied.length === 0) log.info("All migrations are up to date.");
|
|
534
531
|
else {
|
|
535
|
-
for (const name of applied)
|
|
536
|
-
|
|
532
|
+
for (const name of applied) log.step(name);
|
|
533
|
+
log.success(`Applied ${applied.length} migration(s).`);
|
|
537
534
|
}
|
|
538
|
-
|
|
535
|
+
outro("Done.");
|
|
539
536
|
return;
|
|
540
537
|
}
|
|
541
|
-
const { getMiniflareDatabasePath, getAppliedMigrations, runMigrations } = await import("./runner-
|
|
538
|
+
const { getMiniflareDatabasePath, getAppliedMigrations, runMigrations } = await import("./runner-h272wcPj.mjs");
|
|
542
539
|
const dbPath = getMiniflareDatabasePath(getLocalD1PersistRoot(root), "local");
|
|
543
540
|
try {
|
|
544
541
|
const existingRows = await getAppliedMigrations(dbPath);
|
|
545
542
|
validatePendingMigrations(rawMigrations, new Set(existingRows.map((row) => row.name)));
|
|
546
543
|
} catch (err) {
|
|
547
|
-
|
|
544
|
+
log.error(getErrorMessage(err));
|
|
548
545
|
process.exit(1);
|
|
549
546
|
}
|
|
550
547
|
const applied = await runMigrations(migrationsDir, dbPath);
|
|
551
|
-
if (applied.length === 0)
|
|
548
|
+
if (applied.length === 0) log.info("All migrations are up to date.");
|
|
552
549
|
else {
|
|
553
|
-
for (const name of applied)
|
|
554
|
-
|
|
555
|
-
|
|
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."));
|
|
556
553
|
}
|
|
557
|
-
|
|
554
|
+
outro("Done.");
|
|
558
555
|
}
|
|
559
556
|
async function runStudio(root, dialect, remote) {
|
|
560
557
|
if (remote) {
|
|
561
558
|
if (dialect !== "postgresql") {
|
|
562
|
-
|
|
559
|
+
log.error("Remote D1 studio is not yet supported. Use `void db execute --remote` for ad-hoc queries against your deployed D1 database.");
|
|
563
560
|
process.exit(1);
|
|
564
561
|
}
|
|
565
562
|
const token = getToken(root);
|
|
566
563
|
if (!token) {
|
|
567
|
-
|
|
564
|
+
log.error("Not logged in. Run `void auth login` first.");
|
|
568
565
|
process.exit(1);
|
|
569
566
|
}
|
|
570
567
|
const projectConfig = readProjectConfig(root);
|
|
571
568
|
if (!projectConfig) {
|
|
572
|
-
|
|
569
|
+
log.error("No project linked. Run `void deploy` first or link a project.");
|
|
573
570
|
process.exit(1);
|
|
574
571
|
}
|
|
575
572
|
const dbUrl = await fetchRemoteDatabaseUrl(new PlatformClient(token, { root }), projectConfig.projectId);
|
|
576
|
-
const { writeDrizzleConfig } = await import("./config-
|
|
573
|
+
const { writeDrizzleConfig } = await import("./config-BdUctCZD.mjs").then((n) => n.t);
|
|
577
574
|
const configPath = writeDrizzleConfig(root, dbUrl, "postgresql");
|
|
578
|
-
|
|
575
|
+
log.info("Opening Drizzle Studio (remote)...");
|
|
579
576
|
try {
|
|
580
577
|
runDrizzleKit(root, [
|
|
581
578
|
"studio",
|
|
@@ -588,9 +585,9 @@ async function runStudio(root, dialect, remote) {
|
|
|
588
585
|
return;
|
|
589
586
|
}
|
|
590
587
|
if (dialect === "postgresql") {
|
|
591
|
-
const { writeDrizzleConfig } = await import("./config-
|
|
588
|
+
const { writeDrizzleConfig } = await import("./config-BdUctCZD.mjs").then((n) => n.t);
|
|
592
589
|
const configPath = writeDrizzleConfig(root, getPgUrl(root), "postgresql");
|
|
593
|
-
|
|
590
|
+
log.info("Opening Drizzle Studio...");
|
|
594
591
|
try {
|
|
595
592
|
runDrizzleKit(root, [
|
|
596
593
|
"studio",
|
|
@@ -602,15 +599,15 @@ async function runStudio(root, dialect, remote) {
|
|
|
602
599
|
}
|
|
603
600
|
return;
|
|
604
601
|
}
|
|
605
|
-
const { writeDrizzleConfig } = await import("./config-
|
|
606
|
-
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");
|
|
607
604
|
const dbPath = getMiniflareDatabasePath(getLocalD1PersistRoot(root), "local");
|
|
608
605
|
if (!existsSync(dbPath)) {
|
|
609
|
-
|
|
606
|
+
log.error("No local database found. Run `void dev` first.");
|
|
610
607
|
process.exit(1);
|
|
611
608
|
}
|
|
612
609
|
const configPath = writeDrizzleConfig(root, dbPath);
|
|
613
|
-
|
|
610
|
+
log.info("Opening Drizzle Studio...");
|
|
614
611
|
try {
|
|
615
612
|
runDrizzleKit(root, [
|
|
616
613
|
"studio",
|
|
@@ -624,26 +621,26 @@ async function runStudio(root, dialect, remote) {
|
|
|
624
621
|
async function runRenameMigrations(root, dialect) {
|
|
625
622
|
const migrationsDir = readProjectPaths(root).migrationsDir;
|
|
626
623
|
if (!existsSync(migrationsDir)) {
|
|
627
|
-
|
|
628
|
-
|
|
624
|
+
log.info("No migrations directory found.");
|
|
625
|
+
outro("Done.");
|
|
629
626
|
return;
|
|
630
627
|
}
|
|
631
628
|
const currentMigrations = collectMigrations(migrationsDir);
|
|
632
629
|
try {
|
|
633
630
|
assertJournalCoherence(migrationsDir, currentMigrations);
|
|
634
631
|
} catch (err) {
|
|
635
|
-
|
|
632
|
+
log.error(getErrorMessage(err));
|
|
636
633
|
process.exit(1);
|
|
637
634
|
}
|
|
638
635
|
if (existsSync(join(migrationsDir, "migrations.js"))) {
|
|
639
|
-
|
|
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`.");
|
|
640
637
|
process.exit(1);
|
|
641
638
|
}
|
|
642
639
|
const files = readdirSync(migrationsDir).filter((f) => f.endsWith(".sql") && f !== "seed.sql").sort();
|
|
643
640
|
const oldStyleFiles = files.filter((f) => /^\d{1,4}_/.test(f));
|
|
644
641
|
if (oldStyleFiles.length === 0) {
|
|
645
|
-
|
|
646
|
-
|
|
642
|
+
log.info("No migrations with numeric prefixes found. Nothing to rename.");
|
|
643
|
+
outro("Done.");
|
|
647
644
|
return;
|
|
648
645
|
}
|
|
649
646
|
const timestampFiles = files.filter((f) => /^\d{14}_/.test(f));
|
|
@@ -684,9 +681,9 @@ async function runRenameMigrations(root, dialect) {
|
|
|
684
681
|
if (!existsSync(snapshotPathFor(fromTag))) missingSnapshots.push(`meta/${snapshotPrefix(fromTag)}_snapshot.json`);
|
|
685
682
|
}
|
|
686
683
|
if (missingSnapshots.length > 0) {
|
|
687
|
-
|
|
688
|
-
for (const p of missingSnapshots)
|
|
689
|
-
|
|
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.");
|
|
690
687
|
process.exit(1);
|
|
691
688
|
}
|
|
692
689
|
}
|
|
@@ -694,16 +691,16 @@ async function runRenameMigrations(root, dialect) {
|
|
|
694
691
|
const config = readProjectConfig(root);
|
|
695
692
|
let remoteRenamed = false;
|
|
696
693
|
if (config && !token) {
|
|
697
|
-
|
|
694
|
+
log.error("Project is linked but you are not logged in.\nRun `void auth login` first so remote migration records can be updated.");
|
|
698
695
|
process.exit(1);
|
|
699
696
|
}
|
|
700
697
|
if (token && config) try {
|
|
701
698
|
await new PlatformClient(token, { root }).renameMigrations(config.projectId, renames);
|
|
702
699
|
remoteRenamed = true;
|
|
703
|
-
|
|
700
|
+
log.info("Remote migration records updated.");
|
|
704
701
|
} catch (err) {
|
|
705
|
-
|
|
706
|
-
|
|
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));
|
|
707
704
|
process.exit(1);
|
|
708
705
|
}
|
|
709
706
|
const reverseRemote = async () => {
|
|
@@ -716,7 +713,7 @@ async function runRenameMigrations(root, dialect) {
|
|
|
716
713
|
}));
|
|
717
714
|
await client.renameMigrations(config.projectId, reversed);
|
|
718
715
|
} catch {
|
|
719
|
-
|
|
716
|
+
log.warn("db: Could not reverse remote rename. Run `void deploy` to sync remote records.");
|
|
720
717
|
}
|
|
721
718
|
};
|
|
722
719
|
let journalRewritten = false;
|
|
@@ -725,8 +722,8 @@ async function runRenameMigrations(root, dialect) {
|
|
|
725
722
|
try {
|
|
726
723
|
writeFileSync(journalPath, originalJournalBytes);
|
|
727
724
|
} catch (err) {
|
|
728
|
-
|
|
729
|
-
|
|
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));
|
|
730
727
|
}
|
|
731
728
|
};
|
|
732
729
|
const renamed = [];
|
|
@@ -735,8 +732,8 @@ async function runRenameMigrations(root, dialect) {
|
|
|
735
732
|
for (const { from, to } of renamedSnapshots) try {
|
|
736
733
|
renameSync(to, from);
|
|
737
734
|
} catch (err) {
|
|
738
|
-
|
|
739
|
-
|
|
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));
|
|
740
737
|
}
|
|
741
738
|
};
|
|
742
739
|
try {
|
|
@@ -746,7 +743,7 @@ async function runRenameMigrations(root, dialect) {
|
|
|
746
743
|
from,
|
|
747
744
|
to
|
|
748
745
|
});
|
|
749
|
-
|
|
746
|
+
log.step(`${from} → ${to}`);
|
|
750
747
|
const fromTag = stripSqlExt(from);
|
|
751
748
|
const toTag = stripSqlExt(to);
|
|
752
749
|
const snapshotFrom = snapshotPathFor(fromTag);
|
|
@@ -766,8 +763,8 @@ async function runRenameMigrations(root, dialect) {
|
|
|
766
763
|
} catch {}
|
|
767
764
|
restoreJournal();
|
|
768
765
|
await reverseRemote();
|
|
769
|
-
|
|
770
|
-
|
|
766
|
+
log.error("db: Failed to rename migration files. All changes have been reverted.");
|
|
767
|
+
log.error(String(err));
|
|
771
768
|
process.exit(1);
|
|
772
769
|
}
|
|
773
770
|
if (originalJournalBytes !== null) try {
|
|
@@ -795,8 +792,8 @@ async function runRenameMigrations(root, dialect) {
|
|
|
795
792
|
} catch {}
|
|
796
793
|
restoreJournal();
|
|
797
794
|
await reverseRemote();
|
|
798
|
-
|
|
799
|
-
|
|
795
|
+
log.error("db: Failed to update db/migrations/meta/_journal.json. File renames have been reverted.");
|
|
796
|
+
log.error(String(err));
|
|
800
797
|
process.exit(1);
|
|
801
798
|
}
|
|
802
799
|
if (dialect === "postgresql") try {
|
|
@@ -818,12 +815,12 @@ async function runRenameMigrations(root, dialect) {
|
|
|
818
815
|
} catch {}
|
|
819
816
|
restoreJournal();
|
|
820
817
|
await reverseRemote();
|
|
821
|
-
|
|
822
|
-
|
|
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));
|
|
823
820
|
process.exit(1);
|
|
824
821
|
}
|
|
825
822
|
else {
|
|
826
|
-
const { getMiniflareDatabasePath, openSqliteDatabase } = await import("./runner-
|
|
823
|
+
const { getMiniflareDatabasePath, openSqliteDatabase } = await import("./runner-h272wcPj.mjs");
|
|
827
824
|
const dbPath = getMiniflareDatabasePath(getLocalD1PersistRoot(root), "local");
|
|
828
825
|
if (existsSync(dbPath)) try {
|
|
829
826
|
const db = await openSqliteDatabase(dbPath);
|
|
@@ -847,13 +844,13 @@ async function runRenameMigrations(root, dialect) {
|
|
|
847
844
|
} catch {}
|
|
848
845
|
restoreJournal();
|
|
849
846
|
await reverseRemote();
|
|
850
|
-
|
|
851
|
-
|
|
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));
|
|
852
849
|
process.exit(1);
|
|
853
850
|
}
|
|
854
851
|
}
|
|
855
|
-
|
|
856
|
-
|
|
852
|
+
log.success(`Renamed ${renames.length} migration(s) to timestamp format.`);
|
|
853
|
+
outro("Done.");
|
|
857
854
|
}
|
|
858
855
|
async function runExport(root, args, dialect) {
|
|
859
856
|
const errOut = { output: process.stderr };
|
|
@@ -863,7 +860,7 @@ async function runExport(root, args, dialect) {
|
|
|
863
860
|
let tables;
|
|
864
861
|
if (args.table) {
|
|
865
862
|
if ((await client.query("SELECT tablename FROM pg_tables WHERE schemaname = 'public' AND tablename = $1", [args.table])).rows.length === 0) {
|
|
866
|
-
|
|
863
|
+
log.error(`db: Table '${args.table}' not found.`, errOut);
|
|
867
864
|
process.exit(1);
|
|
868
865
|
}
|
|
869
866
|
tables = [args.table];
|
|
@@ -897,15 +894,15 @@ async function runExport(root, args, dialect) {
|
|
|
897
894
|
const output = parts.join("\n");
|
|
898
895
|
if (args.output) {
|
|
899
896
|
writeFileSync(join(root, args.output), output);
|
|
900
|
-
|
|
901
|
-
|
|
897
|
+
log.success(`Exported to ${args.output}`);
|
|
898
|
+
outro("Done.");
|
|
902
899
|
} else process.stdout.write(output);
|
|
903
900
|
return;
|
|
904
901
|
}
|
|
905
|
-
const { getMiniflareDatabasePath, openSqliteDatabase } = await import("./runner-
|
|
902
|
+
const { getMiniflareDatabasePath, openSqliteDatabase } = await import("./runner-h272wcPj.mjs");
|
|
906
903
|
const dbPath = getMiniflareDatabasePath(getLocalD1PersistRoot(root), "local");
|
|
907
904
|
if (!existsSync(dbPath)) {
|
|
908
|
-
|
|
905
|
+
log.error("No local database found. Run `void dev` first.", errOut);
|
|
909
906
|
process.exit(1);
|
|
910
907
|
}
|
|
911
908
|
const db = await openSqliteDatabase(dbPath, { readonly: true });
|
|
@@ -913,7 +910,7 @@ async function runExport(root, args, dialect) {
|
|
|
913
910
|
let tables;
|
|
914
911
|
if (args.table) {
|
|
915
912
|
if (!db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name=?").get(args.table)) {
|
|
916
|
-
|
|
913
|
+
log.error(`db: Table '${args.table}' not found.`, errOut);
|
|
917
914
|
process.exit(1);
|
|
918
915
|
}
|
|
919
916
|
tables = [args.table];
|
|
@@ -942,30 +939,30 @@ async function runExport(root, args, dialect) {
|
|
|
942
939
|
const output = parts.join("\n");
|
|
943
940
|
if (args.output) {
|
|
944
941
|
writeFileSync(join(root, args.output), output);
|
|
945
|
-
|
|
946
|
-
|
|
942
|
+
log.success(`Exported to ${args.output}`);
|
|
943
|
+
outro("Done.");
|
|
947
944
|
} else process.stdout.write(output);
|
|
948
945
|
} finally {
|
|
949
946
|
db.close();
|
|
950
947
|
}
|
|
951
948
|
}
|
|
952
949
|
async function runSetUrl(root) {
|
|
953
|
-
const { readConfig: readVoidConfig, getDatabaseDialect: getDialect } = await import("./config-
|
|
950
|
+
const { readConfig: readVoidConfig, getDatabaseDialect: getDialect } = await import("./config-1twldYCW.mjs").then((n) => n.n);
|
|
954
951
|
if (getDialect(readVoidConfig(root)) !== "postgresql") {
|
|
955
|
-
|
|
952
|
+
log.error("db: This command is only for PostgreSQL projects. Set \"database\": \"pg\" in void.json.");
|
|
956
953
|
process.exit(1);
|
|
957
954
|
}
|
|
958
955
|
const token = getToken(root);
|
|
959
956
|
if (!token) {
|
|
960
|
-
|
|
957
|
+
log.error("No auth token found. Run `void auth login` first.");
|
|
961
958
|
process.exit(1);
|
|
962
959
|
}
|
|
963
960
|
const projectConfig = readProjectConfig(root);
|
|
964
961
|
if (!projectConfig) {
|
|
965
|
-
|
|
962
|
+
log.error("No project linked. Run `void deploy` first or link a project.");
|
|
966
963
|
process.exit(1);
|
|
967
964
|
}
|
|
968
|
-
const { text: promptText, isCancel: isCancelCheck } = await import("./
|
|
965
|
+
const { text: promptText, isCancel: isCancelCheck } = await import("./agents-Bmr5tFFb.mjs").then((n) => n.C);
|
|
969
966
|
const connectionString = await promptText({
|
|
970
967
|
message: "Enter your PostgreSQL connection string:",
|
|
971
968
|
placeholder: "postgresql://user:pass@host:5432/dbname",
|
|
@@ -975,19 +972,19 @@ async function runSetUrl(root) {
|
|
|
975
972
|
});
|
|
976
973
|
if (isCancelCheck(connectionString)) process.exit(0);
|
|
977
974
|
await new PlatformClient(token, { root }).setDatabaseUrl(projectConfig.projectId, connectionString);
|
|
978
|
-
|
|
979
|
-
|
|
975
|
+
log.success("Database URL updated.");
|
|
976
|
+
outro("Done.");
|
|
980
977
|
}
|
|
981
978
|
function resolveSeedTarget(root, file) {
|
|
982
979
|
if (file) return toSeedTarget(root, resolve(root, file), file);
|
|
983
980
|
const paths = readProjectPaths(root);
|
|
984
981
|
const defaults = DEFAULT_SEED_FILES.map((candidate) => paths.sourceRelative(candidate)).filter((candidate) => existsSync(join(root, candidate)));
|
|
985
982
|
if (defaults.length === 0) {
|
|
986
|
-
|
|
983
|
+
log.error(`db: No seed file found. Create one of: ${DEFAULT_SEED_FILES.map((candidate) => paths.sourceRelative(candidate)).join(", ")} or pass --file <path>.`);
|
|
987
984
|
process.exit(1);
|
|
988
985
|
}
|
|
989
986
|
if (defaults.length > 1) {
|
|
990
|
-
|
|
987
|
+
log.error(`db: Multiple default seed files found: ${defaults.join(", ")}. Use --file <path> to choose one.`);
|
|
991
988
|
process.exit(1);
|
|
992
989
|
}
|
|
993
990
|
const [seedPath] = defaults;
|
|
@@ -995,7 +992,7 @@ function resolveSeedTarget(root, file) {
|
|
|
995
992
|
}
|
|
996
993
|
function toSeedTarget(root, seedPath, displayPath) {
|
|
997
994
|
if (!existsSync(seedPath)) {
|
|
998
|
-
|
|
995
|
+
log.error(`db: Seed file '${seedPath}' not found.`);
|
|
999
996
|
process.exit(1);
|
|
1000
997
|
}
|
|
1001
998
|
const ext = extname(seedPath);
|
|
@@ -1010,7 +1007,7 @@ function toSeedTarget(root, seedPath, displayPath) {
|
|
|
1010
1007
|
displayPath: normalizedDisplay,
|
|
1011
1008
|
kind: "module"
|
|
1012
1009
|
};
|
|
1013
|
-
|
|
1010
|
+
log.error(`db: Unsupported seed file '${normalizedDisplay}'. Use .sql, .ts, .mts, .js, or .mjs.`);
|
|
1014
1011
|
process.exit(1);
|
|
1015
1012
|
}
|
|
1016
1013
|
async function runSeedModule(root, seedPath, dialect) {
|
|
@@ -1021,16 +1018,17 @@ async function runSeedModule(root, seedPath, dialect) {
|
|
|
1021
1018
|
await withPgClient(root, async (client) => {
|
|
1022
1019
|
const options = getDrizzleSchemaOptions(schema);
|
|
1023
1020
|
const drizzleClient = client;
|
|
1021
|
+
const db = options ? drizzle(drizzleClient, options) : drizzle(drizzleClient);
|
|
1024
1022
|
await seed({
|
|
1025
1023
|
dialect,
|
|
1026
|
-
db
|
|
1024
|
+
db,
|
|
1027
1025
|
schema
|
|
1028
1026
|
});
|
|
1029
1027
|
});
|
|
1030
1028
|
return;
|
|
1031
1029
|
}
|
|
1032
1030
|
const { drizzle } = await import("drizzle-orm/better-sqlite3");
|
|
1033
|
-
const { getMiniflareDatabasePath, openSqliteDatabase } = await import("./runner-
|
|
1031
|
+
const { getMiniflareDatabasePath, openSqliteDatabase } = await import("./runner-h272wcPj.mjs");
|
|
1034
1032
|
const sqlite = await openSqliteDatabase(getMiniflareDatabasePath(getLocalD1PersistRoot(root), "local"));
|
|
1035
1033
|
try {
|
|
1036
1034
|
const options = getDrizzleSchemaOptions(schema);
|
|
@@ -1050,7 +1048,7 @@ async function loadSeedFunction(seedPath) {
|
|
|
1050
1048
|
return seed;
|
|
1051
1049
|
}
|
|
1052
1050
|
async function loadSeedSchema(root) {
|
|
1053
|
-
const { discoverSchema } = await import("./discover-
|
|
1051
|
+
const { discoverSchema } = await import("./discover-BuVVSAum.mjs").then((n) => n.n);
|
|
1054
1052
|
const location = discoverSchema(root, readProjectPaths(root));
|
|
1055
1053
|
if (!location) return {};
|
|
1056
1054
|
if (location.type === "file") {
|