void 0.27.0 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (337) hide show
  1. package/README.md +3 -1
  2. package/dist/{account-cmd-l-FM7Ioq.mjs → account-cmd-BTcUzv9L.mjs} +6 -6
  3. package/dist/{agents-B_pX_HmQ.mjs → agents-CuNtT0D_.mjs} +5 -2
  4. package/dist/{application-analysis-DKy02UY0.mjs → application-analysis-AB_YYWgH.mjs} +118 -135
  5. package/dist/{application-routing-DQyUh_5S.mjs → application-routing-L7V-TFhZ.mjs} +1 -2
  6. package/dist/atomic-write-Dq6R0BPN.mjs +18 -0
  7. package/dist/{auth-Dn2vw-SG.mjs → auth-B6iOCjKI.mjs} +23 -56
  8. package/dist/auth-Cbqi1iVX.mjs +1 -0
  9. package/dist/{auth-link-vz9Z2kmG.mjs → auth-link-DUJuvRx5.mjs} +11 -11
  10. package/dist/{auth-migrations-BwHgeEsD.mjs → auth-migrations-Cgs0k6lS.mjs} +28 -5
  11. package/dist/{auth-router-DvsCUVw4.mjs → auth-router-CIxiMG7i.mjs} +5 -5
  12. package/dist/base64-DVrOndmI.mjs +16 -0
  13. package/dist/{better-auth-shared-CPvWD3nG.d.mts → better-auth-shared-B74NJIus.d.mts} +8 -13
  14. package/dist/{better-auth-shared-DPpj8zxc.mjs → better-auth-shared-CMXlZG7W.mjs} +56 -68
  15. package/dist/{build-cmd-D6we0VjO.mjs → build-cmd-BkIv25PA.mjs} +6 -6
  16. package/dist/{cache-CZRdzKx1.mjs → cache-Ctzfig-W.mjs} +6 -6
  17. package/dist/{cancel-deploy-CQ3NnMvf.mjs → cancel-deploy-CD9o-SsC.mjs} +5 -5
  18. package/dist/{cf-access-TWNzXltp.mjs → cf-access-BM9G0lhO.mjs} +4 -3
  19. package/dist/{cf-access-BcIBSKqG.mjs → cf-access-CWP4avfP.mjs} +3 -7
  20. package/dist/cf-build-output-BU3hqdHu.mjs +1 -0
  21. package/dist/{cf-build-output-DjvB_872.mjs → cf-build-output-Bc8i3dzE.mjs} +2 -2
  22. package/dist/cf-user-agent-ChjQp2MU.mjs +33 -0
  23. package/dist/cli/cli.mjs +199 -312
  24. package/dist/cli/cloudflare-operation-process.mjs +41 -15
  25. package/dist/cli/env-schema-probe.d.mts +7 -44
  26. package/dist/cli/env-schema-probe.mjs +14 -80
  27. package/dist/client-B60PwCC4.mjs +1 -0
  28. package/dist/{client-DlDJuY0s.mjs → client-DM9Kcf4e.mjs} +161 -415
  29. package/dist/{cloudflare-auth-CuxfF6OA.mjs → cloudflare-auth-CqFBDo52.mjs} +12 -39
  30. package/dist/{cloudflare-cmd-lHqNlJGW.mjs → cloudflare-cmd-BIAF_BIY.mjs} +7 -6
  31. package/dist/{cloudflare-config-BmhBv3HV.mjs → cloudflare-config-DV60XFFK.mjs} +16 -28
  32. package/dist/{cloudflare-connect-2G3rL2rP.mjs → cloudflare-connect-WjwnVOJA.mjs} +4 -4
  33. package/dist/{cloudflare-operations-CwI1bChl.mjs → cloudflare-operations-B42EZeJy.mjs} +26 -34
  34. package/dist/cloudflare-operations-CrSUFRzJ.mjs +1 -0
  35. package/dist/{cloudflare-process-2-TfIEzB.mjs → cloudflare-process-CeDWJRhj.mjs} +12 -7
  36. package/dist/collect-Cae8A7Zr.mjs +1 -0
  37. package/dist/{collect-DiTn9yr6.mjs → collect-xjffdCdk.mjs} +1 -1
  38. package/dist/{config-CSa15FvD.d.mts → config-7qoq2p9v.d.mts} +2 -2
  39. package/dist/{config-CLYAosnQ.mjs → config-BEm9vRvS.mjs} +11 -5
  40. package/dist/{config-DiowPT80.mjs → config-Bx_1SpnO.mjs} +87 -177
  41. package/dist/{config-DPByhVck.mjs → config-D0GY5ItR.mjs} +1 -1
  42. package/dist/config-QrJWu0IX.mjs +1 -0
  43. package/dist/config-entry.d.mts +1 -1
  44. package/dist/{connect-BfPBHHm-.mjs → connect-CKtk-EZe.mjs} +9 -9
  45. package/dist/create-project-B-ewF_Af.mjs +1 -0
  46. package/dist/{create-project-BdXEFKal.mjs → create-project-yInGo72M.mjs} +8 -8
  47. package/dist/database-provider.mjs +1 -2
  48. package/dist/{db-Xs80hcaA.mjs → db-7I_gfdVq.mjs} +177 -268
  49. package/dist/db-types-Bb4WBWIs.mjs +49 -0
  50. package/dist/{delete-d2vuou3j.mjs → delete-Cy-M1u-r.mjs} +6 -6
  51. package/dist/deploy-9lgfhrXS.mjs +2 -0
  52. package/dist/deploy-BYYlnsiy.mjs +6164 -0
  53. package/dist/deploy-managed-static-Ca4TFdmx.mjs +1595 -0
  54. package/dist/deploy-transport-DWlWBe6M.mjs +180 -0
  55. package/dist/deploy.d.mts +10 -0
  56. package/dist/deploy.mjs +82 -0
  57. package/dist/dev-inbox-Rd6j_8vM.mjs +217 -0
  58. package/dist/discover-ClzFSwns.mjs +1 -0
  59. package/dist/{discover-CkCYv9T_.mjs → discover-D2PGT63u.mjs} +2 -2
  60. package/dist/dispatch-DrTTk8Xg.mjs +431 -0
  61. package/dist/{dist-D3m88sjf.mjs → dist-BVdsO7Py.mjs} +5 -6
  62. package/dist/dist-CfgIkieS.mjs +1 -0
  63. package/dist/{dist-BVqXeR_h.mjs → dist-ipQi0Q8y.mjs} +2 -3
  64. package/dist/{domain-BsDUBAvt.mjs → domain-CZGxPv9u.mjs} +8 -23
  65. package/dist/{dotenv-BfU6eqFt.mjs → dotenv-CNazY3-w.mjs} +4 -16
  66. package/dist/edge.mjs +1 -2
  67. package/dist/{email-d_Aux1vM.mjs → email-BcjSyAL0.mjs} +4 -20
  68. package/dist/{email-_lGAHOhp.mjs → email-DzyNVuoU.mjs} +100 -192
  69. package/dist/email-cloudflare-DfG6UEMm.mjs +1096 -0
  70. package/dist/email-protocol-D9nTvhCp.mjs +82 -0
  71. package/dist/{entry-CMAkqBmU.mjs → entry-ehmBvs5w.mjs} +2 -2
  72. package/dist/{env-DMA3cXZt.mjs → env-0jrMQJI_.mjs} +6 -14
  73. package/dist/{env-BxocywBB.mjs → env-BJjULvL0.mjs} +2 -2
  74. package/dist/{env-C74QepDE.mjs → env-Nx3yf50r.mjs} +9 -9
  75. package/dist/{env-public-DR7ZM6d-.d.mts → env-public-CCdykygU.d.mts} +6 -23
  76. package/dist/{env-raw-jZpP5n47.mjs → env-raw-D74P4ebM.mjs} +15 -21
  77. package/dist/{env-types-CwXgeMgL.mjs → env-types-DS2_y4X8.mjs} +2 -2
  78. package/dist/env-validation-BT7z-qpQ.mjs +1 -0
  79. package/dist/env-validation-DYxjz_Wo.mjs +488 -0
  80. package/dist/{gen-DtkQhvQg.mjs → gen-CufHEf42.mjs} +132 -254
  81. package/dist/gen-sXyp5DFO.mjs +1 -0
  82. package/dist/generate-ClI89brV.mjs +1 -0
  83. package/dist/{generate-GDbL7sUr.mjs → generate-Dat0UTry.mjs} +38 -4
  84. package/dist/generated-wrangler-config-DeWj5F9Y.mjs +18 -0
  85. package/dist/{github-cmd-DaDdBbSS.mjs → github-cmd-FU8EjFyU.mjs} +28 -72
  86. package/dist/{handler-BHAn2fZJ.mjs → handler-BZ1t7-Rv.mjs} +2 -2
  87. package/dist/{handler-CNAwjRcW.d.mts → handler-_PqY82xe.d.mts} +1 -1
  88. package/dist/{headers-DlfR78Nu.mjs → headers-Di1FsD3e.mjs} +26 -81
  89. package/dist/{help-0bTe_lID.mjs → help-BT2hovNI.mjs} +26 -14
  90. package/dist/help-i2YGGnTH.mjs +1 -0
  91. package/dist/{inbound-PfQDLXc5.mjs → inbound-BuTfm11U.mjs} +71 -222
  92. package/dist/{inbound-CH5Mksyy.d.mts → inbound-brj2-TM5.d.mts} +19 -58
  93. package/dist/index.d.mts +2 -18
  94. package/dist/index.mjs +714 -762
  95. package/dist/{info-PYWwkWyt.mjs → info-l249eUdH.mjs} +5 -5
  96. package/dist/{init-DaBGmaXC.mjs → init-D0A6M64Q.mjs} +229 -392
  97. package/dist/isr-config-fZaJJ8t7.mjs +165 -0
  98. package/dist/{link-C6fjafep.mjs → link-WMoJFf4i.mjs} +9 -9
  99. package/dist/{list-BTFBlqKl.mjs → list-CQ2EQEHL.mjs} +7 -18
  100. package/dist/{live-CgQuTpqD.mjs → live-BcHoTDFe.mjs} +19 -17
  101. package/dist/{live-Du8jXwOW.d.mts → live-DJONVlQK.d.mts} +1 -1
  102. package/dist/load-user-env-DD5qveNU.mjs +49 -0
  103. package/dist/{local-d1-ga5O_idV.mjs → local-d1-BxvQYEFi.mjs} +6 -6
  104. package/dist/{login-GKcNUmtI.mjs → login-C2T1oVG-.mjs} +12 -12
  105. package/dist/login-XD844Xs-.mjs +1 -0
  106. package/dist/{logs-BiMSULmc.mjs → logs-DnC1d7xB.mjs} +6 -6
  107. package/dist/{migrate-NLsjBbuM.mjs → migrate-BDIprOYd.mjs} +70 -22
  108. package/dist/migrate-BRwU-blY.mjs +1 -0
  109. package/dist/migration-handler-Cg0Y4EPu.mjs +470 -0
  110. package/dist/{migration-handler-DM4clYj5.d.mts → migration-handler-CwlEQUoo.d.mts} +17 -26
  111. package/dist/{mime-DxCznlJq.mjs → mime-srOklVVv.mjs} +92 -395
  112. package/dist/mysql-migration-sql-BIS5vbNk.mjs +241 -0
  113. package/dist/nitro.d.mts +30 -0
  114. package/dist/nitro.mjs +88 -0
  115. package/dist/{node-DJicPvPj.mjs → node-cPadMgUO.mjs} +9 -25
  116. package/dist/{operator-args-DOBhIaIg.mjs → operator-args-UnE8Y2eK.mjs} +27 -26
  117. package/dist/{operator-auth-BEZ_u0Cz.mjs → operator-auth-Cr2zCc-J.mjs} +2 -2
  118. package/dist/{operator-client-DbDv4vtE.mjs → operator-client-C-ROjk1I.mjs} +4 -4
  119. package/dist/operator-cmd-D6gnZsnK.mjs +1 -0
  120. package/dist/{operator-cmd-BT4hgavL.mjs → operator-cmd-DHieWtFp.mjs} +8 -8
  121. package/dist/{output-C50ag2r3.mjs → output-Ba6ZbrzY.mjs} +37 -6
  122. package/dist/{package-json-DXfiT1jV.mjs → package-json-BjYqR-So.mjs} +1 -1
  123. package/dist/pages/client.d.mts +1 -1
  124. package/dist/pages/client.mjs +91 -5
  125. package/dist/pages/head.mjs +1 -2
  126. package/dist/pages/index.d.mts +1 -2
  127. package/dist/pages/index.mjs +6 -6
  128. package/dist/pages/islands-plugin.mjs +5 -83
  129. package/dist/pages/prefetch.mjs +1 -2
  130. package/dist/pages/protocol.d.mts +2 -2
  131. package/dist/pages/protocol.mjs +1 -1
  132. package/dist/pages/serialize.mjs +1 -2
  133. package/dist/plan-CKX_jWnD.mjs +1 -0
  134. package/dist/platform-args-B0HeTh0C.mjs +1 -0
  135. package/dist/{platform-args-DUeXY9Om.mjs → platform-args-CaCL_1Ch.mjs} +43 -60
  136. package/dist/{platform-auth-config-CkSx3usH.mjs → platform-auth-config-Z16-I8nT.mjs} +11 -12
  137. package/dist/{platform-auth-protection-BJimB_p9.mjs → platform-auth-protection-BXwZiJSF.mjs} +37 -27
  138. package/dist/{platform-auth-recovery-BU6izFAU.mjs → platform-auth-recovery-CXjfqyOv.mjs} +9 -10
  139. package/dist/{platform-cmd-BbY1dWiM.mjs → platform-cmd-DaAOiWTl.mjs} +16 -16
  140. package/dist/platform-cmd-PT4YwMLM.mjs +1 -0
  141. package/dist/{platform-discovery-DIYz8V63.mjs → platform-discovery-CHhNs8Nn.mjs} +1 -1
  142. package/dist/{platform-domain-CHVS6cV0.mjs → platform-domain-CxpvUeo0.mjs} +6 -6
  143. package/dist/{platform-lifecycle-DzCwqhFq.mjs → platform-lifecycle-DBiS0cJd.mjs} +1693 -2120
  144. package/dist/platform-lifecycle-u9pMOvxC.mjs +1 -0
  145. package/dist/{platform-management-CuuVDhyt.mjs → platform-management-DhEFdQAf.mjs} +696 -130
  146. package/dist/platform-management-DvBS83rC.mjs +1 -0
  147. package/dist/{platform-plans-config-CN-heS4q.mjs → platform-plans-config-BWn1S2Rv.mjs} +16 -12
  148. package/dist/{platform-recovery-CskSJgLh.mjs → platform-recovery-BUGOB4RC.mjs} +6 -9
  149. package/dist/{platform-registry-Cjv2Qf0r.mjs → platform-registry-B9mWX9LO.mjs} +13 -18
  150. package/dist/{platform-setup-BBxRxmFC.mjs → platform-setup-YvN9VQXV.mjs} +21 -28
  151. package/dist/{plugin-inference-BlQbOL0P.mjs → plugin-inference-DsARdQKE.mjs} +18 -33
  152. package/dist/prepare-CYT6tAzD.mjs +1 -0
  153. package/dist/{prepare-Do96654b.mjs → prepare-DEB5SeVJ.mjs} +12 -13
  154. package/dist/{prepare-Dq9hTIbo.mjs → prepare-PQCgsny0.mjs} +4 -4
  155. package/dist/{prerender-render-Ct20jftc.mjs → prerender-render-Bfsumdkv.mjs} +8 -2
  156. package/dist/prerender-render.d.mts +2 -0
  157. package/dist/prerender-render.mjs +1 -2
  158. package/dist/{project-cmd-DaoRrn-8.mjs → project-cmd-DVatD8Ev.mjs} +20 -20
  159. package/dist/{project-paths-GgcMozYz.mjs → project-paths-DMvEeSau.mjs} +9 -14
  160. package/dist/{project-BAm2aB6Q.mjs → project-rqDnVsJN.mjs} +8 -4
  161. package/dist/project-slug-6cyz8E7k.mjs +1 -0
  162. package/dist/{project-team-Q_lCA7Io.mjs → project-team-DJrWEAG1.mjs} +7 -7
  163. package/dist/{project-token-BArgK9o1.mjs → project-token-CBgLBuL6.mjs} +6 -6
  164. package/dist/{project-tsconfig-CVJhNMxs.mjs → project-tsconfig-bveqhlYA.mjs} +3 -5
  165. package/dist/project-zdB3fs9G.mjs +1 -0
  166. package/dist/{project-zero-trust-KO9Hu2Pq.mjs → project-zero-trust-92gLtZ25.mjs} +6 -6
  167. package/dist/{protocol-BPZaNqBo.d.mts → protocol-4H7V_3Os.d.mts} +1 -1
  168. package/dist/{protocol-CfaUwNs8.mjs → protocol-RNP0u7UY.mjs} +9 -3
  169. package/dist/{provision-BfaLiWbj.mjs → provision-BnSSkiED.mjs} +119 -866
  170. package/dist/{requests-C7Oeoh5u.mjs → requests-7W1Pygt2.mjs} +5 -5
  171. package/dist/resolve-project-PnhzMtY6.mjs +1 -0
  172. package/dist/resolve-project-WpwkCB_c.mjs +48 -0
  173. package/dist/{rollback-DVAtrLAl.mjs → rollback-BcASVnwP.mjs} +8 -18
  174. package/dist/{route-types-CbtsIeFn.mjs → route-types-BZi26DVS.mjs} +9 -91
  175. package/dist/routing-assets-VkrKIbxE.mjs +139 -0
  176. package/dist/{runner-DMBKSrRk.mjs → runner-CabsQ-iM.mjs} +22 -34
  177. package/dist/runner-So9mYfcm.mjs +1 -0
  178. package/dist/runner-mysql-BhRaONkO.mjs +146 -0
  179. package/dist/runner-mysql-DWwE8jKi.mjs +1 -0
  180. package/dist/{runner-pg-DV8p_zjA.mjs → runner-pg-BRemq_GX.mjs} +3 -3
  181. package/dist/runner-pg-_Xncr3H5.mjs +1 -0
  182. package/dist/runtime/ai.mjs +23 -25
  183. package/dist/runtime/auth-client-react.mjs +1 -2
  184. package/dist/runtime/auth-client-solid.mjs +1 -2
  185. package/dist/runtime/auth-client-svelte.mjs +1 -2
  186. package/dist/runtime/auth-client-vue.mjs +1 -2
  187. package/dist/runtime/auth-client.mjs +1 -2
  188. package/dist/runtime/auth.mjs +1 -2
  189. package/dist/runtime/better-auth-mysql.d.mts +2 -5
  190. package/dist/runtime/better-auth-mysql.mjs +9 -31
  191. package/dist/runtime/better-auth-pg.d.mts +2 -5
  192. package/dist/runtime/better-auth-pg.mjs +6 -32
  193. package/dist/runtime/better-auth.d.mts +2 -4
  194. package/dist/runtime/better-auth.mjs +9 -19
  195. package/dist/runtime/db.mjs +6 -2
  196. package/dist/runtime/durable.d.mts +18 -1
  197. package/dist/runtime/durable.mjs +26 -2
  198. package/dist/runtime/email/testing.d.mts +1 -1
  199. package/dist/runtime/email/testing.mjs +9 -23
  200. package/dist/runtime/email-protocol.d.mts +12 -0
  201. package/dist/runtime/email-protocol.mjs +1 -70
  202. package/dist/runtime/email.d.mts +1 -1
  203. package/dist/runtime/email.mjs +79 -221
  204. package/dist/runtime/env-public.d.mts +1 -1
  205. package/dist/runtime/env-public.mjs +12 -38
  206. package/dist/runtime/env.d.mts +1 -12
  207. package/dist/runtime/env.mjs +1 -2
  208. package/dist/runtime/handler.d.mts +1 -1
  209. package/dist/runtime/handler.mjs +1 -1
  210. package/dist/runtime/isr.mjs +1 -1
  211. package/dist/runtime/kv.mjs +1 -1
  212. package/dist/runtime/limits.mjs +1 -2
  213. package/dist/runtime/live-client.d.mts +3 -2
  214. package/dist/runtime/live-server.d.mts +2 -1
  215. package/dist/runtime/live-server.mjs +1 -16
  216. package/dist/runtime/live.d.mts +1 -1
  217. package/dist/runtime/live.mjs +1 -2
  218. package/dist/runtime/log.d.mts +2 -1
  219. package/dist/runtime/migration-handler-mysql.d.mts +2 -2
  220. package/dist/runtime/migration-handler-mysql.mjs +39 -8
  221. package/dist/runtime/migration-handler-pg.d.mts +2 -2
  222. package/dist/runtime/migration-handler-pg.mjs +1 -1
  223. package/dist/runtime/migration-handler.d.mts +2 -2
  224. package/dist/runtime/migration-handler.mjs +1 -470
  225. package/dist/runtime/queues.mjs +1 -1
  226. package/dist/runtime/remote/binding-handler.mjs +62 -62
  227. package/dist/runtime/remote/index.mjs +16 -77
  228. package/dist/runtime/response.mjs +1 -2
  229. package/dist/runtime/route-url.mjs +1 -2
  230. package/dist/runtime/routing.d.mts +3 -5
  231. package/dist/runtime/routing.mjs +82 -218
  232. package/dist/runtime/sandbox-container.d.mts +2 -2
  233. package/dist/runtime/sandbox-container.mjs +1 -2
  234. package/dist/runtime/sandbox.d.mts +2 -2
  235. package/dist/runtime/sandbox.mjs +13 -6
  236. package/dist/runtime/seed.d.mts +2 -1
  237. package/dist/runtime/sse.mjs +1 -2
  238. package/dist/runtime/storage.mjs +1 -1
  239. package/dist/runtime/validator.d.mts +1 -1
  240. package/dist/runtime/validator.mjs +1 -2
  241. package/dist/runtime/ws-server.d.mts +4 -4
  242. package/dist/runtime/ws-server.mjs +6 -28
  243. package/dist/runtime/ws.d.mts +1 -1
  244. package/dist/{sandbox-container-Bo0eiFKz.d.mts → sandbox-container-ChQRum-j.d.mts} +3 -1
  245. package/dist/{sandbox-container-C6ItmVuN.mjs → sandbox-container-a9LRUtii.mjs} +13 -2
  246. package/dist/{sandbox-C5LFoJMf.d.mts → sandbox-q3waMc2T.d.mts} +1 -1
  247. package/dist/{scan-C3uDzz6J.mjs → scan-C0BMdmEd.mjs} +84 -7
  248. package/dist/{secret-BvtB7IjY.mjs → secret-bg73f1Ge.mjs} +63 -81
  249. package/dist/{serialize-BPvnNQuA.mjs → serialize-BtQyaYoC.mjs} +10 -4
  250. package/dist/{skills-BgVMvQdy.mjs → skills-C_yRTg0g.mjs} +3 -3
  251. package/dist/{subcommand-prompt-BSlnD1fI.mjs → subcommand-prompt-Bm3ZlYgA.mjs} +39 -44
  252. package/dist/sveltekit.d.mts +2 -1
  253. package/dist/sveltekit.mjs +1 -1
  254. package/dist/validate-BQFdf0Pi.mjs +1 -0
  255. package/dist/{validate-C9qJArv7.mjs → validate-CheZGRE7.mjs} +4 -8
  256. package/dist/version-metadata-DIrqEHQo.mjs +73 -0
  257. package/dist/{wrangler-D9KTuqnv.mjs → wrangler-BYs07Rxy.mjs} +119 -378
  258. package/dist/wrapper-CwhpNWtH.mjs +663 -0
  259. package/dist/{ws-CChrrAU-.d.mts → ws-aKVYB-fA.d.mts} +1 -1
  260. package/dist/yarn-pnp-DLbEFMT0.mjs +92 -0
  261. package/docs/guide/ai.md +8 -2
  262. package/docs/guide/auth.md +2 -0
  263. package/docs/guide/database/mysql.md +14 -3
  264. package/docs/guide/database/postgresql.md +2 -0
  265. package/docs/guide/database.md +3 -5
  266. package/docs/guide/durable-state.md +32 -4
  267. package/docs/guide/platform/administration/access.md +4 -0
  268. package/docs/guide/platform/administration/connected-apps.md +55 -0
  269. package/docs/guide/platform/installation/credentials.md +21 -3
  270. package/docs/guide/platform/installation/domains.md +1 -1
  271. package/docs/guide/platform/installation/maintenance.md +38 -1
  272. package/docs/guide/platform/installation/prerequisites.md +6 -2
  273. package/docs/guide/platform/installation/setup.md +23 -1
  274. package/docs/guide/platform/installation/uninstall.md +6 -1
  275. package/docs/guide/quickstart.md +2 -0
  276. package/docs/guide/sandboxes.md +3 -1
  277. package/docs/guide/self-hosted-platform.md +1 -1
  278. package/docs/integrations/cloudflare.md +2 -2
  279. package/docs/integrations/frameworks/analog.md +3 -11
  280. package/docs/integrations/frameworks/nuxt.md +7 -10
  281. package/docs/integrations/nodejs-bun-deno.md +2 -0
  282. package/docs/reference/api/deploy.md +23 -0
  283. package/docs/reference/api/pages.md +2 -0
  284. package/docs/reference/api.md +3 -1
  285. package/docs/reference/cli/database.md +9 -3
  286. package/docs/reference/cli/platform-installation.md +19 -7
  287. package/docs/reference/cli/setup.md +2 -0
  288. package/docs/reference/config.md +2 -0
  289. package/package.json +39 -36
  290. package/sandbox.Dockerfile +1 -1
  291. package/skills/void/SKILL.md +2 -1
  292. package/dist/auth-LMJcNESe.mjs +0 -2
  293. package/dist/cf-build-output-H9a97vME.mjs +0 -2
  294. package/dist/cf-user-agent-lKblH3zU.mjs +0 -17
  295. package/dist/client-tso2OfcG.mjs +0 -2
  296. package/dist/cloudflare-operations-BlYLlowZ.mjs +0 -2
  297. package/dist/collect-DLyFDiKW.mjs +0 -2
  298. package/dist/config-5r-YpMC-.mjs +0 -2
  299. package/dist/config-B_ggY-IO.mjs +0 -89
  300. package/dist/config-BtSFvXZx.mjs +0 -2
  301. package/dist/config-write-AHGesphx.mjs +0 -61
  302. package/dist/create-project-qFDC45zg.mjs +0 -2
  303. package/dist/deploy-Bqe1PYBw.mjs +0 -10458
  304. package/dist/deploy-VsWsVQkw.mjs +0 -2
  305. package/dist/dev-inbox-CK-UuPob.mjs +0 -297
  306. package/dist/discover-EDUf6JJw.mjs +0 -2
  307. package/dist/dist-Bx1z6Eva.mjs +0 -2
  308. package/dist/dist-_UUlL6bg.mjs +0 -2
  309. package/dist/env-validation-CrVNjsPm.mjs +0 -2
  310. package/dist/env-validation-Dxdx_5wo.mjs +0 -951
  311. package/dist/gen-dA9hW7AV.mjs +0 -2
  312. package/dist/head-client-DzmJGN4C.mjs +0 -90
  313. package/dist/help-DfQYVfGY.mjs +0 -2
  314. package/dist/login-mx_ydhmp.mjs +0 -2
  315. package/dist/migrate-BHp07yJE.mjs +0 -2
  316. package/dist/operator-cmd-CwBB-1yb.mjs +0 -2
  317. package/dist/pages/head-client.d.mts +0 -13
  318. package/dist/pages/head-client.mjs +0 -2
  319. package/dist/plan-CH2G51je.mjs +0 -2
  320. package/dist/platform-args-D4E1PjVw.mjs +0 -2
  321. package/dist/platform-cmd-BbmJiq5O.mjs +0 -2
  322. package/dist/platform-lifecycle-ByAlpkhV.mjs +0 -2
  323. package/dist/platform-management-CBOT4BSM.mjs +0 -2
  324. package/dist/prepare-DRUV-g3X.mjs +0 -2
  325. package/dist/project-DedqCp59.mjs +0 -2
  326. package/dist/project-slug-DofjTFd-.mjs +0 -2
  327. package/dist/provision-Wu9ZBk9L.mjs +0 -2
  328. package/dist/resolve-project-BIeYs9Cw.mjs +0 -2
  329. package/dist/resolve-project-CP8rZs_p.mjs +0 -28
  330. package/dist/runner-9wjsSZx-.mjs +0 -2
  331. package/dist/runner-mysql-CEzKtmFb.mjs +0 -54
  332. package/dist/runner-mysql-CkFqZ6CE.mjs +0 -2
  333. package/dist/runner-pg-BGYRFdRp.mjs +0 -2
  334. package/dist/runtime/env-helpers.d.mts +0 -2
  335. package/dist/runtime/env-helpers.mjs +0 -2
  336. package/dist/validate-BJr9LfXy.mjs +0 -2
  337. package/dist/yarn-pnp-CUX_iTPA.mjs +0 -188
@@ -1,22 +1,24 @@
1
- import { a as join, l as relative, r as extname, t as basename, u as resolve } from "./dist-BVqXeR_h.mjs";
2
- import { r as detectFramework } from "./plugin-inference-BlQbOL0P.mjs";
3
- import { n as readProjectPaths } from "./project-paths-GgcMozYz.mjs";
4
- import { h as resolveBindingNames, m as readConfig, u as getDatabaseDialect } from "./config-DiowPT80.mjs";
5
- import { i as writeJournal, n as readJournal, r as stripSqlExt, t as collectMigrations } from "./collect-DiTn9yr6.mjs";
6
- import { n as readDeploymentPlatform, r as readProjectConfig } from "./project-BAm2aB6Q.mjs";
7
- import { t as resolveLocalD1Target } from "./local-d1-ga5O_idV.mjs";
8
- import { t as cfAccessHeaders } from "./cf-access-TWNzXltp.mjs";
9
- import { i as isCloudflareAccessChallenge, n as ensurePlatformAccessToken, r as ensurePlatformProxyAccess } from "./cf-access-BcIBSKqG.mjs";
10
- import { c as getToken, o as getProxyUrl } from "./auth-Dn2vw-SG.mjs";
11
- import { A as confirm, H as outro, L as log, tt as isCancel } from "./dist-D3m88sjf.mjs";
12
- import { d as printSuccess, i as dim, l as import_picocolors, s as formatCount } from "./output-C50ag2r3.mjs";
13
- import { o as loadLocalEnv } from "./env-BxocywBB.mjs";
14
- import { n as PlatformApiError, r as PlatformClient } from "./client-DlDJuY0s.mjs";
15
- import { i as validateMigrations, r as listDrizzleArtifacts, t as assertJournalCoherence } from "./validate-C9qJArv7.mjs";
16
- import { n as formatTimestamp } from "./gen-DtkQhvQg.mjs";
1
+ import { a as join, c as resolve, n as dirname, r as extname, s as relative, t as basename } from "./dist-ipQi0Q8y.mjs";
2
+ import { r as detectFramework } from "./plugin-inference-DsARdQKE.mjs";
3
+ import { n as readProjectPaths } from "./project-paths-DMvEeSau.mjs";
4
+ import { d as readConfig, f as resolveBindingNames, s as getDatabaseDialect } from "./config-Bx_1SpnO.mjs";
5
+ import { i as writeJournal, n as readJournal, r as stripSqlExt, t as collectMigrations } from "./collect-xjffdCdk.mjs";
6
+ import { n as readDeploymentPlatform, r as readProjectConfig } from "./project-rqDnVsJN.mjs";
7
+ import { t as resolveLocalD1Target } from "./local-d1-BxvQYEFi.mjs";
8
+ import { t as cfAccessHeaders } from "./cf-access-BM9G0lhO.mjs";
9
+ import { n as ensurePlatformProxyAccess, r as isCloudflareAccessChallenge, t as ensurePlatformAccessToken } from "./cf-access-CWP4avfP.mjs";
10
+ import { c as getToken, o as getProxyUrl } from "./auth-B6iOCjKI.mjs";
11
+ import { A as confirm, H as outro, L as log, X as text, tt as isCancel } from "./dist-BVdsO7Py.mjs";
12
+ import { f as import_picocolors, i as dim, l as formatUrl, m as printSuccess, o as formatCount, u as getErrorMessage } from "./output-Ba6ZbrzY.mjs";
13
+ import { o as loadLocalEnv } from "./env-BJjULvL0.mjs";
14
+ import { i as validateMigrations, t as assertJournalCoherence } from "./validate-CheZGRE7.mjs";
15
+ import { n as PlatformApiError, r as PlatformClient } from "./client-DM9Kcf4e.mjs";
16
+ import { n as drizzleKitBin } from "./yarn-pnp-DLbEFMT0.mjs";
17
+ import { n as formatTimestamp } from "./gen-CufHEf42.mjs";
17
18
  import { createRequire } from "node:module";
18
- import { existsSync, readFileSync, readdirSync, renameSync, rmSync, writeFileSync } from "node:fs";
19
- import { fileURLToPath, pathToFileURL } from "node:url";
19
+ import { existsSync, mkdirSync, readFileSync, readdirSync, renameSync, rmSync, writeFileSync } from "node:fs";
20
+ import { pathToFileURL } from "node:url";
21
+ import { createJiti } from "jiti";
20
22
  import { execFileSync } from "node:child_process";
21
23
  //#region src/cli/db-export-sequences.ts
22
24
  function quoteSqlIdentifier(value) {
@@ -116,7 +118,6 @@ async function exportPgConstraints(client, tables) {
116
118
  }
117
119
  //#endregion
118
120
  //#region src/cli/db.ts
119
- const drizzleKitBin = join(fileURLToPath(import.meta.resolve("drizzle-kit")), "..", "bin.cjs");
120
121
  const DEFAULT_SEED_FILES = [
121
122
  "db/seed.ts",
122
123
  "db/seed.mts",
@@ -133,13 +134,15 @@ const MODULE_SEED_EXTENSIONS = /* @__PURE__ */ new Set([
133
134
  function getLocalD1Target(root) {
134
135
  const detected = detectFramework(root);
135
136
  const defaultPersistRoot = detected && (detected.class === "b" || detected.class === "c") ? join(root, ".wrangler", "state") : join(root, ".void");
136
- const bindingName = resolveBindingNames(readConfig(root).inference?.bindings)?.d1 ?? "DB";
137
137
  return resolveLocalD1Target(root, {
138
- bindingName,
138
+ bindingName: configuredD1Binding(root),
139
139
  defaultPersistRoot,
140
140
  readPersistState: true
141
141
  });
142
142
  }
143
+ function configuredD1Binding(root) {
144
+ return resolveBindingNames(readConfig(root).inference?.bindings)?.d1 ?? "DB";
145
+ }
143
146
  function runDrizzleKit(root, args) {
144
147
  execFileSync(process.execPath, [drizzleKitBin, ...args], {
145
148
  cwd: root,
@@ -153,7 +156,7 @@ function runDrizzleKit(root, args) {
153
156
  * already printed its own error.
154
157
  */
155
158
  async function runDrizzleKitWithDatabaseUrl(root, url, dialect, command) {
156
- const { withPrivateDrizzleConfig } = await import("./config-BtSFvXZx.mjs");
159
+ const { withPrivateDrizzleConfig } = await import("./config-QrJWu0IX.mjs");
157
160
  if (!withPrivateDrizzleConfig(root, url, dialect, (configPath) => {
158
161
  try {
159
162
  runDrizzleKit(root, [
@@ -167,21 +170,13 @@ async function runDrizzleKitWithDatabaseUrl(root, url, dialect, command) {
167
170
  }
168
171
  })) process.exit(1);
169
172
  }
170
- function getErrorMessage(error) {
171
- return error instanceof Error ? error.message : String(error);
172
- }
173
- function getPgUrl(root) {
174
- const url = loadLocalEnv(root).DATABASE_URL;
175
- if (!url) throw new Error("DATABASE_URL not found in .env. Add it to connect to your local PostgreSQL database.");
176
- return url;
177
- }
178
- function getMySqlUrl(root) {
173
+ function getLocalDatabaseUrl(root, dialect) {
179
174
  const url = loadLocalEnv(root).DATABASE_URL;
180
- if (!url) throw new Error("DATABASE_URL not found in .env. Add it to connect to your local MySQL database.");
175
+ if (!url) throw new Error(`DATABASE_URL not found in .env. Add it to connect to your local ${dialect === "mysql" ? "MySQL" : "PostgreSQL"} database.`);
181
176
  return url;
182
177
  }
183
178
  async function withPgClient(root, fn) {
184
- const url = getPgUrl(root);
179
+ const url = getLocalDatabaseUrl(root, "postgresql");
185
180
  const { Client } = await import("pg");
186
181
  const client = new Client({ connectionString: url });
187
182
  await client.connect();
@@ -192,24 +187,16 @@ async function withPgClient(root, fn) {
192
187
  }
193
188
  }
194
189
  async function withMySqlClient(root, fn) {
190
+ const { toMySqlClient } = await import("./runner-mysql-DWwE8jKi.mjs");
195
191
  const { createConnection } = await import("mysql2/promise");
196
192
  const connection = await createConnection({
197
- uri: getMySqlUrl(root),
193
+ uri: getLocalDatabaseUrl(root, "mysql"),
198
194
  multipleStatements: true
199
195
  });
200
- const client = {
201
- async query(sql, params) {
202
- const [rows] = await connection.query(sql, params);
203
- return Array.isArray(rows) ? rows : [];
204
- },
205
- async end() {
206
- await connection.end();
207
- }
208
- };
209
196
  try {
210
- return await fn(client);
197
+ return await fn(toMySqlClient(connection));
211
198
  } finally {
212
- await client.end();
199
+ await connection.end();
213
200
  }
214
201
  }
215
202
  function validatePendingMigrations(migrations, appliedNames) {
@@ -223,12 +210,12 @@ async function runDbCommand(root, args) {
223
210
  if (args.action === "push") await runPush(root, dialect);
224
211
  else if (args.action === "generate") await runGenerate(root, dialect);
225
212
  else if (args.action === "status") await runStatus(root, dialect);
226
- else if (args.action === "reset") await runReset(root, dialect);
227
- else if (args.action === "seed") await runSeed(root, args.file, dialect);
213
+ else if (args.action === "reset") await runReset(root, dialect, args.yes);
214
+ else if (args.action === "seed") await runSeed(root, args.file, dialect, args.yes);
228
215
  else if (args.action === "execute") await runExecute(root, args.command, args.file, dialect, args.remote);
229
216
  else if (args.action === "migrate") await runMigrate(root, dialect, args.remote);
230
217
  else if (args.action === "studio") await runStudio(root, dialect, args.remote);
231
- else if (args.action === "set-url") await runSetUrl(root);
218
+ else if (args.action === "set-url") await runSetUrl(root, dialect);
232
219
  else if (args.action === "connect") await runConnect(root, dialect, args);
233
220
  else if (args.action === "rename-migrations") await runRenameMigrations(root, dialect);
234
221
  else await runExport(root, args, dialect);
@@ -288,15 +275,14 @@ async function runConnect(root, dialect, args) {
288
275
  });
289
276
  connectionString = result.connectionString;
290
277
  log.step(`Provisioned ${adapter.label} database.`);
291
- if (result.dashboardUrl) log.info(`Dashboard: ${result.dashboardUrl}`);
278
+ if (result.dashboardUrl) log.info(`Dashboard: ${formatUrl(result.dashboardUrl)}`);
292
279
  }
293
280
  if (!connectionString) {
294
- const { text: promptText, isCancel: isCancelCheck } = await import("./dist-Bx1z6Eva.mjs");
295
- const answer = await promptText({
281
+ const answer = await text({
296
282
  message: `Enter your ${dialect === "mysql" ? "MySQL" : "PostgreSQL"} connection string:`,
297
283
  placeholder: dialect === "mysql" ? "mysql://user:pass@host:3306/database" : "postgresql://user:pass@host:5432/database"
298
284
  });
299
- if (isCancelCheck(answer)) process.exit(0);
285
+ if (isCancel(answer)) process.exit(0);
300
286
  connectionString = answer;
301
287
  }
302
288
  const parsed = new URL(connectionString);
@@ -315,13 +301,11 @@ async function runConnect(root, dialect, args) {
315
301
  }
316
302
  async function runPush(root, dialect) {
317
303
  if (dialect !== "sqlite") {
318
- await runDrizzleKitWithDatabaseUrl(root, dialect === "mysql" ? getMySqlUrl(root) : getPgUrl(root), dialect, "push");
304
+ await runDrizzleKitWithDatabaseUrl(root, getLocalDatabaseUrl(root, dialect), dialect, "push");
319
305
  printSuccess("Database schema pushed.");
320
306
  return;
321
307
  }
322
- const { writeDrizzleConfig } = await import("./config-BtSFvXZx.mjs");
323
- const { mkdirSync } = await import("node:fs");
324
- const { dirname } = await import("./dist-_UUlL6bg.mjs");
308
+ const { writeDrizzleConfig } = await import("./config-QrJWu0IX.mjs");
325
309
  const { databasePath: dbPath } = getLocalD1Target(root);
326
310
  mkdirSync(dirname(dbPath), { recursive: true });
327
311
  const configPath = writeDrizzleConfig(root, dbPath);
@@ -337,15 +321,15 @@ async function runPush(root, dialect) {
337
321
  printSuccess("Database schema pushed.");
338
322
  }
339
323
  async function runGenerate(root, dialect) {
340
- const { prepareProject } = await import("./prepare-DRUV-g3X.mjs");
341
- const { writeDrizzleConfig } = await import("./config-BtSFvXZx.mjs");
324
+ const { prepareProject } = await import("./prepare-CYT6tAzD.mjs");
325
+ const { PLACEHOLDER_DB_URL, writeDrizzleConfig } = await import("./config-QrJWu0IX.mjs");
342
326
  await prepareProject(root);
343
327
  const authSchemaPath = join(root, ".void", "better-auth-schema.ts");
344
328
  const additionalSchemas = existsSync(authSchemaPath) ? [authSchemaPath] : void 0;
345
- const configPath = writeDrizzleConfig(root, dialect === "postgresql" ? "postgresql://dummy" : dialect === "mysql" ? "mysql://dummy" : ":memory:", dialect, { additionalSchemas });
329
+ const configPath = writeDrizzleConfig(root, PLACEHOLDER_DB_URL[dialect], dialect, { additionalSchemas });
346
330
  try {
347
331
  if (dialect === "sqlite") {
348
- const { generateValidatedSqliteMigrations } = await import("./generate-GDbL7sUr.mjs");
332
+ const { generateValidatedSqliteMigrations } = await import("./generate-ClI89brV.mjs");
349
333
  await generateValidatedSqliteMigrations(readProjectPaths(root).migrationsDir, () => {
350
334
  runDrizzleKit(root, [
351
335
  "generate",
@@ -380,45 +364,35 @@ async function runStatus(root, dialect) {
380
364
  }
381
365
  let localApplied;
382
366
  if (dialect === "postgresql") try {
383
- localApplied = await withPgClient(root, async (client) => {
384
- try {
385
- return (await client.query("SELECT name FROM _void_migrations ORDER BY name")).rows;
386
- } catch {
387
- return [];
388
- }
389
- });
367
+ const { readPgAppliedMigrations } = await import("./runner-pg-_Xncr3H5.mjs");
368
+ localApplied = await withPgClient(root, readPgAppliedMigrations);
390
369
  } catch {
391
370
  localApplied = [];
392
371
  }
393
372
  else if (dialect === "mysql") try {
394
- localApplied = await withMySqlClient(root, async (client) => {
395
- try {
396
- return await client.query("SELECT `name` FROM `_void_migrations` ORDER BY `name`");
397
- } catch {
398
- return [];
399
- }
400
- });
373
+ const { readMySqlAppliedMigrations } = await import("./runner-mysql-DWwE8jKi.mjs");
374
+ localApplied = await withMySqlClient(root, readMySqlAppliedMigrations);
401
375
  } catch {
402
376
  localApplied = [];
403
377
  }
404
378
  else {
405
- const { getAppliedMigrations } = await import("./runner-9wjsSZx-.mjs");
379
+ const { getAppliedMigrations } = await import("./runner-So9mYfcm.mjs");
406
380
  const { databasePath: dbPath } = getLocalD1Target(root);
407
- localApplied = await getAppliedMigrations(dbPath);
381
+ localApplied = (await getAppliedMigrations(dbPath)).map((m) => m.name);
408
382
  }
409
- const localSet = new Set(localApplied.map((m) => m.name));
383
+ const localSet = new Set(localApplied);
410
384
  let remoteApplied = null;
411
385
  if (readDeploymentPlatform(root) === "cloudflare") try {
412
386
  if (dialect !== "sqlite") {
413
387
  const databaseUrl = process.env.DATABASE_URL;
414
388
  if (!databaseUrl) throw new Error("DATABASE_URL is not available.");
415
- remoteApplied = (dialect === "postgresql" ? await (await import("./runner-pg-BGYRFdRp.mjs")).getPgAppliedMigrations(databaseUrl) : await (await import("./runner-mysql-CkFqZ6CE.mjs")).getMySqlAppliedMigrations(databaseUrl)).map((name) => ({
389
+ remoteApplied = (dialect === "postgresql" ? await (await import("./runner-pg-_Xncr3H5.mjs")).getPgAppliedMigrations(databaseUrl) : await (await import("./runner-mysql-DWwE8jKi.mjs")).getMySqlAppliedMigrations(databaseUrl)).map((name) => ({
416
390
  name,
417
391
  applied_at: ""
418
392
  }));
419
393
  } else {
420
- const { readCloudflareD1Migrations, resolveCloudflareD1Context } = await import("./cloudflare-operations-BlYLlowZ.mjs");
421
- remoteApplied = (await readCloudflareD1Migrations(resolveCloudflareD1Context(root, resolveBindingNames(readConfig(root).inference?.bindings)?.d1 ?? "DB"))).map((name) => ({
394
+ const { readCloudflareD1Migrations, resolveCloudflareD1Context } = await import("./cloudflare-operations-CrSUFRzJ.mjs");
395
+ remoteApplied = (await readCloudflareD1Migrations(resolveCloudflareD1Context(root, configuredD1Binding(root)))).map((name) => ({
422
396
  name,
423
397
  applied_at: ""
424
398
  }));
@@ -449,7 +423,30 @@ async function runStatus(root, dialect) {
449
423
  }
450
424
  outro(parts.join(", "));
451
425
  }
452
- async function resetDatabase(root, dialect) {
426
+ const LOCAL_DATABASE_HOSTS = /* @__PURE__ */ new Set([
427
+ "",
428
+ "localhost",
429
+ "127.0.0.1",
430
+ "::1",
431
+ "[::1]"
432
+ ]);
433
+ /**
434
+ * `.env` may hold the deployed database URL (`void db connect` writes it there), so ask before
435
+ * dropping every table on any other host. Without a TTY, require `--yes`.
436
+ */
437
+ async function confirmDropAllTables(host, target, yes) {
438
+ if (yes || LOCAL_DATABASE_HOSTS.has(host) || host.startsWith("/")) return;
439
+ if (!process.stdin.isTTY) {
440
+ log.error(`db: Refusing to drop every table in ${target} without confirmation. Re-run with --yes.`);
441
+ process.exit(1);
442
+ }
443
+ const ok = await confirm({ message: `This drops every table in ${target}. Continue?` });
444
+ if (isCancel(ok) || !ok) {
445
+ log.info("Cancelled.");
446
+ process.exit(0);
447
+ }
448
+ }
449
+ async function resetDatabase(root, dialect, yes) {
453
450
  const migrationsDir = readProjectPaths(root).migrationsDir;
454
451
  const migrations = collectMigrations(migrationsDir);
455
452
  try {
@@ -459,59 +456,51 @@ async function resetDatabase(root, dialect) {
459
456
  process.exit(1);
460
457
  }
461
458
  if (dialect === "postgresql") {
459
+ const { Client } = await import("pg");
460
+ const { host, port, database } = new Client({ connectionString: getLocalDatabaseUrl(root, dialect) });
461
+ await confirmDropAllTables(host, `database "${database}" on ${host}:${port}`, yes);
462
+ const { applyPgMigrations } = await import("./runner-pg-_Xncr3H5.mjs");
462
463
  await withPgClient(root, async (client) => {
463
464
  const tables = await client.query("SELECT tablename FROM pg_tables WHERE schemaname = 'public'");
464
465
  for (const row of tables.rows) await client.query(`DROP TABLE IF EXISTS "${row.tablename}" CASCADE`);
465
- });
466
- if (migrations.length > 0) await withPgClient(root, async (client) => {
467
- await client.query(`CREATE TABLE IF NOT EXISTS _void_migrations (name TEXT PRIMARY KEY, applied_at TEXT NOT NULL)`);
468
- for (const m of migrations) {
469
- await client.query("BEGIN");
470
- try {
471
- await client.query(m.sql);
472
- await client.query("INSERT INTO _void_migrations (name, applied_at) VALUES ($1, $2)", [m.name, (/* @__PURE__ */ new Date()).toISOString()]);
473
- await client.query("COMMIT");
474
- } catch (err) {
475
- await client.query("ROLLBACK");
476
- throw err;
477
- }
478
- }
466
+ await applyPgMigrations(client, migrations);
479
467
  });
480
468
  return migrations.length;
481
469
  }
482
470
  if (dialect === "mysql") {
483
- await withMySqlClient(root, async (client) => {
484
- const tables = await client.query("SELECT table_name FROM information_schema.tables WHERE table_schema = DATABASE() AND table_type = 'BASE TABLE'");
471
+ const { hostname, host, pathname } = new URL(getLocalDatabaseUrl(root, dialect));
472
+ await confirmDropAllTables(hostname, `database "${decodeURIComponent(pathname.slice(1))}" on ${host}`, yes);
473
+ const { applyPendingMySqlMigrations, withMySqlMigrationLock } = await import("./runner-mysql-DWwE8jKi.mjs");
474
+ await withMySqlClient(root, (client) => withMySqlMigrationLock(client, async () => {
475
+ const tables = await client.query("SELECT table_name AS table_name FROM information_schema.tables WHERE table_schema = DATABASE() AND table_type = 'BASE TABLE'");
485
476
  await client.query("SET FOREIGN_KEY_CHECKS = 0");
486
477
  try {
487
478
  for (const row of tables) {
479
+ if (row.table_name === "_void_migration_lock") continue;
488
480
  const table = String(row.table_name).replaceAll("`", "``");
489
481
  await client.query(`DROP TABLE IF EXISTS \`${table}\``);
490
482
  }
491
483
  } finally {
492
484
  await client.query("SET FOREIGN_KEY_CHECKS = 1");
493
485
  }
494
- });
495
- if (migrations.length > 0) {
496
- const { applyMySqlMigrations } = await import("./runner-mysql-CkFqZ6CE.mjs");
497
- await withMySqlClient(root, (client) => applyMySqlMigrations(client, migrations));
498
- }
486
+ await applyPendingMySqlMigrations(client, migrations);
487
+ }));
499
488
  return migrations.length;
500
489
  }
501
- const { runMigrations } = await import("./runner-9wjsSZx-.mjs");
490
+ const { runMigrations } = await import("./runner-So9mYfcm.mjs");
502
491
  const { databasePath: dbPath } = getLocalD1Target(root);
503
492
  rmSync(dbPath, { force: true });
504
493
  rmSync(dbPath + "-wal", { force: true });
505
494
  rmSync(dbPath + "-shm", { force: true });
506
495
  return (await runMigrations(migrationsDir, dbPath)).length;
507
496
  }
508
- async function runReset(root, dialect) {
509
- const count = await resetDatabase(root, dialect);
497
+ async function runReset(root, dialect, yes) {
498
+ const count = await resetDatabase(root, dialect, yes);
510
499
  if (dialect === "sqlite") log.info(dim("Restart your dev server if it's running."));
511
500
  printSuccess(`Database reset. Applied ${formatCount(count, "migration")}.`);
512
501
  }
513
- async function runSeed(root, file, dialect) {
514
- const migrationCount = await resetDatabase(root, dialect);
502
+ async function runSeed(root, file, dialect, yes) {
503
+ const migrationCount = await resetDatabase(root, dialect, yes);
515
504
  log.step(`Reset database. Applied ${formatCount(migrationCount, "migration")}.`);
516
505
  const seed = resolveSeedTarget(root, file);
517
506
  if (seed.kind === "sql") {
@@ -530,7 +519,7 @@ async function runSeed(root, file, dialect) {
530
519
  printSuccess(`Seeded from ${seed.displayPath}.`);
531
520
  return;
532
521
  }
533
- const { openSqliteDatabase } = await import("./runner-9wjsSZx-.mjs");
522
+ const { openSqliteDatabase } = await import("./runner-So9mYfcm.mjs");
534
523
  const { databasePath: dbPath } = getLocalD1Target(root);
535
524
  const db = await openSqliteDatabase(dbPath);
536
525
  try {
@@ -543,37 +532,10 @@ async function runSeed(root, file, dialect) {
543
532
  printSuccess(`Seeded from ${seed.displayPath}.`);
544
533
  }
545
534
  /**
546
- * Returns true when the SQL is read-only (SELECT / EXPLAIN only).
547
- * Used to skip the destructive-statement safety prompt for safe queries.
548
- *
549
- * This is a fail-closed heuristic, not a real SQL parser:
550
- * - SQL comments (slash-star block and double-dash line) are stripped first,
551
- * so commented variants like `EXPLAIN <block-comment> ANALYZE DELETE FROM
552
- * users` or `EXPLAIN -- c\n ANALYZE ...` can't bypass the EXPLAIN ANALYZE
553
- * check by hiding the `ANALYZE` keyword behind a comment that PostgreSQL
554
- * treats as whitespace. This also handles leading comments, so
555
- * `-- header\nSELECT 1` is classified as safe.
556
- * - The comment-stripping regex is naive and doesn't understand string
557
- * literals: a string literal containing a block-comment marker will have its
558
- * contents stripped. That's harmless here (still classified as SELECT, still
559
- * safe), but worth knowing if this helper is ever reused.
560
- * - `WITH` (CTEs) is intentionally excluded: writable CTEs such as
561
- * `WITH deleted AS (DELETE FROM users RETURNING *) SELECT * FROM deleted`
562
- * are destructive but match a naive `WITH` prefix check. Users with
563
- * read-only CTEs will see the safety prompt — minor friction, safe by default.
564
- * - Multi-statement SQL (`SELECT 1; DELETE FROM users`) is rejected: any `;`
565
- * followed by non-whitespace content after stripping a trailing semicolon is
566
- * treated as unsafe.
567
- * - `EXPLAIN ANALYZE` is explicitly excluded: in PostgreSQL, `EXPLAIN ANALYZE`
568
- * actually executes the underlying statement (including DML) to collect runtime
569
- * statistics. A naive `EXPLAIN` prefix check would treat it as safe when it is
570
- * in fact destructive. Only plain `EXPLAIN` (without `ANALYZE`) is allowed.
571
- * - `EXPLAIN (...)` parenthesized option lists (PostgreSQL) are scanned for
572
- * `ANALYZE`. The bare-keyword form `EXPLAIN ANALYZE ...` and the option-list
573
- * form `EXPLAIN (ANALYZE) ...` / `EXPLAIN (ANALYZE TRUE) ...` both execute
574
- * the underlying statement, so either shape is rejected. Even
575
- * `EXPLAIN (ANALYZE FALSE)` is rejected (over-strict, but safer than
576
- * guessing the boolean value of an arbitrary option expression).
535
+ * Fail-closed check for read-only SQL (SELECT or plain EXPLAIN), which skips the remote
536
+ * confirmation prompt. Comments are stripped first so they cannot hide `ANALYZE`.
537
+ * Multiple statements and `WITH` (a CTE can write) are rejected, and so is `EXPLAIN ANALYZE`
538
+ * in either form, because PostgreSQL executes the analyzed statement.
577
539
  */
578
540
  function isSafeStatement(sql) {
579
541
  const stripped = sql.replace(/\/\*[\s\S]*?\*\//g, " ").replace(/--[^\n]*/g, " ").replace(/;\s*$/, "");
@@ -653,8 +615,8 @@ async function runExecute(root, command, file, dialect, remote) {
653
615
  process.exit(0);
654
616
  }
655
617
  if (dialect === "sqlite") {
656
- const { executeCloudflareD1Sql, resolveCloudflareD1Context } = await import("./cloudflare-operations-BlYLlowZ.mjs");
657
- const rows = await executeCloudflareD1Sql(resolveCloudflareD1Context(root, resolveBindingNames(readConfig(root).inference?.bindings)?.d1 ?? "DB"), sql);
618
+ const { executeCloudflareD1Sql, resolveCloudflareD1Context } = await import("./cloudflare-operations-CrSUFRzJ.mjs");
619
+ const rows = await executeCloudflareD1Sql(resolveCloudflareD1Context(root, configuredD1Binding(root)), sql);
658
620
  if (rows.length > 0) printTable(rows);
659
621
  } else {
660
622
  const dbUrl = process.env.DATABASE_URL;
@@ -687,8 +649,7 @@ async function runExecute(root, command, file, dialect, remote) {
687
649
  return;
688
650
  }
689
651
  const platformClient = new PlatformClient(token, { root });
690
- const voidConfig = readConfig(root);
691
- let binding = resolveBindingNames(voidConfig.inference?.bindings)?.d1 ?? "DB";
652
+ let binding = configuredD1Binding(root);
692
653
  try {
693
654
  const d1Resource = (await platformClient.getResources(projectConfig.projectId)).find((r) => r.type === "d1");
694
655
  if (d1Resource) binding = d1Resource.binding_name;
@@ -754,7 +715,7 @@ async function runExecute(root, command, file, dialect, remote) {
754
715
  printSuccess("SQL executed successfully.");
755
716
  return;
756
717
  }
757
- const { openSqliteDatabase } = await import("./runner-9wjsSZx-.mjs");
718
+ const { openSqliteDatabase } = await import("./runner-So9mYfcm.mjs");
758
719
  const { databasePath: dbPath } = getLocalD1Target(root);
759
720
  if (!existsSync(dbPath)) {
760
721
  log.error("No local database found. Run `void dev` first.");
@@ -818,11 +779,11 @@ async function runMigrate(root, dialect, remote) {
818
779
  let appliedNames;
819
780
  let applyMigrations;
820
781
  if (dialect === "postgresql") {
821
- const { getPgAppliedMigrations, runPgMigrations } = await import("./runner-pg-BGYRFdRp.mjs");
782
+ const { getPgAppliedMigrations, runPgMigrations } = await import("./runner-pg-_Xncr3H5.mjs");
822
783
  appliedNames = await getPgAppliedMigrations(databaseUrl);
823
784
  applyMigrations = () => runPgMigrations(migrationsDir, databaseUrl);
824
785
  } else {
825
- const { getMySqlAppliedMigrations, runMySqlMigrations } = await import("./runner-mysql-CkFqZ6CE.mjs");
786
+ const { getMySqlAppliedMigrations, runMySqlMigrations } = await import("./runner-mysql-DWwE8jKi.mjs");
826
787
  appliedNames = await getMySqlAppliedMigrations(databaseUrl);
827
788
  applyMigrations = () => runMySqlMigrations(migrationsDir, databaseUrl);
828
789
  }
@@ -847,8 +808,8 @@ async function runMigrate(root, dialect, remote) {
847
808
  log.info(`No migration files found in ${paths.sourceRelative("db/migrations")}/`);
848
809
  return;
849
810
  }
850
- const { applyCloudflareD1Migrations, readCloudflareD1Migrations, resolveCloudflareD1Context } = await import("./cloudflare-operations-BlYLlowZ.mjs");
851
- const binding = resolveBindingNames(readConfig(root).inference?.bindings)?.d1 ?? "DB";
811
+ const { applyCloudflareD1Migrations, readCloudflareD1Migrations, resolveCloudflareD1Context } = await import("./cloudflare-operations-CrSUFRzJ.mjs");
812
+ const binding = configuredD1Binding(root);
852
813
  const context = resolveCloudflareD1Context(root, binding);
853
814
  const remoteBefore = new Set(await readCloudflareD1Migrations(context));
854
815
  const pending = rawMigrations.filter((migration) => !remoteBefore.has(migration.name));
@@ -862,7 +823,7 @@ async function runMigrate(root, dialect, remote) {
862
823
  log.error(getErrorMessage(error));
863
824
  process.exit(1);
864
825
  }
865
- const { checkWranglerMigrationApplySet, parseRootWranglerConfig } = await import("./deploy-VsWsVQkw.mjs");
826
+ const { checkWranglerMigrationApplySet, parseRootWranglerConfig } = await import("./deploy-9lgfhrXS.mjs");
866
827
  const applySet = await checkWranglerMigrationApplySet(context.operation.configPath, parseRootWranglerConfig(context.operation.configPath), binding, context.migrationsDir, rawMigrations);
867
828
  if (!applySet.ok) {
868
829
  log.error(applySet.reason);
@@ -920,21 +881,15 @@ async function runMigrate(root, dialect, remote) {
920
881
  }
921
882
  if (result.applied.length === 0) log.info("Remote database is up to date.");
922
883
  else for (const name of result.applied) log.step(name);
923
- for (const warning of result.warnings ?? []) log.warn(warning);
924
884
  if (result.applied.length > 0) printSuccess(`Applied ${formatCount(result.applied.length, "migration")} to remote database.`);
925
885
  return;
926
886
  }
927
887
  if (dialect === "postgresql") {
928
- const { applyPgMigrations } = await import("./runner-pg-BGYRFdRp.mjs");
888
+ const { applyPgMigrations, readPgAppliedMigrations } = await import("./runner-pg-_Xncr3H5.mjs");
929
889
  const applied = await withPgClient(root, async (client) => {
930
- let existingRows = [];
890
+ const appliedNames = await readPgAppliedMigrations(client).catch(() => []);
931
891
  try {
932
- existingRows = (await client.query("SELECT name FROM _void_migrations")).rows;
933
- } catch {
934
- existingRows = [];
935
- }
936
- try {
937
- validatePendingMigrations(rawMigrations, new Set(existingRows.map((row) => row.name)));
892
+ validatePendingMigrations(rawMigrations, new Set(appliedNames));
938
893
  } catch (err) {
939
894
  log.error(getErrorMessage(err));
940
895
  process.exit(1);
@@ -949,16 +904,11 @@ async function runMigrate(root, dialect, remote) {
949
904
  return;
950
905
  }
951
906
  if (dialect === "mysql") {
952
- const { applyMySqlMigrations } = await import("./runner-mysql-CkFqZ6CE.mjs");
907
+ const { applyMySqlMigrations, readMySqlAppliedMigrations } = await import("./runner-mysql-DWwE8jKi.mjs");
953
908
  const applied = await withMySqlClient(root, async (client) => {
954
- let existingRows = [];
955
- try {
956
- existingRows = await client.query("SELECT `name` FROM `_void_migrations`");
957
- } catch {
958
- existingRows = [];
959
- }
909
+ const appliedNames = await readMySqlAppliedMigrations(client).catch(() => []);
960
910
  try {
961
- validatePendingMigrations(rawMigrations, new Set(existingRows.map((row) => row.name)));
911
+ validatePendingMigrations(rawMigrations, new Set(appliedNames));
962
912
  } catch (err) {
963
913
  log.error(getErrorMessage(err));
964
914
  process.exit(1);
@@ -972,7 +922,7 @@ async function runMigrate(root, dialect, remote) {
972
922
  }
973
923
  return;
974
924
  }
975
- const { getAppliedMigrations, runMigrations } = await import("./runner-9wjsSZx-.mjs");
925
+ const { getAppliedMigrations, runMigrations } = await import("./runner-So9mYfcm.mjs");
976
926
  const { databasePath: dbPath } = getLocalD1Target(root);
977
927
  try {
978
928
  const existingRows = await getAppliedMigrations(dbPath);
@@ -1020,12 +970,12 @@ async function runStudio(root, dialect, remote) {
1020
970
  return;
1021
971
  }
1022
972
  if (dialect !== "sqlite") {
1023
- const url = dialect === "mysql" ? getMySqlUrl(root) : getPgUrl(root);
973
+ const url = getLocalDatabaseUrl(root, dialect);
1024
974
  log.info("Opening Drizzle Studio...");
1025
975
  await runDrizzleKitWithDatabaseUrl(root, url, dialect, "studio");
1026
976
  return;
1027
977
  }
1028
- const { writeDrizzleConfig } = await import("./config-BtSFvXZx.mjs");
978
+ const { writeDrizzleConfig } = await import("./config-QrJWu0IX.mjs");
1029
979
  const { databasePath: dbPath } = getLocalD1Target(root);
1030
980
  if (!existsSync(dbPath)) {
1031
981
  log.error("No local database found. Run `void dev` first.");
@@ -1067,7 +1017,6 @@ async function runRenameMigrations(root, dialect) {
1067
1017
  return;
1068
1018
  }
1069
1019
  const timestampFiles = files.filter((f) => /^\d{14}_/.test(f));
1070
- const formatTs = formatTimestamp;
1071
1020
  let baseTime;
1072
1021
  if (timestampFiles.length > 0) {
1073
1022
  const earliest = timestampFiles[0].slice(0, 14);
@@ -1083,21 +1032,20 @@ async function runRenameMigrations(root, dialect) {
1083
1032
  for (let fileIndex = 0; fileIndex < oldStyleFiles.length; fileIndex++) {
1084
1033
  const oldName = oldStyleFiles[fileIndex];
1085
1034
  const description = oldName.replace(/^\d+_/, "");
1086
- const newName = `${formatTs(new Date(baseTime.getTime() + fileIndex * 1e3))}_${description}`;
1035
+ const ts = new Date(baseTime.getTime() + fileIndex * 1e3);
1036
+ const newName = `${formatTimestamp(ts)}_${description}`;
1087
1037
  renames.push({
1088
1038
  from: oldName,
1089
1039
  to: newName
1090
1040
  });
1091
1041
  }
1092
- const journalPath = join(migrationsDir, "meta", "_journal.json");
1093
- const originalJournalBytes = existsSync(journalPath) ? readFileSync(journalPath) : null;
1094
1042
  const metaDir = join(migrationsDir, "meta");
1043
+ const journalPath = join(metaDir, "_journal.json");
1044
+ const originalJournalBytes = existsSync(journalPath) ? readFileSync(journalPath) : null;
1045
+ const journal = readJournal(migrationsDir);
1095
1046
  const snapshotPrefix = (tag) => tag.split("_")[0];
1096
1047
  const snapshotPathFor = (tag) => join(metaDir, `${snapshotPrefix(tag)}_snapshot.json`);
1097
- const preRenameJournal = readJournal(migrationsDir);
1098
- const drizzleArtifacts = listDrizzleArtifacts(migrationsDir);
1099
- const isBareLegacyPlaceholder = preRenameJournal !== void 0 && preRenameJournal !== null && typeof preRenameJournal === "object" && Array.isArray(preRenameJournal.entries) && preRenameJournal.entries.length === 0 && drizzleArtifacts.length === 0;
1100
- if (originalJournalBytes !== null && !isBareLegacyPlaceholder) {
1048
+ if (journal && journal.entries.length > 0) {
1101
1049
  const missingSnapshots = [];
1102
1050
  for (const { from } of renames) {
1103
1051
  const fromTag = stripSqlExt(from);
@@ -1127,9 +1075,26 @@ async function runRenameMigrations(root, dialect) {
1127
1075
  log.error(String(err));
1128
1076
  process.exit(1);
1129
1077
  }
1130
- const reverseRemote = async () => {
1131
- if (!remoteRenamed || !token || !config) return;
1132
- try {
1078
+ let journalRewritten = false;
1079
+ const renamed = [];
1080
+ const renamedSnapshots = [];
1081
+ const rollback = async (message, err) => {
1082
+ for (const { from, to } of renamedSnapshots) try {
1083
+ renameSync(to, from);
1084
+ } catch (error) {
1085
+ log.warn(`db: Could not reverse snapshot rename for '${from}'. The meta/ directory may be in a partial state.`);
1086
+ log.warn(String(error));
1087
+ }
1088
+ for (const { from, to } of renamed) try {
1089
+ renameSync(join(migrationsDir, to), join(migrationsDir, from));
1090
+ } catch {}
1091
+ if (journalRewritten && originalJournalBytes !== null) try {
1092
+ writeFileSync(journalPath, originalJournalBytes);
1093
+ } catch (error) {
1094
+ 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.");
1095
+ log.warn(String(error));
1096
+ }
1097
+ if (remoteRenamed && token && config) try {
1133
1098
  const client = new PlatformClient(token, { root });
1134
1099
  const reversed = renames.map(({ from, to }) => ({
1135
1100
  from: to,
@@ -1139,26 +1104,9 @@ async function runRenameMigrations(root, dialect) {
1139
1104
  } catch {
1140
1105
  log.warn("db: Could not reverse remote rename. Run `void deploy` to sync remote records.");
1141
1106
  }
1142
- };
1143
- let journalRewritten = false;
1144
- const restoreJournal = () => {
1145
- if (!journalRewritten || originalJournalBytes === null) return;
1146
- try {
1147
- writeFileSync(journalPath, originalJournalBytes);
1148
- } catch (err) {
1149
- 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.");
1150
- log.warn(String(err));
1151
- }
1152
- };
1153
- const renamed = [];
1154
- const renamedSnapshots = [];
1155
- const reverseSnapshotRenames = () => {
1156
- for (const { from, to } of renamedSnapshots) try {
1157
- renameSync(to, from);
1158
- } catch (err) {
1159
- log.warn(`db: Could not reverse snapshot rename for '${from}'. The meta/ directory may be in a partial state.`);
1160
- log.warn(String(err));
1161
- }
1107
+ log.error(message);
1108
+ log.error(String(err));
1109
+ process.exit(1);
1162
1110
  };
1163
1111
  try {
1164
1112
  for (const { from, to } of renames) {
@@ -1168,10 +1116,8 @@ async function runRenameMigrations(root, dialect) {
1168
1116
  to
1169
1117
  });
1170
1118
  log.step(`${from} → ${to}`);
1171
- const fromTag = stripSqlExt(from);
1172
- const toTag = stripSqlExt(to);
1173
- const snapshotFrom = snapshotPathFor(fromTag);
1174
- const snapshotTo = snapshotPathFor(toTag);
1119
+ const snapshotFrom = snapshotPathFor(stripSqlExt(from));
1120
+ const snapshotTo = snapshotPathFor(stripSqlExt(to));
1175
1121
  if (existsSync(snapshotFrom)) {
1176
1122
  renameSync(snapshotFrom, snapshotTo);
1177
1123
  renamedSnapshots.push({
@@ -1181,22 +1127,14 @@ async function runRenameMigrations(root, dialect) {
1181
1127
  }
1182
1128
  }
1183
1129
  } catch (err) {
1184
- reverseSnapshotRenames();
1185
- for (const { from, to } of renamed) try {
1186
- renameSync(join(migrationsDir, to), join(migrationsDir, from));
1187
- } catch {}
1188
- restoreJournal();
1189
- await reverseRemote();
1190
- log.error("db: Failed to rename migration files. All changes have been reverted.");
1191
- log.error(String(err));
1192
- process.exit(1);
1130
+ await rollback("db: Failed to rename migration files. All changes have been reverted.", err);
1193
1131
  }
1194
- if (originalJournalBytes !== null) try {
1195
- const journal = readJournal(migrationsDir);
1196
- if (!journal) throw new Error("db: db/migrations/meta/_journal.json disappeared mid-run. File renames will be reverted.");
1132
+ if (journal) try {
1133
+ const current = readJournal(migrationsDir);
1134
+ if (!current) throw new Error("db: db/migrations/meta/_journal.json disappeared mid-run. File renames will be reverted.");
1197
1135
  const renameMap = /* @__PURE__ */ new Map();
1198
1136
  for (const { from, to } of renames) renameMap.set(stripSqlExt(from), stripSqlExt(to));
1199
- const updatedEntries = journal.entries.map((entry) => {
1137
+ const updatedEntries = current.entries.map((entry) => {
1200
1138
  const next = renameMap.get(entry.tag);
1201
1139
  return next ? {
1202
1140
  ...entry,
@@ -1205,20 +1143,12 @@ async function runRenameMigrations(root, dialect) {
1205
1143
  });
1206
1144
  journalRewritten = true;
1207
1145
  writeJournal(migrationsDir, {
1208
- version: journal.version,
1209
- dialect: journal.dialect,
1146
+ version: current.version,
1147
+ dialect: current.dialect,
1210
1148
  entries: updatedEntries
1211
1149
  });
1212
1150
  } catch (err) {
1213
- reverseSnapshotRenames();
1214
- for (const { from, to } of renames) try {
1215
- renameSync(join(migrationsDir, to), join(migrationsDir, from));
1216
- } catch {}
1217
- restoreJournal();
1218
- await reverseRemote();
1219
- log.error("db: Failed to update db/migrations/meta/_journal.json. File renames have been reverted.");
1220
- log.error(String(err));
1221
- process.exit(1);
1151
+ await rollback("db: Failed to update db/migrations/meta/_journal.json. File renames have been reverted.", err);
1222
1152
  }
1223
1153
  if (dialect === "postgresql") try {
1224
1154
  await withPgClient(root, async (client) => {
@@ -1233,15 +1163,7 @@ async function runRenameMigrations(root, dialect) {
1233
1163
  }
1234
1164
  });
1235
1165
  } catch (err) {
1236
- reverseSnapshotRenames();
1237
- for (const { from, to } of renames) try {
1238
- renameSync(join(migrationsDir, to), join(migrationsDir, from));
1239
- } catch {}
1240
- restoreJournal();
1241
- await reverseRemote();
1242
- 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.");
1243
- log.error(String(err));
1244
- process.exit(1);
1166
+ await rollback("db: Failed to update PostgreSQL tracking table. File renames have been reverted.\nFix the database connection and run `void db rename-migrations` again.", err);
1245
1167
  }
1246
1168
  else if (dialect === "mysql") try {
1247
1169
  await withMySqlClient(root, async (client) => {
@@ -1249,18 +1171,10 @@ async function runRenameMigrations(root, dialect) {
1249
1171
  for (const { from, to } of renames) await client.query("UPDATE `_void_migrations` SET `name` = ? WHERE `name` = ?", [to, from]);
1250
1172
  });
1251
1173
  } catch (err) {
1252
- reverseSnapshotRenames();
1253
- for (const { from, to } of renames) try {
1254
- renameSync(join(migrationsDir, to), join(migrationsDir, from));
1255
- } catch {}
1256
- restoreJournal();
1257
- await reverseRemote();
1258
- log.error("db: Failed to update MySQL tracking table. File renames have been reverted.\nFix the database connection and run `void db rename-migrations` again.");
1259
- log.error(String(err));
1260
- process.exit(1);
1174
+ await rollback("db: Failed to update MySQL tracking table. File renames have been reverted.\nFix the database connection and run `void db rename-migrations` again.", err);
1261
1175
  }
1262
1176
  else {
1263
- const { openSqliteDatabase } = await import("./runner-9wjsSZx-.mjs");
1177
+ const { openSqliteDatabase } = await import("./runner-So9mYfcm.mjs");
1264
1178
  const { databasePath: dbPath } = getLocalD1Target(root);
1265
1179
  if (existsSync(dbPath)) try {
1266
1180
  const db = await openSqliteDatabase(dbPath);
@@ -1278,15 +1192,7 @@ async function runRenameMigrations(root, dialect) {
1278
1192
  db.close();
1279
1193
  }
1280
1194
  } catch (err) {
1281
- reverseSnapshotRenames();
1282
- for (const { from, to } of renames) try {
1283
- renameSync(join(migrationsDir, to), join(migrationsDir, from));
1284
- } catch {}
1285
- restoreJournal();
1286
- await reverseRemote();
1287
- 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.");
1288
- log.error(String(err));
1289
- process.exit(1);
1195
+ await rollback("db: Failed to update SQLite tracking table. File renames have been reverted.\nFix the database issue and run `void db rename-migrations` again.", err);
1290
1196
  }
1291
1197
  }
1292
1198
  printSuccess(`Renamed ${formatCount(renames.length, "migration")} to timestamp format.`);
@@ -1383,7 +1289,8 @@ async function runExport(root, args, dialect) {
1383
1289
  process.exit(1);
1384
1290
  }
1385
1291
  tables = [args.table];
1386
- } else tables = (await client.query("SELECT table_name FROM information_schema.tables WHERE table_schema = DATABASE() AND table_type = 'BASE TABLE' AND table_name NOT LIKE '\\_%' ORDER BY table_name")).map((row) => String(row.table_name));
1292
+ } else tables = (await client.query("SELECT table_name AS table_name FROM information_schema.tables WHERE table_schema = DATABASE() AND table_type = 'BASE TABLE' AND table_name NOT LIKE '\\_%' ORDER BY table_name")).map((row) => String(row.table_name));
1293
+ parts.push("SET FOREIGN_KEY_CHECKS = 0;");
1387
1294
  for (const table of tables) {
1388
1295
  const escapedTable = table.replaceAll("`", "``");
1389
1296
  if (!args.noSchema) {
@@ -1401,6 +1308,7 @@ async function runExport(root, args, dialect) {
1401
1308
  }
1402
1309
  parts.push("");
1403
1310
  }
1311
+ parts.push("SET FOREIGN_KEY_CHECKS = 1;", "");
1404
1312
  });
1405
1313
  const output = parts.join("\n");
1406
1314
  if (args.output) {
@@ -1409,7 +1317,7 @@ async function runExport(root, args, dialect) {
1409
1317
  } else process.stdout.write(output);
1410
1318
  return;
1411
1319
  }
1412
- const { openSqliteDatabase } = await import("./runner-9wjsSZx-.mjs");
1320
+ const { openSqliteDatabase } = await import("./runner-So9mYfcm.mjs");
1413
1321
  const { databasePath: dbPath } = getLocalD1Target(root);
1414
1322
  if (!existsSync(dbPath)) {
1415
1323
  log.error("No local database found. Run `void dev` first.", errOut);
@@ -1473,9 +1381,7 @@ async function runExport(root, args, dialect) {
1473
1381
  db.close();
1474
1382
  }
1475
1383
  }
1476
- async function runSetUrl(root) {
1477
- const { readConfig: readVoidConfig, getDatabaseDialect: getDialect } = await import("./config-5r-YpMC-.mjs");
1478
- const dialect = getDialect(readVoidConfig(root));
1384
+ async function runSetUrl(root, dialect) {
1479
1385
  if (dialect === "sqlite") {
1480
1386
  log.error("db: This command is only for PostgreSQL and MySQL projects. Set \"database\" to \"pg\" or \"mysql\" in void.config.ts.");
1481
1387
  process.exit(1);
@@ -1490,8 +1396,7 @@ async function runSetUrl(root) {
1490
1396
  log.error("No project linked. Run `void deploy` first or link a project.");
1491
1397
  process.exit(1);
1492
1398
  }
1493
- const { text: promptText, isCancel: isCancelCheck } = await import("./dist-Bx1z6Eva.mjs");
1494
- const connectionString = await promptText({
1399
+ const connectionString = await text({
1495
1400
  message: `Enter your ${dialect === "mysql" ? "MySQL" : "PostgreSQL"} connection string:`,
1496
1401
  placeholder: dialect === "mysql" ? "mysql://user:pass@host:3306/dbname" : "postgresql://user:pass@host:5432/dbname",
1497
1402
  validate(value = "") {
@@ -1500,7 +1405,7 @@ async function runSetUrl(root) {
1500
1405
  } else if (!value.startsWith("postgres://") && !value.startsWith("postgresql://")) return "Connection string must start with \"postgres://\" or \"postgresql://\"";
1501
1406
  }
1502
1407
  });
1503
- if (isCancelCheck(connectionString)) process.exit(0);
1408
+ if (isCancel(connectionString)) process.exit(0);
1504
1409
  await new PlatformClient(token, { root }).setDatabaseUrl(projectConfig.projectId, connectionString);
1505
1410
  printSuccess("Database URL updated.");
1506
1411
  }
@@ -1559,7 +1464,7 @@ async function runSeedModule(root, seedPath, dialect) {
1559
1464
  if (dialect === "mysql") {
1560
1465
  const { drizzle } = await import("drizzle-orm/mysql2");
1561
1466
  const { createConnection } = await import("mysql2/promise");
1562
- const connection = await createConnection(getMySqlUrl(root));
1467
+ const connection = await createConnection(getLocalDatabaseUrl(root, "mysql"));
1563
1468
  try {
1564
1469
  const options = getDrizzleSchemaOptions(schema);
1565
1470
  await seed({
@@ -1576,7 +1481,7 @@ async function runSeedModule(root, seedPath, dialect) {
1576
1481
  return;
1577
1482
  }
1578
1483
  const { drizzle } = await import("drizzle-orm/better-sqlite3");
1579
- const { openSqliteDatabase } = await import("./runner-9wjsSZx-.mjs");
1484
+ const { openSqliteDatabase } = await import("./runner-So9mYfcm.mjs");
1580
1485
  const { databasePath: dbPath } = getLocalD1Target(root);
1581
1486
  const sqlite = await openSqliteDatabase(dbPath);
1582
1487
  try {
@@ -1597,7 +1502,7 @@ async function loadSeedFunction(seedPath) {
1597
1502
  return seed;
1598
1503
  }
1599
1504
  async function loadSeedSchema(root) {
1600
- const { discoverSchema } = await import("./discover-EDUf6JJw.mjs");
1505
+ const { discoverSchema } = await import("./discover-ClzFSwns.mjs");
1601
1506
  const location = discoverSchema(root, readProjectPaths(root));
1602
1507
  if (!location) return {};
1603
1508
  if (location.type === "file") {
@@ -1621,7 +1526,11 @@ function collectSchemaModuleFiles(dir) {
1621
1526
  return files.sort();
1622
1527
  }
1623
1528
  async function importLocalModule(modulePath) {
1624
- return import(`${pathToFileURL(modulePath).href}?t=${Date.now()}`);
1529
+ return createJiti(import.meta.url, {
1530
+ fsCache: false,
1531
+ moduleCache: false,
1532
+ interopDefault: false
1533
+ }).import(modulePath);
1625
1534
  }
1626
1535
  function getDrizzleSchemaOptions(schema) {
1627
1536
  return Object.keys(schema).length > 0 ? { schema } : void 0;