void 0.21.1 → 0.21.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.
- package/README.md +3 -2
- package/dist/{auth-cmd-g_ymMkUe.mjs → account-cmd-DGt9cpRe.mjs} +10 -10
- package/dist/{agents-gni4eqBu.mjs → agents-B_pX_HmQ.mjs} +1 -1
- package/dist/ast-CPGPjb0V.mjs +18 -0
- package/dist/{auth-CAw7zHqj.mjs → auth-CZuiVsFh.mjs} +1 -1
- package/dist/{auth-B9_D6ygs.mjs → auth-DLNN0D3Z.mjs} +4 -4
- package/dist/{auth-link-DFvxIyZi.mjs → auth-link-Cl9vOuf7.mjs} +5 -5
- package/dist/auth-router-D4ZcMUSf.mjs +74 -0
- package/dist/{better-auth-shared-BoVwA5Vm.d.mts → better-auth-shared-BVkjZ3vM.d.mts} +1 -0
- package/dist/{better-auth-shared-syGYYmnY.mjs → better-auth-shared-rsBGBvWJ.mjs} +3 -6
- package/dist/{build-cmd-wJAv808h.mjs → build-cmd-Dpt0jd-x.mjs} +5 -5
- package/dist/{cache-Be0Fu5Ka.mjs → cache-7_UeZdTk.mjs} +5 -5
- package/dist/{cancel-deploy-BgmyOwhe.mjs → cancel-deploy-D23R1RXT.mjs} +4 -4
- package/dist/{cf-access-rAZxzMkL.mjs → cf-access-P0iZnu0q.mjs} +1 -1
- package/dist/{cf-build-output-CTdlo6Rt.mjs → cf-build-output-CGT03qCD.mjs} +2 -2
- package/dist/cli/cf-compat.mjs +2 -2
- package/dist/cli/cli.mjs +122 -66
- package/dist/cli/env-schema-probe.mjs +3 -3
- package/dist/client-4cDVv7BO.mjs +2 -0
- package/dist/{client-PdAJ-F0t.mjs → client-QTl6ko_D.mjs} +28 -5
- package/dist/{cloudflare-auth-BCmTc1X_.mjs → cloudflare-auth-B9jPCkV2.mjs} +1 -1
- package/dist/{cloudflare-cmd-D6PrKn7o.mjs → cloudflare-cmd-BjNxR1XF.mjs} +3 -3
- package/dist/{cloudflare-connect-DloREDlc.mjs → cloudflare-connect-CCUozPOe.mjs} +3 -3
- package/dist/{cloudflare-operations-BHNJVDbN.mjs → cloudflare-operations-BipGMJ5O.mjs} +1 -1
- package/dist/{cloudflare-operations-CPEdHYhM.mjs → cloudflare-operations-sMZXpk_S.mjs} +4 -4
- package/dist/collect-DLyFDiKW.mjs +2 -0
- package/dist/{collect-DXHNWHcT.mjs → collect-DiTn9yr6.mjs} +1 -1
- package/dist/config-0acf1oys.mjs +2 -0
- package/dist/{config-DywxBLQC.d.mts → config-CF69HgXc.d.mts} +7 -0
- package/dist/{config-Dxr6cTXn.mjs → config-CafTW6Cz.mjs} +12 -1
- package/dist/{config-BSe70f4T.mjs → config-D8MOgiQV.mjs} +3 -3
- package/dist/config-DPByhVck.mjs +32 -0
- package/dist/config-entry.d.mts +1 -1
- package/dist/{config--T87TD8T.mjs → config-s7Xj7tPb.mjs} +1 -1
- package/dist/{config-write-y3CBI_ux.mjs → config-write-BSduPMY8.mjs} +3 -3
- package/dist/{connect-LnvW4HKx.mjs → connect-4Ph5Y0QE.mjs} +8 -8
- package/dist/{create-project-JV9-6ICF.mjs → create-project-BniEV0OW.mjs} +1 -1
- package/dist/{create-project-BZBl_gQ0.mjs → create-project-DBfFSZKY.mjs} +4 -4
- package/dist/{db-Mzv88E1C.mjs → db-DzJRn-qz.mjs} +128 -60
- package/dist/{delete-Ri6JemSU.mjs → delete-D6dZ9B6B.mjs} +5 -5
- package/dist/deploy-BH0grP4y.mjs +2 -0
- package/dist/{deploy-DEsMVrCY.mjs → deploy-CsMJrPfM.mjs} +522 -262
- package/dist/discover-AMCBXivQ.mjs +2 -0
- package/dist/{discover-C4O6YxVS.mjs → discover-BcPPiF1o.mjs} +2 -2
- package/dist/{dist-4WkAWhWx.mjs → dist-BVqXeR_h.mjs} +9 -1
- package/dist/dist-_UUlL6bg.mjs +2 -0
- package/dist/{domain-BA37Ye7T.mjs → domain-Dmhvb2oU.mjs} +5 -5
- package/dist/{email-C5kaZXzJ.mjs → email--tEtMoj_.mjs} +1 -1
- package/dist/{email-C5NsxrQG.mjs → email-BRKOG2RG.mjs} +10 -10
- package/dist/{entry-DdRFGK0y.mjs → entry-CF5wvH4w.mjs} +4 -21
- package/dist/{env-U_ohASB0.mjs → env-Csi-tMbT.mjs} +8 -8
- package/dist/{env-Yz4HcvHs.mjs → env-D5liuQYR.mjs} +5 -2
- package/dist/{env-DX_v-Q-v.mjs → env-_v349JBd.mjs} +1 -1
- package/dist/{env-types-CWDtqHgw.mjs → env-types-C2_bIk_b.mjs} +2 -2
- package/dist/{env-validation-BsFEXps5.mjs → env-validation-BB4GkLxn.mjs} +4 -4
- package/dist/{env-validation-DIDGM7h4.mjs → env-validation-BXge7uyK.mjs} +1 -1
- package/dist/{gen-pg-Ojg8Y.mjs → gen-Dz3X1Qab.mjs} +8 -8
- package/dist/gen-Vnv2f65C.mjs +2 -0
- package/dist/{generate-C0VY6RVf.mjs → generate-GDbL7sUr.mjs} +2 -2
- package/dist/{github-cmd-DsrkweIl.mjs → github-cmd-BED3_9JD.mjs} +7 -7
- package/dist/{headers-B_HBMgi0.mjs → headers-BOg_velo.mjs} +2 -2
- package/dist/{help-sBhFH6pi.mjs → help-DC7gdz7L.mjs} +46 -11
- package/dist/help-DQMfeKMz.mjs +2 -0
- package/dist/index.mjs +134 -160
- package/dist/{init-C--Yyj1b.mjs → init-CRGDXzVC.mjs} +105 -289
- package/dist/{link-BC-mNG9-.mjs → link-CsHOinF7.mjs} +6 -6
- package/dist/{list-DHU1Wj6c.mjs → list-CDb-4bZ1.mjs} +6 -6
- package/dist/{local-d1-DzykTWY8.mjs → local-d1-CC8sKFGu.mjs} +3 -3
- package/dist/{login-jKe_0QZL.mjs → login-BQyISZuW.mjs} +4 -4
- package/dist/login-r2gL8l7B.mjs +2 -0
- package/dist/{logs-BG11f5PR.mjs → logs-BdfiOezj.mjs} +5 -5
- package/dist/{migrate-BV8qHiCb.mjs → migrate-B8KuoYsO.mjs} +69 -44
- package/dist/migrate-TsHGBnDA.mjs +2 -0
- package/dist/{node-Cupyf7-s.mjs → node-BM43oz4G.mjs} +5 -5
- package/dist/{operator-auth-BkVgJqv-.mjs → operator-auth-8KnOVXVd.mjs} +2 -2
- package/dist/{operator-client-A0iex2yi.mjs → operator-client-DUwumHpQ.mjs} +2 -2
- package/dist/{operator-cmd-BwAS2XZt.mjs → operator-cmd-Co-PeaeD.mjs} +6 -6
- package/dist/{package-json-iCbMg5XF.mjs → package-json-DXfiT1jV.mjs} +1 -1
- package/dist/pages/index.d.mts +1 -1
- package/dist/pages/index.mjs +11 -6
- package/dist/pages/islands-plugin.d.mts +271 -1
- package/dist/pages/islands-plugin.mjs +95 -18
- package/dist/parse-filename-DioPHiR9.mjs +77 -0
- package/dist/{platform-auth-config-C-hv-_Ok.mjs → platform-auth-config-TSw8edHw.mjs} +5 -5
- package/dist/{platform-auth-protection-DjTE5Hj-.mjs → platform-auth-protection-Ba1XqGhn.mjs} +6 -6
- package/dist/{platform-auth-recovery-Cr0r8TEb.mjs → platform-auth-recovery-BkT3EsF2.mjs} +5 -5
- package/dist/{platform-cmd-DE6dw45v.mjs → platform-cmd-C8OqhqPt.mjs} +1 -1
- package/dist/{platform-cmd-0tEh2ZtA.mjs → platform-cmd-CRSKfu8k.mjs} +5 -5
- package/dist/{platform-domain-B_7x6Iqx.mjs → platform-domain-j9YCXRm6.mjs} +3 -3
- package/dist/{platform-lifecycle-Di0LbhPM.mjs → platform-lifecycle-78H0XQUA.mjs} +278 -230
- package/dist/{platform-lifecycle-Dhx9Pnub.mjs → platform-lifecycle-DDc9zCeJ.mjs} +1 -1
- package/dist/{platform-management-eaiaU3uM.mjs → platform-management-6w8-DUjC.mjs} +2 -2
- package/dist/{platform-management-B9LUtMt9.mjs → platform-management-DzKNsMlt.mjs} +1 -1
- package/dist/{platform-recovery-BxfA8E5C.mjs → platform-recovery-Do8VOyDE.mjs} +3 -3
- package/dist/{platform-registry-BJbgZLS1.mjs → platform-registry-QBa4DK32.mjs} +1 -1
- package/dist/{plugin-inference-DsvtJLll.mjs → plugin-inference-BMfKRSqE.mjs} +188 -85
- package/dist/prepare-BZXkjdNe.mjs +2 -0
- package/dist/{prepare-pcWcxSCh.mjs → prepare-C3kt3Rst.mjs} +11 -11
- package/dist/{prepare-_T-Haxrr.mjs → prepare-DyZ-Yok5.mjs} +1 -1
- package/dist/{prerender-render-Cf_WDE9W.mjs → prerender-render-D9qbLs2f.mjs} +1 -1
- package/dist/prerender-render.mjs +1 -1
- package/dist/{preset-Dowh9tTt.mjs → preset-UHj9ARyP.mjs} +4 -4
- package/dist/{project-BEBFDFLz.mjs → project-BuUwfj6f.mjs} +1 -1
- package/dist/{project-CWNIPoXc.mjs → project-C0Fqu05O.mjs} +2 -2
- package/dist/{project-cmd-DrnRJdep.mjs → project-cmd-B44I8J_W.mjs} +16 -16
- package/dist/{project-paths-CKQ-Q5JS.mjs → project-paths-GgcMozYz.mjs} +1 -1
- package/dist/{project-team-CzRbO_kA.mjs → project-team-BkbYIsXN.mjs} +6 -6
- package/dist/{project-token-Bwxjf4y6.mjs → project-token-C8xEEQnB.mjs} +4 -4
- package/dist/{project-tsconfig-CwfqUnVp.mjs → project-tsconfig-B8GeM0RM.mjs} +2 -2
- package/dist/{provision-Cck2m3jJ.mjs → provision-BhreDAOS.mjs} +141 -78
- package/dist/provision-DNtrtaVD.mjs +3 -0
- package/dist/{requests-DwrqUQZ8.mjs → requests-DFyhBMaf.mjs} +4 -4
- package/dist/{resolve-project-Xvis70DG.mjs → resolve-project-BG5ORGID.mjs} +1 -1
- package/dist/resolve-project-DtbidV4y.mjs +2 -0
- package/dist/{rollback-B4tFWmkN.mjs → rollback-DHHxXZiS.mjs} +5 -5
- package/dist/{route-types-Id82-veQ.mjs → route-types-Clm4WD0B.mjs} +39 -16
- package/dist/{runner-CQs_cDSG.mjs → runner-B8wXwWlo.mjs} +1 -1
- package/dist/{runner-mysql-1o47achK.mjs → runner-mysql-CEG5JozK.mjs} +1 -1
- package/dist/{runner-mysql-BhwMk2Bm.mjs → runner-mysql-DmWchSWJ.mjs} +1 -1
- package/dist/{runner-BGVsGgkb.mjs → runner-p-dMs2UN.mjs} +3 -3
- package/dist/{runner-pg-D7z01mQS.mjs → runner-pg-Bh4AgZdj.mjs} +1 -1
- package/dist/{runner-pg-CJ_JeGF6.mjs → runner-pg-D4OPlil-.mjs} +1 -1
- package/dist/runtime/better-auth-mysql.d.mts +1 -1
- package/dist/runtime/better-auth-mysql.mjs +1 -1
- package/dist/runtime/better-auth-pg.d.mts +1 -1
- package/dist/runtime/better-auth-pg.mjs +1 -1
- package/dist/runtime/better-auth.d.mts +1 -1
- package/dist/runtime/better-auth.mjs +2 -2
- package/dist/runtime/db.mjs +8 -5
- package/dist/runtime/durable.mjs +1 -1
- package/dist/runtime/email/testing.mjs +1 -1
- package/dist/runtime/env-public.mjs +1 -1
- package/dist/runtime/env.d.mts +1 -1
- package/dist/runtime/env.mjs +1 -1
- package/dist/runtime/kv.mjs +1 -1
- package/dist/runtime/live-server.mjs +38 -23
- package/dist/runtime/queues.mjs +1 -1
- package/dist/runtime/sandbox.mjs +1 -1
- package/dist/runtime/storage.mjs +1 -1
- package/dist/runtime/ws-server.d.mts +1 -1
- package/dist/runtime/ws-server.mjs +1 -1
- package/dist/{scan-DJbooZm2.mjs → scan-4tfN-PSn.mjs} +113 -99
- package/dist/{scan-DdDvRCU1.mjs → scan-ClYmX3sa.mjs} +35 -137
- package/dist/{secret-UtrRjhEO.mjs → secret-DN9sSNiV.mjs} +7 -7
- package/dist/{skills-B-690E7h.mjs → skills-O6FUaizK.mjs} +2 -2
- package/dist/sveltekit.mjs +1 -1
- package/dist/{validate-qNhV00PD.mjs → validate-CIUwFpjB.mjs} +2 -2
- package/dist/validate-EKmJWxmy.mjs +2 -0
- package/dist/{wrangler-D01qs6VB.mjs → wrangler-BymcxrRa.mjs} +3 -3
- package/dist/{yarn-pnp-CVEc3gE7.mjs → yarn-pnp-BV4AzNul.mjs} +1 -1
- package/package.json +7 -7
- package/schema.json +18 -0
- package/skills/migrate-vite-cloudflare-to-void/SKILL.md +1 -1
- package/skills/void/SKILL.md +4 -2
- package/skills/void/docs/guide/app-types.md +1 -1
- package/skills/void/docs/guide/auth.md +2 -2
- package/skills/void/docs/guide/database/d1.md +6 -0
- package/skills/void/docs/guide/durable-state.md +1 -1
- package/skills/void/docs/guide/edge/rewrites.md +2 -3
- package/skills/void/docs/guide/env-migration.md +1 -1
- package/skills/void/docs/guide/pages-routing/markdown.md +1 -1
- package/skills/void/docs/guide/platform/administration/access.md +1 -1
- package/skills/void/docs/guide/platform/development/local.md +1 -1
- package/skills/void/docs/guide/platform/installation/prerequisites.md +2 -2
- package/skills/void/docs/guide/platform/installation/setup.md +1 -1
- package/skills/void/docs/guide/project-collaboration.md +1 -1
- package/skills/void/docs/guide/server-routing.md +2 -3
- package/skills/void/docs/guide/ssr.md +4 -10
- package/skills/void/docs/guide/websockets.md +1 -1
- package/skills/void/docs/integrations/cloudflare.md +2 -0
- package/skills/void/docs/reference/api.md +1 -1
- package/skills/void/docs/reference/cli.md +34 -13
- package/skills/void/docs/reference/config.md +12 -1
- package/skills/void/docs/reference/resource-inference.md +1 -1
- package/dist/client-DAAivdid.mjs +0 -2
- package/dist/collect-DAUItMDS.mjs +0 -2
- package/dist/config-DDIFxQYx.mjs +0 -2
- package/dist/config-uP7ZDtVZ.mjs +0 -21
- package/dist/deploy-DAH2-m_-.mjs +0 -2
- package/dist/discover-BBzDZe_o.mjs +0 -2
- package/dist/dist-D7-nEOXi.mjs +0 -2
- package/dist/gen-B87rlalt.mjs +0 -2
- package/dist/help-B403BLBB.mjs +0 -2
- package/dist/login-BwiopVdg.mjs +0 -2
- package/dist/migrate-BXY3B3m7.mjs +0 -2
- package/dist/prepare-D4CkM3_v.mjs +0 -2
- package/dist/provision-CNgEBkVA.mjs +0 -3
- package/dist/resolve-project-BTotl8Nn.mjs +0 -2
- package/dist/validate-DqJ33oHj.mjs +0 -2
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { c as import_picocolors } from "./output-CCH48AMM.mjs";
|
|
2
|
-
import { s as getSiteDomain } from "./auth-
|
|
3
|
-
import { d as writeProjectConfig, t as attachSelectedPlatform } from "./project-
|
|
2
|
+
import { s as getSiteDomain } from "./auth-DLNN0D3Z.mjs";
|
|
3
|
+
import { d as writeProjectConfig, t as attachSelectedPlatform } from "./project-C0Fqu05O.mjs";
|
|
4
4
|
import { B as text, E as confirm, I as select, T as cancel, W as isCancel, j as log } from "./dist-Dn6nn2IU.mjs";
|
|
5
|
-
import { t as PlatformApiError } from "./client-
|
|
5
|
+
import { t as PlatformApiError } from "./client-QTl6ko_D.mjs";
|
|
6
6
|
import { t as validateProjectSlug } from "./project-slug-23TpquG4.mjs";
|
|
7
|
-
import { n as inferDefaultSlug } from "./resolve-project-
|
|
7
|
+
import { n as inferDefaultSlug } from "./resolve-project-BG5ORGID.mjs";
|
|
8
8
|
//#region src/cli/prompt.ts
|
|
9
9
|
async function promptProjectSetupAction(message = "Set up a Void project:", options = {}) {
|
|
10
10
|
const result = await select({
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { a as join, l as relative, r as extname, t as basename, u as resolve } from "./dist-
|
|
1
|
+
import { a as join, l as relative, r as extname, t as basename, u as resolve } from "./dist-BVqXeR_h.mjs";
|
|
2
2
|
import { a as dim, c as import_picocolors, r as cliTitle } from "./output-CCH48AMM.mjs";
|
|
3
|
-
import { n as readProjectPaths } from "./project-paths-
|
|
3
|
+
import { n as readProjectPaths } from "./project-paths-GgcMozYz.mjs";
|
|
4
4
|
import { t as cfAccessHeaders } from "./cf-access-DRsQRe6k.mjs";
|
|
5
|
-
import { c as getToken, o as getProxyUrl } from "./auth-
|
|
6
|
-
import { i as isCloudflareAccessChallenge, n as ensurePlatformAccessToken, r as ensurePlatformProxyAccess } from "./cf-access-
|
|
7
|
-
import { i as readDeploymentPlatform, o as readProjectConfig } from "./project-
|
|
8
|
-
import { h as resolveBindingNames, m as readConfig, u as getDatabaseDialect } from "./config-
|
|
9
|
-
import { r as detectFramework } from "./plugin-inference-
|
|
10
|
-
import { i as writeJournal, n as readJournal, r as stripSqlExt, t as collectMigrations } from "./collect-
|
|
11
|
-
import { t as resolveLocalD1Target } from "./local-d1-
|
|
12
|
-
import { a as loadLocalEnv } from "./env-
|
|
5
|
+
import { c as getToken, o as getProxyUrl } from "./auth-DLNN0D3Z.mjs";
|
|
6
|
+
import { i as isCloudflareAccessChallenge, n as ensurePlatformAccessToken, r as ensurePlatformProxyAccess } from "./cf-access-P0iZnu0q.mjs";
|
|
7
|
+
import { i as readDeploymentPlatform, o as readProjectConfig } from "./project-C0Fqu05O.mjs";
|
|
8
|
+
import { h as resolveBindingNames, m as readConfig, u as getDatabaseDialect } from "./config-CafTW6Cz.mjs";
|
|
9
|
+
import { r as detectFramework } from "./plugin-inference-BMfKRSqE.mjs";
|
|
10
|
+
import { i as writeJournal, n as readJournal, r as stripSqlExt, t as collectMigrations } from "./collect-DiTn9yr6.mjs";
|
|
11
|
+
import { t as resolveLocalD1Target } from "./local-d1-CC8sKFGu.mjs";
|
|
12
|
+
import { a as loadLocalEnv } from "./env-_v349JBd.mjs";
|
|
13
13
|
import { E as confirm, O as intro, P as outro, W as isCancel, j as log } from "./dist-Dn6nn2IU.mjs";
|
|
14
|
-
import { i as validateMigrations, r as listDrizzleArtifacts, t as assertJournalCoherence } from "./validate-
|
|
15
|
-
import { n as PlatformClient, t as PlatformApiError } from "./client-
|
|
16
|
-
import { n as formatTimestamp } from "./gen-
|
|
14
|
+
import { i as validateMigrations, r as listDrizzleArtifacts, t as assertJournalCoherence } from "./validate-CIUwFpjB.mjs";
|
|
15
|
+
import { n as PlatformClient, t as PlatformApiError } from "./client-QTl6ko_D.mjs";
|
|
16
|
+
import { n as formatTimestamp } from "./gen-Dz3X1Qab.mjs";
|
|
17
17
|
import { createRequire } from "node:module";
|
|
18
18
|
import { existsSync, readFileSync, readdirSync, renameSync, rmSync, writeFileSync } from "node:fs";
|
|
19
19
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
@@ -25,9 +25,44 @@ function quoteSqlIdentifier(value) {
|
|
|
25
25
|
function quoteSqlString(value) {
|
|
26
26
|
return `'${value.replaceAll("'", "''")}'`;
|
|
27
27
|
}
|
|
28
|
+
/** Fail before writing a schema dump that would silently omit dependent objects. */
|
|
29
|
+
async function assertPgExportableSchema(client, tables, fullExport) {
|
|
30
|
+
const unsupported = (await client.query(`SELECT kind, name FROM (
|
|
31
|
+
SELECT 'view' AS kind, rel.relname AS name
|
|
32
|
+
FROM pg_class rel JOIN pg_namespace ns ON ns.oid = rel.relnamespace
|
|
33
|
+
WHERE ns.nspname = 'public' AND rel.relkind IN ('v', 'm') AND $2::boolean
|
|
34
|
+
UNION ALL
|
|
35
|
+
SELECT 'trigger', tg.tgname
|
|
36
|
+
FROM pg_trigger tg JOIN pg_class tbl ON tbl.oid = tg.tgrelid
|
|
37
|
+
JOIN pg_namespace ns ON ns.oid = tbl.relnamespace
|
|
38
|
+
WHERE ns.nspname = 'public' AND tbl.relname = ANY($1::text[]) AND NOT tg.tgisinternal
|
|
39
|
+
UNION ALL
|
|
40
|
+
SELECT 'custom type', typ.typname
|
|
41
|
+
FROM pg_attribute col JOIN pg_class tbl ON tbl.oid = col.attrelid
|
|
42
|
+
JOIN pg_namespace ns ON ns.oid = tbl.relnamespace
|
|
43
|
+
JOIN pg_type typ ON typ.oid = col.atttypid
|
|
44
|
+
JOIN pg_namespace type_ns ON type_ns.oid = typ.typnamespace
|
|
45
|
+
WHERE ns.nspname = 'public' AND tbl.relname = ANY($1::text[])
|
|
46
|
+
AND col.attnum > 0 AND NOT col.attisdropped AND type_ns.nspname = 'public'
|
|
47
|
+
UNION ALL
|
|
48
|
+
SELECT 'function', proc.proname
|
|
49
|
+
FROM pg_proc proc JOIN pg_namespace ns ON ns.oid = proc.pronamespace
|
|
50
|
+
WHERE ns.nspname = 'public' AND $2::boolean
|
|
51
|
+
UNION ALL
|
|
52
|
+
SELECT 'standalone sequence', seq.relname
|
|
53
|
+
FROM pg_class seq JOIN pg_namespace ns ON ns.oid = seq.relnamespace
|
|
54
|
+
WHERE ns.nspname = 'public' AND seq.relkind = 'S' AND $2::boolean
|
|
55
|
+
AND NOT EXISTS (
|
|
56
|
+
SELECT 1 FROM pg_depend dep WHERE dep.objid = seq.oid
|
|
57
|
+
AND dep.classid = 'pg_class'::regclass AND dep.deptype IN ('a', 'i')
|
|
58
|
+
)
|
|
59
|
+
) objects ORDER BY kind, name LIMIT 1`, [tables, fullExport])).rows[0];
|
|
60
|
+
if (unsupported) throw new Error(`db: PostgreSQL schema contains ${unsupported.kind} ${quoteSqlIdentifier(unsupported.name)}, which void db export cannot restore. Use pg_dump for a complete schema dump.`);
|
|
61
|
+
}
|
|
28
62
|
/** Restore SERIAL dependencies before tables, ownership/state after their data. */
|
|
29
63
|
async function exportPgSequences(client, tables, options) {
|
|
30
64
|
const result = await client.query(`SELECT ns.nspname AS schema_name, seq.relname AS sequence_name,
|
|
65
|
+
dep.deptype AS dependency_type,
|
|
31
66
|
tbl.relname AS table_name, col.attname AS column_name,
|
|
32
67
|
format_type(s.seqtypid, NULL) AS data_type,
|
|
33
68
|
s.seqstart::text AS start_value, s.seqincrement::text AS increment_by,
|
|
@@ -36,17 +71,18 @@ async function exportPgSequences(client, tables, options) {
|
|
|
36
71
|
FROM pg_sequence s
|
|
37
72
|
JOIN pg_class seq ON seq.oid = s.seqrelid
|
|
38
73
|
JOIN pg_namespace ns ON ns.oid = seq.relnamespace
|
|
39
|
-
JOIN pg_depend dep ON dep.objid = seq.oid AND dep.classid = 'pg_class'::regclass
|
|
74
|
+
JOIN pg_depend dep ON dep.objid = seq.oid AND dep.classid = 'pg_class'::regclass
|
|
40
75
|
JOIN pg_class tbl ON tbl.oid = dep.refobjid
|
|
41
76
|
JOIN pg_namespace tblns ON tblns.oid = tbl.relnamespace
|
|
42
77
|
JOIN pg_attribute col ON col.attrelid = tbl.oid AND col.attnum = dep.refobjsubid
|
|
43
78
|
WHERE tblns.nspname = 'public' AND tbl.relname = ANY($1::text[])
|
|
79
|
+
AND dep.deptype IN ('a', 'i')
|
|
44
80
|
ORDER BY ns.nspname, seq.relname`, [tables]);
|
|
45
81
|
const before = [];
|
|
46
82
|
const after = [];
|
|
47
83
|
for (const seq of result.rows) {
|
|
48
84
|
const name = `${quoteSqlIdentifier(seq.schema_name)}.${quoteSqlIdentifier(seq.sequence_name)}`;
|
|
49
|
-
if (!options.noSchema) {
|
|
85
|
+
if (!options.noSchema && seq.dependency_type === "a") {
|
|
50
86
|
before.push(`CREATE SEQUENCE ${name} AS ${seq.data_type} INCREMENT BY ${seq.increment_by} MINVALUE ${seq.min_value} MAXVALUE ${seq.max_value} START WITH ${seq.start_value} CACHE ${seq.cache_size} ${seq.cycle ? "CYCLE" : "NO CYCLE"};`);
|
|
51
87
|
after.push(`ALTER SEQUENCE ${name} OWNED BY "public".${quoteSqlIdentifier(seq.table_name)}.${quoteSqlIdentifier(seq.column_name)};`);
|
|
52
88
|
}
|
|
@@ -260,12 +296,12 @@ async function runConnect(root, dialect, args) {
|
|
|
260
296
|
outro("Database connected.");
|
|
261
297
|
}
|
|
262
298
|
async function runPush(root, dialect) {
|
|
263
|
-
const { writeDrizzleConfig } = await import("./config-
|
|
299
|
+
const { writeDrizzleConfig } = await import("./config-0acf1oys.mjs");
|
|
264
300
|
let configPath;
|
|
265
301
|
if (dialect !== "sqlite") configPath = writeDrizzleConfig(root, dialect === "mysql" ? getMySqlUrl(root) : getPgUrl(root), dialect);
|
|
266
302
|
else {
|
|
267
303
|
const { mkdirSync } = await import("node:fs");
|
|
268
|
-
const { dirname } = await import("./dist-
|
|
304
|
+
const { dirname } = await import("./dist-_UUlL6bg.mjs");
|
|
269
305
|
const { databasePath: dbPath } = getLocalD1Target(root);
|
|
270
306
|
mkdirSync(dirname(dbPath), { recursive: true });
|
|
271
307
|
configPath = writeDrizzleConfig(root, dbPath);
|
|
@@ -282,15 +318,15 @@ async function runPush(root, dialect) {
|
|
|
282
318
|
outro("Done.");
|
|
283
319
|
}
|
|
284
320
|
async function runGenerate(root, dialect) {
|
|
285
|
-
const { prepareProject } = await import("./prepare-
|
|
286
|
-
const { writeDrizzleConfig } = await import("./config-
|
|
321
|
+
const { prepareProject } = await import("./prepare-BZXkjdNe.mjs");
|
|
322
|
+
const { writeDrizzleConfig } = await import("./config-0acf1oys.mjs");
|
|
287
323
|
await prepareProject(root);
|
|
288
324
|
const authSchemaPath = join(root, ".void", "better-auth-schema.ts");
|
|
289
325
|
const additionalSchemas = existsSync(authSchemaPath) ? [authSchemaPath] : void 0;
|
|
290
326
|
const configPath = writeDrizzleConfig(root, dialect === "postgresql" ? "postgresql://dummy" : dialect === "mysql" ? "mysql://dummy" : ":memory:", dialect, { additionalSchemas });
|
|
291
327
|
try {
|
|
292
328
|
if (dialect === "sqlite") {
|
|
293
|
-
const { generateValidatedSqliteMigrations } = await import("./generate-
|
|
329
|
+
const { generateValidatedSqliteMigrations } = await import("./generate-GDbL7sUr.mjs");
|
|
294
330
|
await generateValidatedSqliteMigrations(readProjectPaths(root).migrationsDir, () => {
|
|
295
331
|
runDrizzleKit(root, [
|
|
296
332
|
"generate",
|
|
@@ -348,7 +384,7 @@ async function runStatus(root, dialect) {
|
|
|
348
384
|
localApplied = [];
|
|
349
385
|
}
|
|
350
386
|
else {
|
|
351
|
-
const { getAppliedMigrations } = await import("./runner-
|
|
387
|
+
const { getAppliedMigrations } = await import("./runner-B8wXwWlo.mjs");
|
|
352
388
|
const { databasePath: dbPath } = getLocalD1Target(root);
|
|
353
389
|
localApplied = await getAppliedMigrations(dbPath);
|
|
354
390
|
}
|
|
@@ -358,12 +394,12 @@ async function runStatus(root, dialect) {
|
|
|
358
394
|
if (dialect !== "sqlite") {
|
|
359
395
|
const databaseUrl = process.env.DATABASE_URL;
|
|
360
396
|
if (!databaseUrl) throw new Error("DATABASE_URL is not available.");
|
|
361
|
-
remoteApplied = (dialect === "postgresql" ? await (await import("./runner-pg-
|
|
397
|
+
remoteApplied = (dialect === "postgresql" ? await (await import("./runner-pg-Bh4AgZdj.mjs")).getPgAppliedMigrations(databaseUrl) : await (await import("./runner-mysql-CEG5JozK.mjs")).getMySqlAppliedMigrations(databaseUrl)).map((name) => ({
|
|
362
398
|
name,
|
|
363
399
|
applied_at: ""
|
|
364
400
|
}));
|
|
365
401
|
} else {
|
|
366
|
-
const { readCloudflareD1Migrations, resolveCloudflareD1Context } = await import("./cloudflare-operations-
|
|
402
|
+
const { readCloudflareD1Migrations, resolveCloudflareD1Context } = await import("./cloudflare-operations-BipGMJ5O.mjs");
|
|
367
403
|
remoteApplied = (await readCloudflareD1Migrations(resolveCloudflareD1Context(root, resolveBindingNames(readConfig(root).inference?.bindings)?.d1 ?? "DB"))).map((name) => ({
|
|
368
404
|
name,
|
|
369
405
|
applied_at: ""
|
|
@@ -439,12 +475,12 @@ async function resetDatabase(root, dialect) {
|
|
|
439
475
|
}
|
|
440
476
|
});
|
|
441
477
|
if (migrations.length > 0) {
|
|
442
|
-
const { applyMySqlMigrations } = await import("./runner-mysql-
|
|
478
|
+
const { applyMySqlMigrations } = await import("./runner-mysql-CEG5JozK.mjs");
|
|
443
479
|
await withMySqlClient(root, (client) => applyMySqlMigrations(client, migrations));
|
|
444
480
|
}
|
|
445
481
|
return migrations.length;
|
|
446
482
|
}
|
|
447
|
-
const { runMigrations } = await import("./runner-
|
|
483
|
+
const { runMigrations } = await import("./runner-B8wXwWlo.mjs");
|
|
448
484
|
const { databasePath: dbPath } = getLocalD1Target(root);
|
|
449
485
|
rmSync(dbPath, { force: true });
|
|
450
486
|
rmSync(dbPath + "-wal", { force: true });
|
|
@@ -479,7 +515,7 @@ async function runSeed(root, file, dialect) {
|
|
|
479
515
|
outro("Done.");
|
|
480
516
|
return;
|
|
481
517
|
}
|
|
482
|
-
const { openSqliteDatabase } = await import("./runner-
|
|
518
|
+
const { openSqliteDatabase } = await import("./runner-B8wXwWlo.mjs");
|
|
483
519
|
const { databasePath: dbPath } = getLocalD1Target(root);
|
|
484
520
|
const db = await openSqliteDatabase(dbPath);
|
|
485
521
|
try {
|
|
@@ -605,7 +641,7 @@ async function runExecute(root, command, file, dialect, remote) {
|
|
|
605
641
|
process.exit(0);
|
|
606
642
|
}
|
|
607
643
|
if (dialect === "sqlite") {
|
|
608
|
-
const { executeCloudflareD1Sql, resolveCloudflareD1Context } = await import("./cloudflare-operations-
|
|
644
|
+
const { executeCloudflareD1Sql, resolveCloudflareD1Context } = await import("./cloudflare-operations-BipGMJ5O.mjs");
|
|
609
645
|
const rows = await executeCloudflareD1Sql(resolveCloudflareD1Context(root, resolveBindingNames(readConfig(root).inference?.bindings)?.d1 ?? "DB"), sql);
|
|
610
646
|
if (rows.length > 0) printTable(rows);
|
|
611
647
|
else log.success("Executed successfully.");
|
|
@@ -622,7 +658,7 @@ async function runExecute(root, command, file, dialect, remote) {
|
|
|
622
658
|
}
|
|
623
659
|
const token = getToken(root);
|
|
624
660
|
if (!token) {
|
|
625
|
-
log.error("Not logged in. Run `void
|
|
661
|
+
log.error("Not logged in. Run `void account login` first.");
|
|
626
662
|
process.exit(1);
|
|
627
663
|
}
|
|
628
664
|
const projectConfig = readProjectConfig(root);
|
|
@@ -710,7 +746,7 @@ async function runExecute(root, command, file, dialect, remote) {
|
|
|
710
746
|
outro("Done.");
|
|
711
747
|
return;
|
|
712
748
|
}
|
|
713
|
-
const { openSqliteDatabase } = await import("./runner-
|
|
749
|
+
const { openSqliteDatabase } = await import("./runner-B8wXwWlo.mjs");
|
|
714
750
|
const { databasePath: dbPath } = getLocalD1Target(root);
|
|
715
751
|
if (!existsSync(dbPath)) {
|
|
716
752
|
log.error("No local database found. Run `void dev` first.");
|
|
@@ -778,11 +814,11 @@ async function runMigrate(root, dialect, remote) {
|
|
|
778
814
|
let appliedNames;
|
|
779
815
|
let applyMigrations;
|
|
780
816
|
if (dialect === "postgresql") {
|
|
781
|
-
const { getPgAppliedMigrations, runPgMigrations } = await import("./runner-pg-
|
|
817
|
+
const { getPgAppliedMigrations, runPgMigrations } = await import("./runner-pg-Bh4AgZdj.mjs");
|
|
782
818
|
appliedNames = await getPgAppliedMigrations(databaseUrl);
|
|
783
819
|
applyMigrations = () => runPgMigrations(migrationsDir, databaseUrl);
|
|
784
820
|
} else {
|
|
785
|
-
const { getMySqlAppliedMigrations, runMySqlMigrations } = await import("./runner-mysql-
|
|
821
|
+
const { getMySqlAppliedMigrations, runMySqlMigrations } = await import("./runner-mysql-CEG5JozK.mjs");
|
|
786
822
|
appliedNames = await getMySqlAppliedMigrations(databaseUrl);
|
|
787
823
|
applyMigrations = () => runMySqlMigrations(migrationsDir, databaseUrl);
|
|
788
824
|
}
|
|
@@ -810,7 +846,7 @@ async function runMigrate(root, dialect, remote) {
|
|
|
810
846
|
outro("Done.");
|
|
811
847
|
return;
|
|
812
848
|
}
|
|
813
|
-
const { applyCloudflareD1Migrations, readCloudflareD1Migrations, resolveCloudflareD1Context } = await import("./cloudflare-operations-
|
|
849
|
+
const { applyCloudflareD1Migrations, readCloudflareD1Migrations, resolveCloudflareD1Context } = await import("./cloudflare-operations-BipGMJ5O.mjs");
|
|
814
850
|
const binding = resolveBindingNames(readConfig(root).inference?.bindings)?.d1 ?? "DB";
|
|
815
851
|
const context = resolveCloudflareD1Context(root, binding);
|
|
816
852
|
const remoteBefore = new Set(await readCloudflareD1Migrations(context));
|
|
@@ -826,7 +862,7 @@ async function runMigrate(root, dialect, remote) {
|
|
|
826
862
|
log.error(getErrorMessage(error));
|
|
827
863
|
process.exit(1);
|
|
828
864
|
}
|
|
829
|
-
const { checkWranglerMigrationApplySet, parseRootWranglerConfig } = await import("./deploy-
|
|
865
|
+
const { checkWranglerMigrationApplySet, parseRootWranglerConfig } = await import("./deploy-BH0grP4y.mjs");
|
|
830
866
|
const applySet = await checkWranglerMigrationApplySet(context.operation.configPath, parseRootWranglerConfig(context.operation.configPath), binding, context.migrationsDir, rawMigrations);
|
|
831
867
|
if (!applySet.ok) {
|
|
832
868
|
log.error(applySet.reason);
|
|
@@ -846,7 +882,7 @@ async function runMigrate(root, dialect, remote) {
|
|
|
846
882
|
}
|
|
847
883
|
const token = getToken(root);
|
|
848
884
|
if (!token) {
|
|
849
|
-
log.error("Not logged in. Run `void
|
|
885
|
+
log.error("Not logged in. Run `void account login` first.");
|
|
850
886
|
process.exit(1);
|
|
851
887
|
}
|
|
852
888
|
const config = readProjectConfig(root);
|
|
@@ -895,7 +931,7 @@ async function runMigrate(root, dialect, remote) {
|
|
|
895
931
|
return;
|
|
896
932
|
}
|
|
897
933
|
if (dialect === "postgresql") {
|
|
898
|
-
const { applyPgMigrations } = await import("./runner-pg-
|
|
934
|
+
const { applyPgMigrations } = await import("./runner-pg-Bh4AgZdj.mjs");
|
|
899
935
|
const applied = await withPgClient(root, async (client) => {
|
|
900
936
|
let existingRows = [];
|
|
901
937
|
try {
|
|
@@ -920,7 +956,7 @@ async function runMigrate(root, dialect, remote) {
|
|
|
920
956
|
return;
|
|
921
957
|
}
|
|
922
958
|
if (dialect === "mysql") {
|
|
923
|
-
const { applyMySqlMigrations } = await import("./runner-mysql-
|
|
959
|
+
const { applyMySqlMigrations } = await import("./runner-mysql-CEG5JozK.mjs");
|
|
924
960
|
const applied = await withMySqlClient(root, async (client) => {
|
|
925
961
|
let existingRows = [];
|
|
926
962
|
try {
|
|
@@ -944,7 +980,7 @@ async function runMigrate(root, dialect, remote) {
|
|
|
944
980
|
outro("Done.");
|
|
945
981
|
return;
|
|
946
982
|
}
|
|
947
|
-
const { getAppliedMigrations, runMigrations } = await import("./runner-
|
|
983
|
+
const { getAppliedMigrations, runMigrations } = await import("./runner-B8wXwWlo.mjs");
|
|
948
984
|
const { databasePath: dbPath } = getLocalD1Target(root);
|
|
949
985
|
try {
|
|
950
986
|
const existingRows = await getAppliedMigrations(dbPath);
|
|
@@ -978,7 +1014,7 @@ async function runStudio(root, dialect, remote) {
|
|
|
978
1014
|
} else {
|
|
979
1015
|
const token = getToken(root);
|
|
980
1016
|
if (!token) {
|
|
981
|
-
log.error("Not logged in. Run `void
|
|
1017
|
+
log.error("Not logged in. Run `void account login` first.");
|
|
982
1018
|
process.exit(1);
|
|
983
1019
|
}
|
|
984
1020
|
const projectConfig = readProjectConfig(root);
|
|
@@ -988,7 +1024,7 @@ async function runStudio(root, dialect, remote) {
|
|
|
988
1024
|
}
|
|
989
1025
|
dbUrl = await fetchRemoteDatabaseUrl(new PlatformClient(token, { root }), projectConfig.projectId);
|
|
990
1026
|
}
|
|
991
|
-
const { writeDrizzleConfig } = await import("./config-
|
|
1027
|
+
const { writeDrizzleConfig } = await import("./config-0acf1oys.mjs");
|
|
992
1028
|
const configPath = writeDrizzleConfig(root, dbUrl, dialect);
|
|
993
1029
|
log.info("Opening Drizzle Studio (remote)...");
|
|
994
1030
|
try {
|
|
@@ -1003,7 +1039,7 @@ async function runStudio(root, dialect, remote) {
|
|
|
1003
1039
|
return;
|
|
1004
1040
|
}
|
|
1005
1041
|
if (dialect !== "sqlite") {
|
|
1006
|
-
const { writeDrizzleConfig } = await import("./config-
|
|
1042
|
+
const { writeDrizzleConfig } = await import("./config-0acf1oys.mjs");
|
|
1007
1043
|
const configPath = writeDrizzleConfig(root, dialect === "mysql" ? getMySqlUrl(root) : getPgUrl(root), dialect);
|
|
1008
1044
|
log.info("Opening Drizzle Studio...");
|
|
1009
1045
|
try {
|
|
@@ -1017,7 +1053,7 @@ async function runStudio(root, dialect, remote) {
|
|
|
1017
1053
|
}
|
|
1018
1054
|
return;
|
|
1019
1055
|
}
|
|
1020
|
-
const { writeDrizzleConfig } = await import("./config-
|
|
1056
|
+
const { writeDrizzleConfig } = await import("./config-0acf1oys.mjs");
|
|
1021
1057
|
const { databasePath: dbPath } = getLocalD1Target(root);
|
|
1022
1058
|
if (!existsSync(dbPath)) {
|
|
1023
1059
|
log.error("No local database found. Run `void dev` first.");
|
|
@@ -1109,7 +1145,7 @@ async function runRenameMigrations(root, dialect) {
|
|
|
1109
1145
|
const config = readProjectConfig(root);
|
|
1110
1146
|
let remoteRenamed = false;
|
|
1111
1147
|
if (config && !token) {
|
|
1112
|
-
log.error("Project is linked but you are not logged in.\nRun `void
|
|
1148
|
+
log.error("Project is linked but you are not logged in.\nRun `void account login` first so remote migration records can be updated.");
|
|
1113
1149
|
process.exit(1);
|
|
1114
1150
|
}
|
|
1115
1151
|
if (token && config) try {
|
|
@@ -1254,7 +1290,7 @@ async function runRenameMigrations(root, dialect) {
|
|
|
1254
1290
|
process.exit(1);
|
|
1255
1291
|
}
|
|
1256
1292
|
else {
|
|
1257
|
-
const { openSqliteDatabase } = await import("./runner-
|
|
1293
|
+
const { openSqliteDatabase } = await import("./runner-B8wXwWlo.mjs");
|
|
1258
1294
|
const { databasePath: dbPath } = getLocalD1Target(root);
|
|
1259
1295
|
if (existsSync(dbPath)) try {
|
|
1260
1296
|
const db = await openSqliteDatabase(dbPath);
|
|
@@ -1293,6 +1329,12 @@ function formatMySqlExportValue(value) {
|
|
|
1293
1329
|
if (value instanceof Uint8Array) return `X'${Array.from(value, (byte) => byte.toString(16).padStart(2, "0")).join("")}'`;
|
|
1294
1330
|
return `'${(value instanceof Date ? value.toISOString() : String(value)).replaceAll("\\", "\\\\").replaceAll("'", "''")}'`;
|
|
1295
1331
|
}
|
|
1332
|
+
function formatSqliteExportValue(value) {
|
|
1333
|
+
if (value === null) return "NULL";
|
|
1334
|
+
if (value instanceof Uint8Array) return `X'${Array.from(value, (byte) => byte.toString(16).padStart(2, "0")).join("")}'`;
|
|
1335
|
+
if (typeof value === "number" || typeof value === "bigint") return String(value);
|
|
1336
|
+
return `'${String(value).replaceAll("'", "''")}'`;
|
|
1337
|
+
}
|
|
1296
1338
|
async function runExport(root, args, dialect) {
|
|
1297
1339
|
const errOut = { output: process.stderr };
|
|
1298
1340
|
if (dialect === "postgresql") {
|
|
@@ -1306,23 +1348,39 @@ async function runExport(root, args, dialect) {
|
|
|
1306
1348
|
}
|
|
1307
1349
|
tables = [args.table];
|
|
1308
1350
|
} else tables = (await client.query("SELECT tablename FROM pg_tables WHERE schemaname = 'public' AND tablename NOT LIKE '\\_%' ORDER BY tablename")).rows.map((row) => String(row.tablename));
|
|
1351
|
+
if (!args.noSchema) await assertPgExportableSchema(client, tables, !args.table);
|
|
1309
1352
|
const sequences = await exportPgSequences(client, tables, args);
|
|
1310
1353
|
parts.push(...sequences.before);
|
|
1311
1354
|
for (const table of tables) {
|
|
1312
|
-
const cols = await client.query(`SELECT
|
|
1313
|
-
|
|
1355
|
+
const cols = await client.query(`SELECT a.attname AS column_name,
|
|
1356
|
+
pg_catalog.format_type(a.atttypid, a.atttypmod) AS data_type,
|
|
1357
|
+
a.attnotnull AS not_null,
|
|
1358
|
+
pg_get_expr(def.adbin, def.adrelid) AS column_default,
|
|
1359
|
+
a.attidentity AS identity,
|
|
1360
|
+
a.attgenerated AS generated
|
|
1361
|
+
FROM pg_attribute a
|
|
1362
|
+
JOIN pg_class tbl ON tbl.oid = a.attrelid
|
|
1363
|
+
JOIN pg_namespace ns ON ns.oid = tbl.relnamespace
|
|
1364
|
+
LEFT JOIN pg_attrdef def ON def.adrelid = tbl.oid AND def.adnum = a.attnum
|
|
1365
|
+
WHERE ns.nspname = 'public' AND tbl.relname = $1
|
|
1366
|
+
AND a.attnum > 0 AND NOT a.attisdropped
|
|
1367
|
+
ORDER BY a.attnum`, [table]);
|
|
1368
|
+
const names = cols.rows.filter((column) => !column.generated).map((column) => quoteSqlIdentifier(String(column.column_name)));
|
|
1314
1369
|
const tableName = `"public".${quoteSqlIdentifier(table)}`;
|
|
1315
1370
|
if (!args.noSchema) {
|
|
1316
1371
|
const colDefs = cols.rows.map((column) => {
|
|
1317
1372
|
let def = ` ${quoteSqlIdentifier(String(column.column_name))} ${String(column.data_type)}`;
|
|
1318
|
-
if (column.
|
|
1319
|
-
if (column.
|
|
1373
|
+
if (column.generated) def += ` GENERATED ALWAYS AS (${String(column.column_default)}) STORED`;
|
|
1374
|
+
else if (column.identity) def += ` GENERATED ${column.identity === "a" ? "ALWAYS" : "BY DEFAULT"} AS IDENTITY`;
|
|
1375
|
+
else if (column.column_default) def += ` DEFAULT ${String(column.column_default)}`;
|
|
1376
|
+
if (column.not_null) def += " NOT NULL";
|
|
1320
1377
|
return def;
|
|
1321
1378
|
});
|
|
1322
1379
|
parts.push(`CREATE TABLE ${tableName} (\n${colDefs.join(",\n")}\n);`);
|
|
1323
1380
|
}
|
|
1324
1381
|
if (!args.noData) {
|
|
1325
1382
|
const rows = await client.query(`SELECT ${names.map((name) => `${name}::text AS ${name}`).join(", ")} FROM ${tableName}`);
|
|
1383
|
+
const overriding = cols.rows.some((column) => column.identity === "a") ? " OVERRIDING SYSTEM VALUE" : "";
|
|
1326
1384
|
for (const row of rows.rows) {
|
|
1327
1385
|
const cols = Object.keys(row);
|
|
1328
1386
|
const vals = cols.map((column) => {
|
|
@@ -1331,7 +1389,7 @@ async function runExport(root, args, dialect) {
|
|
|
1331
1389
|
if (typeof value === "number") return String(value);
|
|
1332
1390
|
return `'${String(value).replace(/'/g, "''")}'`;
|
|
1333
1391
|
});
|
|
1334
|
-
parts.push(`INSERT INTO ${tableName} (${cols.map(quoteSqlIdentifier).join(", ")}) VALUES (${vals.join(", ")});`);
|
|
1392
|
+
parts.push(`INSERT INTO ${tableName} (${cols.map(quoteSqlIdentifier).join(", ")})${overriding} VALUES (${vals.join(", ")});`);
|
|
1335
1393
|
}
|
|
1336
1394
|
}
|
|
1337
1395
|
parts.push("");
|
|
@@ -1384,7 +1442,7 @@ async function runExport(root, args, dialect) {
|
|
|
1384
1442
|
} else process.stdout.write(output);
|
|
1385
1443
|
return;
|
|
1386
1444
|
}
|
|
1387
|
-
const { openSqliteDatabase } = await import("./runner-
|
|
1445
|
+
const { openSqliteDatabase } = await import("./runner-B8wXwWlo.mjs");
|
|
1388
1446
|
const { databasePath: dbPath } = getLocalD1Target(root);
|
|
1389
1447
|
if (!existsSync(dbPath)) {
|
|
1390
1448
|
log.error("No local database found. Run `void dev` first.", errOut);
|
|
@@ -1407,15 +1465,11 @@ async function runExport(root, args, dialect) {
|
|
|
1407
1465
|
parts.push(row.sql + ";");
|
|
1408
1466
|
}
|
|
1409
1467
|
if (!args.noData) {
|
|
1468
|
+
const insertableColumns = new Set(db.prepare(`PRAGMA table_xinfo(${quoteSqlIdentifier(table)})`).all().filter((column) => column.hidden === 0).map((column) => column.name));
|
|
1410
1469
|
const rows = db.prepare(`SELECT * FROM ${quoteSqlIdentifier(table)}`).all();
|
|
1411
1470
|
for (const row of rows) {
|
|
1412
|
-
const cols = Object.keys(row);
|
|
1413
|
-
const vals = cols.map((column) =>
|
|
1414
|
-
const value = row[column];
|
|
1415
|
-
if (value === null) return "NULL";
|
|
1416
|
-
if (typeof value === "number") return String(value);
|
|
1417
|
-
return `'${String(value).replace(/'/g, "''")}'`;
|
|
1418
|
-
});
|
|
1471
|
+
const cols = Object.keys(row).filter((column) => insertableColumns.has(column));
|
|
1472
|
+
const vals = cols.map((column) => formatSqliteExportValue(row[column]));
|
|
1419
1473
|
parts.push(`INSERT INTO ${quoteSqlIdentifier(table)} (${cols.map(quoteSqlIdentifier).join(", ")}) VALUES (${vals.join(", ")});`);
|
|
1420
1474
|
}
|
|
1421
1475
|
}
|
|
@@ -1429,6 +1483,20 @@ async function runExport(root, args, dialect) {
|
|
|
1429
1483
|
parts.push(`INSERT INTO sqlite_sequence (name, seq) VALUES (${name}, ${sequence.seq});`);
|
|
1430
1484
|
}
|
|
1431
1485
|
}
|
|
1486
|
+
if (!args.noSchema) {
|
|
1487
|
+
const schemaObjects = db.prepare("SELECT type, name, tbl_name, sql FROM sqlite_master WHERE type IN ('index','trigger','view') AND sql IS NOT NULL ORDER BY rowid").all();
|
|
1488
|
+
for (const type of [
|
|
1489
|
+
"index",
|
|
1490
|
+
"view",
|
|
1491
|
+
"trigger"
|
|
1492
|
+
]) for (const object of schemaObjects) {
|
|
1493
|
+
if (object.type !== type) continue;
|
|
1494
|
+
if (type === "view") {
|
|
1495
|
+
if (args.table || object.name.startsWith("_")) continue;
|
|
1496
|
+
} else if (!tables.includes(object.tbl_name)) continue;
|
|
1497
|
+
parts.push(object.sql.trim().replace(/;?$/, ";"));
|
|
1498
|
+
}
|
|
1499
|
+
}
|
|
1432
1500
|
const output = parts.join("\n");
|
|
1433
1501
|
if (args.output) {
|
|
1434
1502
|
writeFileSync(join(root, args.output), output);
|
|
@@ -1440,7 +1508,7 @@ async function runExport(root, args, dialect) {
|
|
|
1440
1508
|
}
|
|
1441
1509
|
}
|
|
1442
1510
|
async function runSetUrl(root) {
|
|
1443
|
-
const { readConfig: readVoidConfig, getDatabaseDialect: getDialect } = await import("./config
|
|
1511
|
+
const { readConfig: readVoidConfig, getDatabaseDialect: getDialect } = await import("./config-s7Xj7tPb.mjs");
|
|
1444
1512
|
const dialect = getDialect(readVoidConfig(root));
|
|
1445
1513
|
if (dialect === "sqlite") {
|
|
1446
1514
|
log.error("db: This command is only for PostgreSQL and MySQL projects. Set \"database\" to \"pg\" or \"mysql\" in void.config.ts.");
|
|
@@ -1448,7 +1516,7 @@ async function runSetUrl(root) {
|
|
|
1448
1516
|
}
|
|
1449
1517
|
const token = getToken(root);
|
|
1450
1518
|
if (!token) {
|
|
1451
|
-
log.error("No auth token found. Run `void
|
|
1519
|
+
log.error("No auth token found. Run `void account login` first.");
|
|
1452
1520
|
process.exit(1);
|
|
1453
1521
|
}
|
|
1454
1522
|
const projectConfig = readProjectConfig(root);
|
|
@@ -1543,7 +1611,7 @@ async function runSeedModule(root, seedPath, dialect) {
|
|
|
1543
1611
|
return;
|
|
1544
1612
|
}
|
|
1545
1613
|
const { drizzle } = await import("drizzle-orm/better-sqlite3");
|
|
1546
|
-
const { openSqliteDatabase } = await import("./runner-
|
|
1614
|
+
const { openSqliteDatabase } = await import("./runner-B8wXwWlo.mjs");
|
|
1547
1615
|
const { databasePath: dbPath } = getLocalD1Target(root);
|
|
1548
1616
|
const sqlite = await openSqliteDatabase(dbPath);
|
|
1549
1617
|
try {
|
|
@@ -1564,7 +1632,7 @@ async function loadSeedFunction(seedPath) {
|
|
|
1564
1632
|
return seed;
|
|
1565
1633
|
}
|
|
1566
1634
|
async function loadSeedSchema(root) {
|
|
1567
|
-
const { discoverSchema } = await import("./discover-
|
|
1635
|
+
const { discoverSchema } = await import("./discover-AMCBXivQ.mjs");
|
|
1568
1636
|
const location = discoverSchema(root, readProjectPaths(root));
|
|
1569
1637
|
if (!location) return {};
|
|
1570
1638
|
if (location.type === "file") {
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { i as createSpinner, r as cliTitle } from "./output-CCH48AMM.mjs";
|
|
2
|
-
import { c as getToken } from "./auth-
|
|
3
|
-
import { c as removeProjectConfig, o as readProjectConfig } from "./project-
|
|
2
|
+
import { c as getToken } from "./auth-DLNN0D3Z.mjs";
|
|
3
|
+
import { c as removeProjectConfig, o as readProjectConfig } from "./project-C0Fqu05O.mjs";
|
|
4
4
|
import { B as text, N as note, O as intro, P as outro, T as cancel, W as isCancel, j as log } from "./dist-Dn6nn2IU.mjs";
|
|
5
|
-
import { n as PlatformClient } from "./client-
|
|
6
|
-
import { r as resolveProjectBySlug } from "./resolve-project-
|
|
5
|
+
import { n as PlatformClient } from "./client-QTl6ko_D.mjs";
|
|
6
|
+
import { r as resolveProjectBySlug } from "./resolve-project-BG5ORGID.mjs";
|
|
7
7
|
//#region src/cli/delete.ts
|
|
8
8
|
async function runDeleteCommand(root, slug, options) {
|
|
9
9
|
console.log();
|
|
10
10
|
intro(cliTitle("delete"));
|
|
11
11
|
const token = getToken(root);
|
|
12
12
|
if (!token) {
|
|
13
|
-
log.error("Not logged in. Run `void
|
|
13
|
+
log.error("Not logged in. Run `void account login` first.");
|
|
14
14
|
process.exit(1);
|
|
15
15
|
}
|
|
16
16
|
const client = new PlatformClient(token, { root });
|