@prisma/orm-toolchain 0.16.0
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/LICENSE +201 -0
- package/README.md +28 -0
- package/dist/aggregate-B4mhR4Sk.mjs +1012 -0
- package/dist/aggregate-B4mhR4Sk.mjs.map +1 -0
- package/dist/aggregate-BflrjWPO.d.mts +803 -0
- package/dist/aggregate-BflrjWPO.d.mts.map +1 -0
- package/dist/bin__prisma-next.mjs +800 -0
- package/dist/bin__prisma-next.mjs.map +1 -0
- package/dist/cli-telemetry.d.mts +367 -0
- package/dist/cli-telemetry.d.mts.map +1 -0
- package/dist/cli-telemetry.mjs +48 -0
- package/dist/cli-telemetry.mjs.map +1 -0
- package/dist/cli-telemetry__sender.d.mts +1 -0
- package/dist/cli-telemetry__sender.mjs +1 -0
- package/dist/cli.d.mts +31 -0
- package/dist/cli.d.mts.map +1 -0
- package/dist/cli.mjs +180 -0
- package/dist/cli.mjs.map +1 -0
- package/dist/cli__commands__contract-emit.d.mts +2 -0
- package/dist/cli__commands__contract-emit.mjs +2 -0
- package/dist/cli__commands__contract-infer.d.mts +7 -0
- package/dist/cli__commands__contract-infer.d.mts.map +1 -0
- package/dist/cli__commands__contract-infer.mjs +2 -0
- package/dist/cli__commands__db-init.d.mts +7 -0
- package/dist/cli__commands__db-init.d.mts.map +1 -0
- package/dist/cli__commands__db-init.mjs +2 -0
- package/dist/cli__commands__db-schema.d.mts +7 -0
- package/dist/cli__commands__db-schema.d.mts.map +1 -0
- package/dist/cli__commands__db-schema.mjs +2 -0
- package/dist/cli__commands__db-sign.d.mts +7 -0
- package/dist/cli__commands__db-sign.d.mts.map +1 -0
- package/dist/cli__commands__db-sign.mjs +2 -0
- package/dist/cli__commands__db-update.d.mts +7 -0
- package/dist/cli__commands__db-update.d.mts.map +1 -0
- package/dist/cli__commands__db-update.mjs +2 -0
- package/dist/cli__commands__db-verify.d.mts +7 -0
- package/dist/cli__commands__db-verify.d.mts.map +1 -0
- package/dist/cli__commands__db-verify.mjs +2 -0
- package/dist/cli__commands__migrate.d.mts +66 -0
- package/dist/cli__commands__migrate.d.mts.map +1 -0
- package/dist/cli__commands__migrate.mjs +2 -0
- package/dist/cli__commands__migration-check.d.mts +64 -0
- package/dist/cli__commands__migration-check.d.mts.map +1 -0
- package/dist/cli__commands__migration-check.mjs +3 -0
- package/dist/cli__commands__migration-graph.d.mts +36 -0
- package/dist/cli__commands__migration-graph.d.mts.map +1 -0
- package/dist/cli__commands__migration-graph.mjs +2 -0
- package/dist/cli__commands__migration-list.d.mts +79 -0
- package/dist/cli__commands__migration-list.d.mts.map +1 -0
- package/dist/cli__commands__migration-list.mjs +2 -0
- package/dist/cli__commands__migration-log.d.mts +20 -0
- package/dist/cli__commands__migration-log.d.mts.map +1 -0
- package/dist/cli__commands__migration-log.mjs +2 -0
- package/dist/cli__commands__migration-new.d.mts +7 -0
- package/dist/cli__commands__migration-new.d.mts.map +1 -0
- package/dist/cli__commands__migration-new.mjs +2 -0
- package/dist/cli__commands__migration-plan.d.mts +79 -0
- package/dist/cli__commands__migration-plan.d.mts.map +1 -0
- package/dist/cli__commands__migration-plan.mjs +2 -0
- package/dist/cli__commands__migration-show.d.mts +27 -0
- package/dist/cli__commands__migration-show.d.mts.map +1 -0
- package/dist/cli__commands__migration-show.mjs +2 -0
- package/dist/cli__commands__migration-status.d.mts +55 -0
- package/dist/cli__commands__migration-status.d.mts.map +1 -0
- package/dist/cli__commands__migration-status.mjs +3 -0
- package/dist/cli__commands__ref.d.mts +34 -0
- package/dist/cli__commands__ref.d.mts.map +1 -0
- package/dist/cli__commands__ref.mjs +2 -0
- package/dist/cli__commands__telemetry.d.mts +7 -0
- package/dist/cli__commands__telemetry.d.mts.map +1 -0
- package/dist/cli__commands__telemetry.mjs +2 -0
- package/dist/cli__config-types.d.mts +2 -0
- package/dist/cli__config-types.mjs +2 -0
- package/dist/cli__control-api.d.mts +141 -0
- package/dist/cli__control-api.d.mts.map +1 -0
- package/dist/cli__control-api.mjs +4 -0
- package/dist/cli__init-output.d.mts +37 -0
- package/dist/cli__init-output.d.mts.map +1 -0
- package/dist/cli__init-output.mjs +2 -0
- package/dist/cli__migration-cli.d.mts +79 -0
- package/dist/cli__migration-cli.d.mts.map +1 -0
- package/dist/cli__migration-cli.mjs +407 -0
- package/dist/cli__migration-cli.mjs.map +1 -0
- package/dist/client-75qrAPqf-DZAVUxFa.mjs +1606 -0
- package/dist/client-75qrAPqf-DZAVUxFa.mjs.map +1 -0
- package/dist/command-helpers-CAoXqAY9-DWUBcTXM.mjs +1671 -0
- package/dist/command-helpers-CAoXqAY9-DWUBcTXM.mjs.map +1 -0
- package/dist/config-loader.d.mts +18 -0
- package/dist/config-loader.d.mts.map +1 -0
- package/dist/config-loader.mjs +2 -0
- package/dist/constants-CM-w38DQ-Cz_EXbOc.mjs +10 -0
- package/dist/constants-CM-w38DQ-Cz_EXbOc.mjs.map +1 -0
- package/dist/constants-Dkcn8Qu4.d.mts +10 -0
- package/dist/constants-Dkcn8Qu4.d.mts.map +1 -0
- package/dist/contract-at-errors-BX7w-p19-SxA8eaV2.mjs +36 -0
- package/dist/contract-at-errors-BX7w-p19-SxA8eaV2.mjs.map +1 -0
- package/dist/contract-emit-0hSjbuxp-BBOKldTZ.mjs +148 -0
- package/dist/contract-emit-0hSjbuxp-BBOKldTZ.mjs.map +1 -0
- package/dist/contract-emit-B65_UiFn.d.mts +7 -0
- package/dist/contract-emit-B65_UiFn.d.mts.map +1 -0
- package/dist/contract-emit-B6odMoem-CK3diBPk.mjs +359 -0
- package/dist/contract-emit-B6odMoem-CK3diBPk.mjs.map +1 -0
- package/dist/contract-enrichment-DrMvvY2A-DxNGeF4d.mjs +56 -0
- package/dist/contract-enrichment-DrMvvY2A-DxNGeF4d.mjs.map +1 -0
- package/dist/contract-infer-BnkqpftN-DVM2eKJ3.mjs +73 -0
- package/dist/contract-infer-BnkqpftN-DVM2eKJ3.mjs.map +1 -0
- package/dist/contract-snapshot-store-CbqynbtE.d.mts +28 -0
- package/dist/contract-snapshot-store-CbqynbtE.d.mts.map +1 -0
- package/dist/contract-snapshot-store-sf5nP4mb-MLpG-ihh.mjs +118 -0
- package/dist/contract-snapshot-store-sf5nP4mb-MLpG-ihh.mjs.map +1 -0
- package/dist/contract-space-aggregate-loader-CFH-336b-BhAyRQEL.mjs +302 -0
- package/dist/contract-space-aggregate-loader-CFH-336b-BhAyRQEL.mjs.map +1 -0
- package/dist/db-init-Vbkb_TKZ.mjs +153 -0
- package/dist/db-init-Vbkb_TKZ.mjs.map +1 -0
- package/dist/db-schema-ClQCu3xY.mjs +47 -0
- package/dist/db-schema-ClQCu3xY.mjs.map +1 -0
- package/dist/db-sign-jjXDgQ1u.mjs +175 -0
- package/dist/db-sign-jjXDgQ1u.mjs.map +1 -0
- package/dist/db-update-BQlrqtDD.mjs +183 -0
- package/dist/db-update-BQlrqtDD.mjs.map +1 -0
- package/dist/db-verify-CKPsRFrj-3udprZQD.mjs +396 -0
- package/dist/db-verify-CKPsRFrj-3udprZQD.mjs.map +1 -0
- package/dist/domain-type-generation-DAn9y5d2-BgoT5uKI.mjs +334 -0
- package/dist/domain-type-generation-DAn9y5d2-BgoT5uKI.mjs.map +1 -0
- package/dist/domain-type-generation-PkAb39ob-Ct8AGqow.d.mts +63 -0
- package/dist/domain-type-generation-PkAb39ob-Ct8AGqow.d.mts.map +1 -0
- package/dist/emitter.d.mts +75 -0
- package/dist/emitter.d.mts.map +1 -0
- package/dist/emitter.mjs +3 -0
- package/dist/emitter__domain-type-generation.d.mts +2 -0
- package/dist/emitter__domain-type-generation.mjs +2 -0
- package/dist/emitter__type-expression-safety.d.mts +6 -0
- package/dist/emitter__type-expression-safety.d.mts.map +1 -0
- package/dist/emitter__type-expression-safety.mjs +2 -0
- package/dist/errors--qsXZUtL.d.mts +72 -0
- package/dist/errors--qsXZUtL.d.mts.map +1 -0
- package/dist/errors-IpZm1Skp-BH495dRd.mjs +378 -0
- package/dist/errors-IpZm1Skp-BH495dRd.mjs.map +1 -0
- package/dist/exports-BN0vFTxG.mjs +276 -0
- package/dist/exports-BN0vFTxG.mjs.map +1 -0
- package/dist/exports-B_xhKZmC.mjs +1436 -0
- package/dist/exports-B_xhKZmC.mjs.map +1 -0
- package/dist/exports-D3-NwrMA-CadaBGQ3.mjs +154 -0
- package/dist/exports-D3-NwrMA-CadaBGQ3.mjs.map +1 -0
- package/dist/exports-Dl2aGAk7.mjs +119 -0
- package/dist/exports-Dl2aGAk7.mjs.map +1 -0
- package/dist/format-ByDm2goZ-DKLyhNHo.mjs +101 -0
- package/dist/format-ByDm2goZ-DKLyhNHo.mjs.map +1 -0
- package/dist/framework-components-CjshQKHA-Dlp6Leo5.mjs +58 -0
- package/dist/framework-components-CjshQKHA-Dlp6Leo5.mjs.map +1 -0
- package/dist/global-flags-BpoOYtNZ-CHZD3fud.d.mts +35 -0
- package/dist/global-flags-BpoOYtNZ-CHZD3fud.d.mts.map +1 -0
- package/dist/graph-bDjJ4GL9-BhFevsJS.d.mts +28 -0
- package/dist/graph-bDjJ4GL9-BhFevsJS.d.mts.map +1 -0
- package/dist/graph-membership-DW6nnbyQ-Bp2KcVwR.mjs +14 -0
- package/dist/graph-membership-DW6nnbyQ-Bp2KcVwR.mjs.map +1 -0
- package/dist/hash-DH8hl5Rq-BpM2t3Nu.mjs +64 -0
- package/dist/hash-DH8hl5Rq-BpM2t3Nu.mjs.map +1 -0
- package/dist/hash-XZYYKJ-i.d.mts +53 -0
- package/dist/hash-XZYYKJ-i.d.mts.map +1 -0
- package/dist/import-roots-B6CtsWXb.d.mts +119 -0
- package/dist/import-roots-B6CtsWXb.d.mts.map +1 -0
- package/dist/import-roots-NDOIEDVj.mjs +217 -0
- package/dist/import-roots-NDOIEDVj.mjs.map +1 -0
- package/dist/init-DHctXAI9-DSlaaYXN.mjs +2186 -0
- package/dist/init-DHctXAI9-DSlaaYXN.mjs.map +1 -0
- package/dist/inspect-live-schema-CnwYTRZ0-BErPHMni.mjs +91 -0
- package/dist/inspect-live-schema-CnwYTRZ0-BErPHMni.mjs.map +1 -0
- package/dist/invariants-B5wLrgQS.d.mts +39 -0
- package/dist/invariants-B5wLrgQS.d.mts.map +1 -0
- package/dist/invariants-lXzy6txi-DAoP4nTE.mjs +57 -0
- package/dist/invariants-lXzy6txi-DAoP4nTE.mjs.map +1 -0
- package/dist/io-C8TdyBKt-DloEBi70.mjs +313 -0
- package/dist/io-C8TdyBKt-DloEBi70.mjs.map +1 -0
- package/dist/io-DYfeLJxR.d.mts +1 -0
- package/dist/io-sr4CO9_t-C3eV_kn-.d.mts +125 -0
- package/dist/io-sr4CO9_t-C3eV_kn-.d.mts.map +1 -0
- package/dist/ledger-origin-BGRN77Oy.d.mts +6 -0
- package/dist/ledger-origin-BGRN77Oy.d.mts.map +1 -0
- package/dist/ledger-origin-D7PN4Fon.mjs +9 -0
- package/dist/ledger-origin-D7PN4Fon.mjs.map +1 -0
- package/dist/metadata-2nbOAGsV-uYNeq2Cp.d.mts +2 -0
- package/dist/metadata-BtscDay2.d.mts +1 -0
- package/dist/migrate-Cb_iv264.mjs +500 -0
- package/dist/migrate-Cb_iv264.mjs.map +1 -0
- package/dist/migration-B2ljMJim.d.mts +155 -0
- package/dist/migration-B2ljMJim.d.mts.map +1 -0
- package/dist/migration-BuUmO7It.mjs +209 -0
- package/dist/migration-BuUmO7It.mjs.map +1 -0
- package/dist/migration-check-DcwUnadt-B6Qoh0ot.mjs +597 -0
- package/dist/migration-check-DcwUnadt-B6Qoh0ot.mjs.map +1 -0
- package/dist/migration-command-scaffold-BCuoeAki-B1pVGX8d.mjs +103 -0
- package/dist/migration-command-scaffold-BCuoeAki-B1pVGX8d.mjs.map +1 -0
- package/dist/migration-graph-CBf9ORe7-B4xAF8GN.mjs +500 -0
- package/dist/migration-graph-CBf9ORe7-B4xAF8GN.mjs.map +1 -0
- package/dist/migration-graph-DkoCC0Qy.mjs +185 -0
- package/dist/migration-graph-DkoCC0Qy.mjs.map +1 -0
- package/dist/migration-graph-Dqndu0i5.d.mts +9 -0
- package/dist/migration-graph-Dqndu0i5.d.mts.map +1 -0
- package/dist/migration-graph-command-render-BKrg6BPv-BP8Pfj4J.mjs +1945 -0
- package/dist/migration-graph-command-render-BKrg6BPv-BP8Pfj4J.mjs.map +1 -0
- package/dist/migration-graph-tarTxJ99-BrGBANeE.d.mts +124 -0
- package/dist/migration-graph-tarTxJ99-BrGBANeE.d.mts.map +1 -0
- package/dist/migration-list-BFBeo1_X-c0kqYokL.mjs +228 -0
- package/dist/migration-list-BFBeo1_X-c0kqYokL.mjs.map +1 -0
- package/dist/migration-log-CS5IWcNq-BQ-32Low.mjs +220 -0
- package/dist/migration-log-CS5IWcNq-BQ-32Low.mjs.map +1 -0
- package/dist/migration-new-BurCjyaQ.mjs +168 -0
- package/dist/migration-new-BurCjyaQ.mjs.map +1 -0
- package/dist/migration-path-target-D3Sj55PI-BICblCuk.mjs +38 -0
- package/dist/migration-path-target-D3Sj55PI-BICblCuk.mjs.map +1 -0
- package/dist/migration-plan-q_L84PN1-BWE0LTH6.mjs +759 -0
- package/dist/migration-plan-q_L84PN1-BWE0LTH6.mjs.map +1 -0
- package/dist/migration-show-Bx5I5aW9.mjs +171 -0
- package/dist/migration-show-Bx5I5aW9.mjs.map +1 -0
- package/dist/migration-status-CE7cQLDq-B1jDVmqG.mjs +444 -0
- package/dist/migration-status-CE7cQLDq-B1jDVmqG.mjs.map +1 -0
- package/dist/migration-tools.d.mts +23 -0
- package/dist/migration-tools.mjs +17 -0
- package/dist/migration-tools__aggregate.d.mts +2 -0
- package/dist/migration-tools__aggregate.mjs +2 -0
- package/dist/migration-tools__constants.d.mts +2 -0
- package/dist/migration-tools__constants.mjs +2 -0
- package/dist/migration-tools__contract-snapshot-store.d.mts +2 -0
- package/dist/migration-tools__contract-snapshot-store.mjs +2 -0
- package/dist/migration-tools__errors.d.mts +2 -0
- package/dist/migration-tools__errors.mjs +2 -0
- package/dist/migration-tools__graph.d.mts +2 -0
- package/dist/migration-tools__graph.mjs +1 -0
- package/dist/migration-tools__hash.d.mts +2 -0
- package/dist/migration-tools__hash.mjs +2 -0
- package/dist/migration-tools__invariants.d.mts +2 -0
- package/dist/migration-tools__invariants.mjs +2 -0
- package/dist/migration-tools__io.d.mts +3 -0
- package/dist/migration-tools__io.mjs +2 -0
- package/dist/migration-tools__ledger-origin.d.mts +2 -0
- package/dist/migration-tools__ledger-origin.mjs +2 -0
- package/dist/migration-tools__metadata.d.mts +3 -0
- package/dist/migration-tools__metadata.mjs +1 -0
- package/dist/migration-tools__migration-graph.d.mts +3 -0
- package/dist/migration-tools__migration-graph.mjs +3 -0
- package/dist/migration-tools__migration-ts.d.mts +2 -0
- package/dist/migration-tools__migration-ts.mjs +2 -0
- package/dist/migration-tools__migration.d.mts +2 -0
- package/dist/migration-tools__migration.mjs +2 -0
- package/dist/migration-tools__package.d.mts +3 -0
- package/dist/migration-tools__package.mjs +1 -0
- package/dist/migration-tools__ref-resolution.d.mts +2 -0
- package/dist/migration-tools__ref-resolution.mjs +2 -0
- package/dist/migration-tools__refs.d.mts +2 -0
- package/dist/migration-tools__refs.mjs +2 -0
- package/dist/migration-tools__spaces.d.mts +3 -0
- package/dist/migration-tools__spaces.mjs +3 -0
- package/dist/migration-ts-CNaAtK8C.d.mts +38 -0
- package/dist/migration-ts-CNaAtK8C.d.mts.map +1 -0
- package/dist/migration-ts-FyF55c4M.mjs +67 -0
- package/dist/migration-ts-FyF55c4M.mjs.map +1 -0
- package/dist/op-schema-BSVHzEQN-DIWt28D8.mjs +13 -0
- package/dist/op-schema-BSVHzEQN-DIWt28D8.mjs.map +1 -0
- package/dist/output-DWNYqZGc-D2sRgLAm.mjs +109 -0
- package/dist/output-DWNYqZGc-D2sRgLAm.mjs.map +1 -0
- package/dist/package-CfWiDNrr-ZR4HM_Iz.d.mts +21 -0
- package/dist/package-CfWiDNrr-ZR4HM_Iz.d.mts.map +1 -0
- package/dist/package-N9PPdFV_.d.mts +3 -0
- package/dist/progress-adapter-CjAeTxY_-BXYSd1eY.mjs +43 -0
- package/dist/progress-adapter-CjAeTxY_-BXYSd1eY.mjs.map +1 -0
- package/dist/project-import-root-CpwLCDLY-DkVwAnWj.mjs +99 -0
- package/dist/project-import-root-CpwLCDLY-DkVwAnWj.mjs.map +1 -0
- package/dist/publish-surface.d.mts +3 -0
- package/dist/publish-surface.mjs +3 -0
- package/dist/publish-surface__import-roots.d.mts +2 -0
- package/dist/publish-surface__import-roots.mjs +2 -0
- package/dist/publish-surface__shells.d.mts +2 -0
- package/dist/publish-surface__shells.mjs +2 -0
- package/dist/quick-reference-mongo.md +114 -0
- package/dist/quick-reference-postgres.md +93 -0
- package/dist/readme-mongo.md +35 -0
- package/dist/readme-postgres.md +34 -0
- package/dist/ref-B6cTthTi.mjs +171 -0
- package/dist/ref-B6cTthTi.mjs.map +1 -0
- package/dist/ref-advancement-CSPMoQs3-fEipZrdu.mjs +57 -0
- package/dist/ref-advancement-CSPMoQs3-fEipZrdu.mjs.map +1 -0
- package/dist/ref-resolution-BjJBWPjX.mjs +250 -0
- package/dist/ref-resolution-BjJBWPjX.mjs.map +1 -0
- package/dist/ref-resolution-COGOSL57.d.mts +127 -0
- package/dist/ref-resolution-COGOSL57.d.mts.map +1 -0
- package/dist/refs-BDbB9BRB-D6Za3Q49.mjs +241 -0
- package/dist/refs-BDbB9BRB-D6Za3Q49.mjs.map +1 -0
- package/dist/refs-BNCUu58Y-BIso5Jfg.d.mts +43 -0
- package/dist/refs-BNCUu58Y-BIso5Jfg.d.mts.map +1 -0
- package/dist/schemas-CfGSxH5b-BSjB3nZS.d.mts +192 -0
- package/dist/schemas-CfGSxH5b-BSjB3nZS.d.mts.map +1 -0
- package/dist/schemas-KhXMzNA_-CzZ7GFX_.mjs +112 -0
- package/dist/schemas-KhXMzNA_-CzZ7GFX_.mjs.map +1 -0
- package/dist/shells-BenrJHp2.mjs +602 -0
- package/dist/shells-BenrJHp2.mjs.map +1 -0
- package/dist/shells-COHV_Ozf.d.mts +135 -0
- package/dist/shells-COHV_Ozf.d.mts.map +1 -0
- package/dist/spaces-C27bA-xc.mjs +267 -0
- package/dist/spaces-C27bA-xc.mjs.map +1 -0
- package/dist/spaces-DxFj5y8l.d.mts +415 -0
- package/dist/spaces-DxFj5y8l.d.mts.map +1 -0
- package/dist/telemetry-CmbCa3Ld-CmE5zcIG.mjs +120 -0
- package/dist/telemetry-CmbCa3Ld-CmE5zcIG.mjs.map +1 -0
- package/dist/terminal-ui-BN4QOsm5-Bf3pim46.d.mts +133 -0
- package/dist/terminal-ui-BN4QOsm5-Bf3pim46.d.mts.map +1 -0
- package/dist/type-expression-safety-CgHTWypx.mjs +8 -0
- package/dist/type-expression-safety-CgHTWypx.mjs.map +1 -0
- package/dist/types-DZWEs4si-D8UlyJI0.d.mts +893 -0
- package/dist/types-DZWEs4si-D8UlyJI0.d.mts.map +1 -0
- package/dist/verify-DnVNjc5C-BGdsblBK.mjs +283 -0
- package/dist/verify-DnVNjc5C-BGdsblBK.mjs.map +1 -0
- package/dist/verify-contract-spaces-BZDcJsuA-De8v4Z4T.mjs +252 -0
- package/dist/verify-contract-spaces-BZDcJsuA-De8v4Z4T.mjs.map +1 -0
- package/dist/verify-contract-spaces-Cc1u_wJo-BilPJS2S.d.mts +136 -0
- package/dist/verify-contract-spaces-Cc1u_wJo-BilPJS2S.d.mts.map +1 -0
- package/dist/vite-plugin-contract-emit.d.mts +54 -0
- package/dist/vite-plugin-contract-emit.d.mts.map +1 -0
- package/dist/vite-plugin-contract-emit.mjs +303 -0
- package/dist/vite-plugin-contract-emit.mjs.map +1 -0
- package/package.json +122 -0
|
@@ -0,0 +1,500 @@
|
|
|
1
|
+
import { P as errorUnknownInvariant, t as MigrationToolsError } from "./errors-IpZm1Skp-BH495dRd.mjs";
|
|
2
|
+
import "./constants-CM-w38DQ-Cz_EXbOc.mjs";
|
|
3
|
+
import { r as findLatestMigration } from "./migration-graph-CBf9ORe7-B4xAF8GN.mjs";
|
|
4
|
+
import { $ as maskConnectionUrl, N as errorUnexpected, O as errorRuntime$1, Q as mapRefResolutionError, R as formatMigrationApplyCommandOutput, S as errorPathUnreachable, W as formatStyledHeader, Z as mapMigrationToolsError, at as resolveMigrationPaths, ct as setCommandExamples, d as errorContractValidationFailed, f as errorDatabaseConnectionRequired, h as errorFileNotFound, i as collectDeclaredInvariants, it as resolveContractPath, j as errorTargetMigrationNotSupported, m as errorDriverRequired, o as createTerminalUI, q as handleResult, r as addGlobalOptions, rt as requireLiveDatabase, st as setCommandDescriptions, t as CliStructuredError$1, tt as parseGlobalFlagsOrExit, ut as targetSupportsMigrations, y as errorMarkerMismatch } from "./command-helpers-CAoXqAY9-DWUBcTXM.mjs";
|
|
5
|
+
import { r as loadConfig } from "./exports-Dl2aGAk7.mjs";
|
|
6
|
+
import { n as isGraphNode } from "./graph-membership-DW6nnbyQ-Bp2KcVwR.mjs";
|
|
7
|
+
import { i as readRefs } from "./refs-BDbB9BRB-D6Za3Q49.mjs";
|
|
8
|
+
import { u as requireHeadRef } from "./aggregate-B4mhR4Sk.mjs";
|
|
9
|
+
import { a as refuseContractSpaceIntegrity, i as loadContractSpaceAggregateForCli, n as buildReadAggregate, s as toDeclaredExtensionsFromRaw } from "./contract-space-aggregate-loader-CFH-336b-BhAyRQEL.mjs";
|
|
10
|
+
import { a as planSpacePath, t as createControlClient } from "./client-75qrAPqf-DZAVUxFa.mjs";
|
|
11
|
+
import { i as readContractIR, r as executeRefAdvancement } from "./ref-advancement-CSPMoQs3-fEipZrdu.mjs";
|
|
12
|
+
import { n as parseContractRef } from "./ref-resolution-BjJBWPjX.mjs";
|
|
13
|
+
import { t as mapContractAtError } from "./contract-at-errors-BX7w-p19-SxA8eaV2.mjs";
|
|
14
|
+
import { c as computeMaxDirNameWidth, d as highlightFromEdgeAnnotations, f as indentMigrationGraphTreeBlock, h as renderMigrationGraphCommand, i as buildMigrationGraphRows, r as buildGrid, s as computeLabelColumn, u as formatOnPathMigrationRow } from "./migration-graph-command-render-BKrg6BPv-BP8Pfj4J.mjs";
|
|
15
|
+
import { r as listRefsByContractHash } from "./migration-list-BFBeo1_X-c0kqYokL.mjs";
|
|
16
|
+
import { ifDefined } from "@prisma/orm-framework/utils/defined";
|
|
17
|
+
import { notOk, ok } from "@prisma/orm-framework/utils/result";
|
|
18
|
+
import { readFile } from "node:fs/promises";
|
|
19
|
+
import { createControlStack } from "@prisma/orm-framework/components/control";
|
|
20
|
+
import { Command } from "commander";
|
|
21
|
+
//#region ../../../1-framework/3-tooling/cli/dist/commands/migrate.mjs
|
|
22
|
+
/**
|
|
23
|
+
* Read-only preview of the migration path `migrate` will take.
|
|
24
|
+
*
|
|
25
|
+
* Computes the path through the SAME seam as `executeMigrate`:
|
|
26
|
+
* - `readAllMarkers()` for the from-state (when no `--from` is given), preserving
|
|
27
|
+
* the full marker including `invariants` (not just `storageHash`).
|
|
28
|
+
* - `planSpacePath()` (shared with `executeMigrate`) for per-space path selection,
|
|
29
|
+
* which feeds `resolveRecordedPath()` with the same target hash, target invariants,
|
|
30
|
+
* and current marker as the real apply path uses.
|
|
31
|
+
*
|
|
32
|
+
* Returns BEFORE any write boundary (`runMigration` / marker / DDL). No
|
|
33
|
+
* DB state is mutated.
|
|
34
|
+
*/
|
|
35
|
+
async function executeMigrateShowCommand(options, flags, ui) {
|
|
36
|
+
const config = await loadConfig(options.config);
|
|
37
|
+
const { configPath, migrationsDir, migrationsRelative, refsDir } = resolveMigrationPaths(options.config, config);
|
|
38
|
+
const dbConnection = options.db ?? config.db?.connection;
|
|
39
|
+
const hasDriver = !!config.driver;
|
|
40
|
+
const hasExplicitFrom = options.from !== void 0;
|
|
41
|
+
if (!hasExplicitFrom) {
|
|
42
|
+
const missingDb = requireLiveDatabase({
|
|
43
|
+
dbConnection,
|
|
44
|
+
hasDriver,
|
|
45
|
+
why: "migrate --show needs a database connection to read the live marker (or pass --from <contract> for an offline preview)",
|
|
46
|
+
retryCommand: "prisma-next migrate --show --from <contract>"
|
|
47
|
+
});
|
|
48
|
+
if (missingDb) return notOk(missingDb);
|
|
49
|
+
}
|
|
50
|
+
let allRefs = {};
|
|
51
|
+
try {
|
|
52
|
+
allRefs = await readRefs(refsDir);
|
|
53
|
+
} catch (error) {
|
|
54
|
+
if (MigrationToolsError.is(error)) return notOk(mapMigrationToolsError(error));
|
|
55
|
+
throw error;
|
|
56
|
+
}
|
|
57
|
+
const loaded = await buildReadAggregate(config, { migrationsDir });
|
|
58
|
+
if (!loaded.ok) return notOk(loaded.failure);
|
|
59
|
+
const { aggregate, contractHash } = loaded.value;
|
|
60
|
+
const appGraph = aggregate.app.graph();
|
|
61
|
+
let targetHash = contractHash;
|
|
62
|
+
let refInvariants;
|
|
63
|
+
if (options.to) {
|
|
64
|
+
const toResult = parseContractRef(options.to, {
|
|
65
|
+
graph: appGraph,
|
|
66
|
+
refs: allRefs,
|
|
67
|
+
contractHash
|
|
68
|
+
});
|
|
69
|
+
if (!toResult.ok) return notOk(mapRefResolutionError(toResult.failure));
|
|
70
|
+
if (toResult.value.provenance.kind === "reserved-db") return notOk(errorDatabaseConnectionRequired({
|
|
71
|
+
why: "@db is not valid as a --to target; it names the live database state, not a target contract.",
|
|
72
|
+
commandName: "migrate --show"
|
|
73
|
+
}));
|
|
74
|
+
targetHash = toResult.value.hash;
|
|
75
|
+
if (toResult.value.provenance.kind === "ref") {
|
|
76
|
+
const refEntry = allRefs[toResult.value.provenance.refName];
|
|
77
|
+
if (refEntry) refInvariants = refEntry.invariants;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
if (!flags.json && !flags.quiet) {
|
|
81
|
+
const details = [{
|
|
82
|
+
label: "config",
|
|
83
|
+
value: configPath
|
|
84
|
+
}, {
|
|
85
|
+
label: "migrations",
|
|
86
|
+
value: migrationsRelative
|
|
87
|
+
}];
|
|
88
|
+
if (dbConnection && !hasExplicitFrom) details.push({
|
|
89
|
+
label: "database",
|
|
90
|
+
value: maskConnectionUrl(String(dbConnection))
|
|
91
|
+
});
|
|
92
|
+
if (options.from) details.push({
|
|
93
|
+
label: "from",
|
|
94
|
+
value: options.from
|
|
95
|
+
});
|
|
96
|
+
if (options.to) details.push({
|
|
97
|
+
label: "to",
|
|
98
|
+
value: options.to
|
|
99
|
+
});
|
|
100
|
+
const header = formatStyledHeader({
|
|
101
|
+
command: "migrate --show",
|
|
102
|
+
description: "Preview the migration path migrate will take (read-only)",
|
|
103
|
+
details,
|
|
104
|
+
flags
|
|
105
|
+
});
|
|
106
|
+
ui.stderr(header);
|
|
107
|
+
}
|
|
108
|
+
const markerBySpace = /* @__PURE__ */ new Map();
|
|
109
|
+
const allSpaces = [aggregate.app, ...aggregate.extensions];
|
|
110
|
+
if (hasExplicitFrom) if (options.from === "@db") {
|
|
111
|
+
const missingDb = requireLiveDatabase({
|
|
112
|
+
dbConnection,
|
|
113
|
+
hasDriver,
|
|
114
|
+
why: "@db resolves to the live database marker and requires a --db connection",
|
|
115
|
+
retryCommand: "prisma-next migrate --show --from @db --db $DATABASE_URL"
|
|
116
|
+
});
|
|
117
|
+
if (missingDb) return notOk(missingDb);
|
|
118
|
+
} else {
|
|
119
|
+
const fromResult = parseContractRef(options.from, {
|
|
120
|
+
graph: appGraph,
|
|
121
|
+
refs: allRefs,
|
|
122
|
+
contractHash
|
|
123
|
+
});
|
|
124
|
+
if (!fromResult.ok) return notOk(mapRefResolutionError(fromResult.failure));
|
|
125
|
+
if (fromResult.value.provenance.kind === "reserved-db") {
|
|
126
|
+
const missingDb = requireLiveDatabase({
|
|
127
|
+
dbConnection,
|
|
128
|
+
hasDriver,
|
|
129
|
+
why: "@db resolves to the live database marker and requires a --db connection"
|
|
130
|
+
});
|
|
131
|
+
if (missingDb) return notOk(missingDb);
|
|
132
|
+
} else {
|
|
133
|
+
const fromHash = fromResult.value.hash;
|
|
134
|
+
const offlineMarker = fromHash === "empty" ? null : {
|
|
135
|
+
storageHash: fromHash,
|
|
136
|
+
invariants: []
|
|
137
|
+
};
|
|
138
|
+
markerBySpace.set(aggregate.app.spaceId, offlineMarker);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
const needsLiveMarker = !hasExplicitFrom || options.from === "@db";
|
|
142
|
+
if (needsLiveMarker) {
|
|
143
|
+
if (!dbConnection || !hasDriver) return notOk(errorDatabaseConnectionRequired({
|
|
144
|
+
why: "A database connection is required to read the live marker for migrate --show",
|
|
145
|
+
commandName: "migrate --show"
|
|
146
|
+
}));
|
|
147
|
+
const client = createControlClient({
|
|
148
|
+
family: config.family,
|
|
149
|
+
target: config.target,
|
|
150
|
+
adapter: config.adapter,
|
|
151
|
+
driver: config.driver,
|
|
152
|
+
extensions: config.extensions ?? []
|
|
153
|
+
});
|
|
154
|
+
try {
|
|
155
|
+
await client.connect(dbConnection);
|
|
156
|
+
const allMarkers = await client.readAllMarkers();
|
|
157
|
+
for (const space of allSpaces) {
|
|
158
|
+
const marker = allMarkers.get(space.spaceId);
|
|
159
|
+
markerBySpace.set(space.spaceId, marker ?? null);
|
|
160
|
+
}
|
|
161
|
+
} catch (error) {
|
|
162
|
+
if (CliStructuredError$1.is(error)) return notOk(error);
|
|
163
|
+
if (MigrationToolsError.is(error)) return notOk(mapMigrationToolsError(error));
|
|
164
|
+
return notOk(errorUnexpected(error instanceof Error ? error.message : String(error), { why: `Failed to read live DB marker: ${error instanceof Error ? error.message : String(error)}` }));
|
|
165
|
+
} finally {
|
|
166
|
+
await client.close();
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
const canonicalOrderSpaces = [...aggregate.extensions, aggregate.app];
|
|
170
|
+
const orderedMigrations = [];
|
|
171
|
+
for (const space of canonicalOrderSpaces) {
|
|
172
|
+
const isAppSpace = space.spaceId === aggregate.app.spaceId;
|
|
173
|
+
const headRef = requireHeadRef(space);
|
|
174
|
+
const outcome = planSpacePath({
|
|
175
|
+
space,
|
|
176
|
+
aggregate,
|
|
177
|
+
targetHash: isAppSpace ? targetHash : headRef.hash,
|
|
178
|
+
refInvariants: isAppSpace ? refInvariants : void 0,
|
|
179
|
+
liveMarker: markerBySpace.get(space.spaceId) ?? null
|
|
180
|
+
});
|
|
181
|
+
if (outcome.kind === "at-head") continue;
|
|
182
|
+
if (outcome.kind === "never-planned") return notOk(errorPathUnreachable({
|
|
183
|
+
code: "MIGRATION_PATH_NOT_FOUND",
|
|
184
|
+
summary: `No on-disk migrations for contract space "${outcome.spaceId}"`,
|
|
185
|
+
why: `migrate is replay-only: space "${outcome.spaceId}" has no on-disk migrations but its head ref targets "${outcome.targetHash}".`,
|
|
186
|
+
meta: {
|
|
187
|
+
spaceId: outcome.spaceId,
|
|
188
|
+
target: outcome.targetHash,
|
|
189
|
+
kind: "neverPlanned"
|
|
190
|
+
}
|
|
191
|
+
}));
|
|
192
|
+
if (outcome.kind === "unreachable") {
|
|
193
|
+
const fromHash = outcome.liveMarker?.storageHash ?? "empty";
|
|
194
|
+
return notOk(errorPathUnreachable({
|
|
195
|
+
code: "MIGRATION_PATH_NOT_FOUND",
|
|
196
|
+
summary: `No migration path from ${fromHash.slice(0, 14)} to ${outcome.targetHash.slice(0, 14)} in space "${outcome.spaceId}".`,
|
|
197
|
+
why: `The migration graph has no path from the from-state to the target in space "${outcome.spaceId}".`,
|
|
198
|
+
meta: {
|
|
199
|
+
spaceId: outcome.spaceId,
|
|
200
|
+
from: fromHash,
|
|
201
|
+
to: outcome.targetHash
|
|
202
|
+
}
|
|
203
|
+
}));
|
|
204
|
+
}
|
|
205
|
+
if (outcome.kind === "unsatisfiable") return notOk(errorRuntime$1(`Missing required invariants for space "${outcome.spaceId}"`, { why: `The path requires invariants not available on disk: ${outcome.missing.join(", ")}` }));
|
|
206
|
+
for (const edge of outcome.plan.migrationEdges) orderedMigrations.push({
|
|
207
|
+
spaceId: space.spaceId,
|
|
208
|
+
dirName: edge.dirName,
|
|
209
|
+
migrationHash: edge.migrationHash,
|
|
210
|
+
from: edge.from,
|
|
211
|
+
to: edge.to
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
const count = orderedMigrations.length;
|
|
215
|
+
const summary = count === 0 ? "Already up to date — nothing to run" : `${count} migration${count === 1 ? "" : "s"} will run`;
|
|
216
|
+
let graphOutput;
|
|
217
|
+
let runListDirNameWidth;
|
|
218
|
+
let runListLeftPad;
|
|
219
|
+
if (!flags.json) {
|
|
220
|
+
const onPathHashes = new Set(orderedMigrations.map((m) => m.migrationHash));
|
|
221
|
+
const colorize = flags.color !== false;
|
|
222
|
+
const spaceLayouts = allSpaces.map((space) => {
|
|
223
|
+
const isApp = space.spaceId === aggregate.app.spaceId;
|
|
224
|
+
const spaceGraph = space.graph();
|
|
225
|
+
const rowModel = buildMigrationGraphRows(spaceGraph, isApp ? { contractHash } : {});
|
|
226
|
+
const edgeAnnotations = /* @__PURE__ */ new Map();
|
|
227
|
+
for (const edge of spaceGraph.migrationByHash.values()) edgeAnnotations.set(edge.migrationHash, { pathHighlight: onPathHashes.has(edge.migrationHash) ? "on-path" : "off-path" });
|
|
228
|
+
return {
|
|
229
|
+
space,
|
|
230
|
+
isApp,
|
|
231
|
+
spaceGraph,
|
|
232
|
+
rowModel,
|
|
233
|
+
grid: buildGrid(rowModel, {}, highlightFromEdgeAnnotations(edgeAnnotations)),
|
|
234
|
+
edgeAnnotations
|
|
235
|
+
};
|
|
236
|
+
});
|
|
237
|
+
const globalLabelColumn = spaceLayouts.length > 1 ? Math.max(...spaceLayouts.map(({ grid }) => computeLabelColumn(grid, "unicode"))) : void 0;
|
|
238
|
+
const globalMaxDirNameWidthFromLayouts = spaceLayouts.length > 1 ? Math.max(...spaceLayouts.map(({ rowModel }) => computeMaxDirNameWidth(rowModel))) : void 0;
|
|
239
|
+
const runListMaxFromMigrations = orderedMigrations.length > 0 ? Math.max(...orderedMigrations.map((m) => m.dirName.length)) : 0;
|
|
240
|
+
const globalMaxDirNameWidth = globalMaxDirNameWidthFromLayouts !== void 0 ? Math.max(globalMaxDirNameWidthFromLayouts, runListMaxFromMigrations) : void 0;
|
|
241
|
+
runListDirNameWidth = globalMaxDirNameWidth ?? runListMaxFromMigrations;
|
|
242
|
+
runListLeftPad = globalLabelColumn;
|
|
243
|
+
const showSpaceHeadings = allSpaces.length > 1;
|
|
244
|
+
const sections = [];
|
|
245
|
+
for (const { space, isApp, rowModel, grid, edgeAnnotations } of spaceLayouts) {
|
|
246
|
+
const liveMarkerHash = (markerBySpace.get(space.spaceId) ?? null)?.storageHash ?? "empty";
|
|
247
|
+
const tree = renderMigrationGraphCommand({
|
|
248
|
+
grid,
|
|
249
|
+
rowModel,
|
|
250
|
+
contractHash,
|
|
251
|
+
isAppSpace: isApp,
|
|
252
|
+
...needsLiveMarker ? { dbHash: liveMarkerHash } : {},
|
|
253
|
+
refsByHash: listRefsByContractHash(space),
|
|
254
|
+
edgeAnnotationsByHash: edgeAnnotations,
|
|
255
|
+
colorize,
|
|
256
|
+
glyphMode: "unicode",
|
|
257
|
+
...globalLabelColumn !== void 0 ? { globalLabelColumn } : {},
|
|
258
|
+
...globalMaxDirNameWidth !== void 0 ? { globalMaxDirNameWidth } : {}
|
|
259
|
+
});
|
|
260
|
+
if (tree.length === 0) continue;
|
|
261
|
+
if (showSpaceHeadings) sections.push(`${space.spaceId}:\n${indentMigrationGraphTreeBlock(tree, " ")}`);
|
|
262
|
+
else sections.push(tree);
|
|
263
|
+
}
|
|
264
|
+
graphOutput = sections.join("\n\n");
|
|
265
|
+
}
|
|
266
|
+
return ok({
|
|
267
|
+
ok: true,
|
|
268
|
+
migrations: orderedMigrations,
|
|
269
|
+
summary,
|
|
270
|
+
...graphOutput !== void 0 ? { graphOutput } : {},
|
|
271
|
+
...runListDirNameWidth !== void 0 ? { runListDirNameWidth } : {},
|
|
272
|
+
...runListLeftPad !== void 0 ? { runListLeftPad } : {}
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
function formatMigrateShowOutput(result, flags) {
|
|
276
|
+
if (flags.quiet) return "";
|
|
277
|
+
const colorize = flags.color !== false;
|
|
278
|
+
const lines = [];
|
|
279
|
+
if (result.graphOutput !== void 0 && result.graphOutput.length > 0) {
|
|
280
|
+
lines.push(result.graphOutput);
|
|
281
|
+
lines.push("");
|
|
282
|
+
}
|
|
283
|
+
const n = result.migrations.length;
|
|
284
|
+
if (n > 0) {
|
|
285
|
+
lines.push(`The following ${n} migration${n === 1 ? "" : "s"} will run:`);
|
|
286
|
+
const isMultiSpace = result.runListLeftPad !== void 0;
|
|
287
|
+
const gutter = result.runListLeftPad ?? 0;
|
|
288
|
+
const rawDirNameWidth = result.runListDirNameWidth ?? Math.max(...result.migrations.map((m) => m.dirName.length));
|
|
289
|
+
const listDirNameWidth = gutter + Math.max(rawDirNameWidth + 2, 25 - gutter) - (isMultiSpace ? 2 : 4);
|
|
290
|
+
for (const m of result.migrations) lines.push(` ${formatOnPathMigrationRow(m.dirName, m.from, m.to, listDirNameWidth, colorize, "unicode")}`);
|
|
291
|
+
} else lines.push(result.summary);
|
|
292
|
+
return lines.join("\n");
|
|
293
|
+
}
|
|
294
|
+
function mapApplyFailure(failure) {
|
|
295
|
+
if (failure.code === "MIGRATION_PATH_NOT_FOUND") return errorPathUnreachable(failure);
|
|
296
|
+
return errorRuntime$1(failure.summary, {
|
|
297
|
+
why: failure.why ?? "Migration runner failed",
|
|
298
|
+
fix: "Fix the issue and re-run `prisma-next migrate --to <contract>` — previously applied migrations are preserved.",
|
|
299
|
+
meta: failure.meta ?? {}
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
async function executeMigrateCommand(options, flags, ui, startTime) {
|
|
303
|
+
const config = await loadConfig(options.config);
|
|
304
|
+
const { configPath, migrationsDir, appMigrationsRelative, refsDir } = resolveMigrationPaths(options.config, config);
|
|
305
|
+
const dbConnection = options.db ?? config.db?.connection;
|
|
306
|
+
if (!dbConnection) return notOk(errorDatabaseConnectionRequired({
|
|
307
|
+
why: `Database connection is required for migrate (set db.connection in ${configPath}, or pass --db <url>)`,
|
|
308
|
+
commandName: "migrate"
|
|
309
|
+
}));
|
|
310
|
+
if (!config.driver) return notOk(errorDriverRequired({ why: "Config.driver is required for migrate" }));
|
|
311
|
+
if (!targetSupportsMigrations(config.target)) return notOk(errorTargetMigrationNotSupported({ why: `Target "${config.target.id}" does not support migrations` }));
|
|
312
|
+
const toArg = options.to;
|
|
313
|
+
const stack = createControlStack(config);
|
|
314
|
+
const familyInstance = config.family.create(stack);
|
|
315
|
+
const contractPathAbsolute = resolveContractPath(config);
|
|
316
|
+
let contractRaw;
|
|
317
|
+
let contractContent;
|
|
318
|
+
try {
|
|
319
|
+
contractContent = await readFile(contractPathAbsolute, "utf-8");
|
|
320
|
+
} catch (error) {
|
|
321
|
+
if (error instanceof Error && error.code === "ENOENT") return notOk(errorFileNotFound(contractPathAbsolute, {
|
|
322
|
+
why: `Contract file not found at ${contractPathAbsolute}`,
|
|
323
|
+
fix: "Run `prisma-next contract emit` to generate a valid contract.json, then retry."
|
|
324
|
+
}));
|
|
325
|
+
return notOk(errorContractValidationFailed(`Failed to read contract file: ${error instanceof Error ? error.message : String(error)}`, { where: { path: contractPathAbsolute } }));
|
|
326
|
+
}
|
|
327
|
+
try {
|
|
328
|
+
contractRaw = familyInstance.deserializeContract(JSON.parse(contractContent));
|
|
329
|
+
} catch (error) {
|
|
330
|
+
return notOk(errorContractValidationFailed(`Contract at ${contractPathAbsolute} failed to deserialize: ${error instanceof Error ? error.message : String(error)}`, { where: { path: contractPathAbsolute } }));
|
|
331
|
+
}
|
|
332
|
+
const loadedAggregate = await loadContractSpaceAggregateForCli({
|
|
333
|
+
targetId: config.target.targetId,
|
|
334
|
+
migrationsDir,
|
|
335
|
+
appContract: contractRaw,
|
|
336
|
+
extensions: config.extensions ?? [],
|
|
337
|
+
deserializeContract: (json) => familyInstance.deserializeContract(json)
|
|
338
|
+
});
|
|
339
|
+
if (!loadedAggregate.ok) return notOk(loadedAggregate.failure);
|
|
340
|
+
const aggregate = loadedAggregate.value;
|
|
341
|
+
const integrityFailure = refuseContractSpaceIntegrity(aggregate, {
|
|
342
|
+
declaredExtensions: toDeclaredExtensionsFromRaw(config.extensions ?? []),
|
|
343
|
+
checkContracts: true
|
|
344
|
+
});
|
|
345
|
+
if (integrityFailure) return notOk(integrityFailure);
|
|
346
|
+
let refEntry;
|
|
347
|
+
let refName;
|
|
348
|
+
if (toArg) {
|
|
349
|
+
const refs = aggregate.app.refs;
|
|
350
|
+
const refResult = parseContractRef(toArg, {
|
|
351
|
+
graph: aggregate.app.graph(),
|
|
352
|
+
refs
|
|
353
|
+
});
|
|
354
|
+
if (!refResult.ok) return notOk(mapRefResolutionError(refResult.failure));
|
|
355
|
+
if (refResult.value.provenance.kind === "ref") {
|
|
356
|
+
refName = refResult.value.provenance.refName;
|
|
357
|
+
const resolved = refs[refName];
|
|
358
|
+
if (resolved) refEntry = resolved;
|
|
359
|
+
} else refEntry = {
|
|
360
|
+
hash: refResult.value.hash,
|
|
361
|
+
invariants: []
|
|
362
|
+
};
|
|
363
|
+
}
|
|
364
|
+
if (!flags.json && !flags.quiet) {
|
|
365
|
+
const details = [{
|
|
366
|
+
label: "config",
|
|
367
|
+
value: configPath
|
|
368
|
+
}, {
|
|
369
|
+
label: "migrations",
|
|
370
|
+
value: appMigrationsRelative
|
|
371
|
+
}];
|
|
372
|
+
if (typeof dbConnection === "string") details.push({
|
|
373
|
+
label: "database",
|
|
374
|
+
value: maskConnectionUrl(dbConnection)
|
|
375
|
+
});
|
|
376
|
+
if (toArg) details.push({
|
|
377
|
+
label: "to",
|
|
378
|
+
value: toArg
|
|
379
|
+
});
|
|
380
|
+
const header = formatStyledHeader({
|
|
381
|
+
command: "migrate",
|
|
382
|
+
description: "Apply planned migrations to advance the database",
|
|
383
|
+
url: "https://pris.ly/migrate",
|
|
384
|
+
details,
|
|
385
|
+
flags
|
|
386
|
+
});
|
|
387
|
+
ui.stderr(header);
|
|
388
|
+
}
|
|
389
|
+
const appGraph = aggregate.app.graph();
|
|
390
|
+
const client = createControlClient({
|
|
391
|
+
family: config.family,
|
|
392
|
+
target: config.target,
|
|
393
|
+
adapter: config.adapter,
|
|
394
|
+
driver: config.driver,
|
|
395
|
+
extensions: config.extensions ?? []
|
|
396
|
+
});
|
|
397
|
+
try {
|
|
398
|
+
await client.connect(dbConnection);
|
|
399
|
+
const appMarker = (await client.readAllMarkers()).get("app") ?? null;
|
|
400
|
+
if (appMarker !== null && !isGraphNode(appMarker.storageHash, appGraph)) return notOk(errorMarkerMismatch(appMarker.storageHash, [...appGraph.nodes].sort(), findLatestMigration(appGraph)?.to ?? null));
|
|
401
|
+
if (refEntry && refEntry.invariants.length > 0) {
|
|
402
|
+
const declared = collectDeclaredInvariants(appGraph);
|
|
403
|
+
const known = new Set(declared);
|
|
404
|
+
for (const id of appMarker?.invariants ?? []) known.add(id);
|
|
405
|
+
const unknown = refEntry.invariants.filter((id) => !known.has(id));
|
|
406
|
+
if (unknown.length > 0) return notOk(mapMigrationToolsError(errorUnknownInvariant({
|
|
407
|
+
...ifDefined("refName", toArg),
|
|
408
|
+
unknown,
|
|
409
|
+
declared: [...declared].sort()
|
|
410
|
+
})));
|
|
411
|
+
}
|
|
412
|
+
if (!flags.quiet && !flags.json) ui.step("Loading contract spaces…");
|
|
413
|
+
let applyContract = contractRaw;
|
|
414
|
+
let snapshotContractJson = JSON.parse(contractContent);
|
|
415
|
+
let snapshotContractDts;
|
|
416
|
+
if (toArg && refEntry) {
|
|
417
|
+
const targetHash = refEntry.hash;
|
|
418
|
+
if (aggregate.app.packages.find((p) => p.metadata.to === targetHash)) try {
|
|
419
|
+
const at = await aggregate.app.contractAt(targetHash, refName !== void 0 ? { refName } : void 0);
|
|
420
|
+
applyContract = at.contract;
|
|
421
|
+
snapshotContractJson = at.contractJson;
|
|
422
|
+
snapshotContractDts = at.contractDts;
|
|
423
|
+
} catch (error) {
|
|
424
|
+
return mapContractAtError(error, { artifactRole: "to" });
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
const applyResult = await client.migrate({
|
|
428
|
+
contract: applyContract,
|
|
429
|
+
migrationsDir,
|
|
430
|
+
...ifDefined("refHash", refEntry?.hash),
|
|
431
|
+
...refEntry?.invariants ? { refInvariants: refEntry.invariants } : {},
|
|
432
|
+
...refEntry !== void 0 ? ifDefined("refName", toArg) : {}
|
|
433
|
+
});
|
|
434
|
+
if (!applyResult.ok) return notOk(mapApplyFailure(applyResult.failure));
|
|
435
|
+
const { value } = applyResult;
|
|
436
|
+
let advancedRef = null;
|
|
437
|
+
if (options.advanceRef !== void 0) try {
|
|
438
|
+
const contractIR = snapshotContractDts !== void 0 ? {
|
|
439
|
+
contract: snapshotContractJson,
|
|
440
|
+
contractDts: snapshotContractDts
|
|
441
|
+
} : await readContractIR(snapshotContractJson, contractPathAbsolute);
|
|
442
|
+
advancedRef = await executeRefAdvancement(refsDir, migrationsDir, options.advanceRef, value.markerHash, contractIR);
|
|
443
|
+
} catch (error) {
|
|
444
|
+
if (MigrationToolsError.is(error)) return notOk(mapMigrationToolsError(error));
|
|
445
|
+
throw error;
|
|
446
|
+
}
|
|
447
|
+
return ok({
|
|
448
|
+
ok: true,
|
|
449
|
+
migrationsApplied: value.migrationsApplied,
|
|
450
|
+
migrationsTotal: value.perSpace.length,
|
|
451
|
+
markerHash: value.markerHash,
|
|
452
|
+
applied: value.applied,
|
|
453
|
+
summary: value.summary,
|
|
454
|
+
perSpace: value.perSpace,
|
|
455
|
+
...ifDefined("pathDecision", value.pathDecision),
|
|
456
|
+
timings: { total: Date.now() - startTime },
|
|
457
|
+
advancedRef
|
|
458
|
+
});
|
|
459
|
+
} catch (error) {
|
|
460
|
+
if (CliStructuredError$1.is(error)) return notOk(error);
|
|
461
|
+
if (MigrationToolsError.is(error)) return notOk(mapMigrationToolsError(error));
|
|
462
|
+
return notOk(errorUnexpected(error instanceof Error ? error.message : String(error), { why: `Unexpected error during migrate: ${error instanceof Error ? error.message : String(error)}` }));
|
|
463
|
+
} finally {
|
|
464
|
+
await client.close();
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
function createMigrateCommand() {
|
|
468
|
+
const command = new Command("migrate");
|
|
469
|
+
setCommandDescriptions(command, "Apply planned migrations to advance the database", "Walks every contract space (app + extensions) and applies pending\non-disk migrations in canonical order (extensions alphabetically,\nthen app). Graph-walks the on-disk migration graph for every space.\nUse --to to target a specific contract (hash, ref name, migration dir).\nUse --show for a read-only preview of the path that would run.");
|
|
470
|
+
setCommandExamples(command, [
|
|
471
|
+
"prisma-next migrate --db $DATABASE_URL",
|
|
472
|
+
"prisma-next migrate --to production --db $DATABASE_URL",
|
|
473
|
+
"prisma-next migrate --to abc123 --db $DATABASE_URL",
|
|
474
|
+
"prisma-next migrate --show --db $DATABASE_URL",
|
|
475
|
+
"prisma-next migrate --show --from @contract --to production"
|
|
476
|
+
]);
|
|
477
|
+
addGlobalOptions(command).option("--db <url>", "Database connection string").option("--config <path>", "Path to prisma-next.config.ts").option("--to <contract>", "Target contract reference (hash, prefix, ref name, migration dir name, <dir>^, or ./path)").option("--advance-ref <name>", "Advance the named ref to the post-apply marker after success").option("--show", "Preview the migration path without applying (read-only)").option("--from <contract>", "From-state for --show preview (@contract, @db, hash, ref name, or migration dir)").action(async (options) => {
|
|
478
|
+
const flags = parseGlobalFlagsOrExit(options);
|
|
479
|
+
const startTime = Date.now();
|
|
480
|
+
const ui = createTerminalUI(flags);
|
|
481
|
+
if (options.show) {
|
|
482
|
+
const exitCode = handleResult(await executeMigrateShowCommand(options, flags, ui), flags, ui, (showResult) => {
|
|
483
|
+
if (flags.json) ui.output(JSON.stringify(showResult, null, 2));
|
|
484
|
+
else ui.output(formatMigrateShowOutput(showResult, flags));
|
|
485
|
+
});
|
|
486
|
+
process.exit(exitCode);
|
|
487
|
+
return;
|
|
488
|
+
}
|
|
489
|
+
const exitCode = handleResult(await executeMigrateCommand(options, flags, ui, startTime), flags, ui, (migrateResult) => {
|
|
490
|
+
if (flags.json) ui.output(JSON.stringify(migrateResult, null, 2));
|
|
491
|
+
else if (!flags.quiet) ui.log(formatMigrationApplyCommandOutput(migrateResult, flags));
|
|
492
|
+
});
|
|
493
|
+
process.exit(exitCode);
|
|
494
|
+
});
|
|
495
|
+
return command;
|
|
496
|
+
}
|
|
497
|
+
//#endregion
|
|
498
|
+
export { createMigrateCommand as t };
|
|
499
|
+
|
|
500
|
+
//# sourceMappingURL=migrate-Cb_iv264.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrate-Cb_iv264.mjs","names":["CliStructuredError","errorRuntime"],"sources":["../../../../1-framework/3-tooling/cli/dist/commands/migrate.mjs"],"sourcesContent":["import { A as formatStyledHeader, B as errorContractValidationFailed, F as CliStructuredError, J as errorMarkerMismatch, S as formatMigrationApplyCommandOutput, U as errorDriverRequired, V as errorDatabaseConnectionRequired, W as errorFileNotFound, Z as errorPathUnreachable, _ as createTerminalUI, ct as errorUnexpected, dt as requireLiveDatabase, f as targetSupportsMigrations, g as parseGlobalFlagsOrExit, i as maskConnectionUrl, l as setCommandDescriptions, lt as mapMigrationToolsError, n as collectDeclaredInvariants, o as resolveContractPath, ot as errorTargetMigrationNotSupported, rt as errorRuntime, s as resolveMigrationPaths, t as addGlobalOptions, u as setCommandExamples, ut as mapRefResolutionError, y as handleResult } from \"../command-helpers-CAoXqAY9.mjs\";\nimport { a as refuseContractSpaceIntegrity, i as loadContractSpaceAggregateForCli, n as buildReadAggregate, s as toDeclaredExtensionsFromRaw } from \"../contract-space-aggregate-loader-CFH-336b.mjs\";\nimport { n as planSpacePath, t as createControlClient } from \"../client-75qrAPqf.mjs\";\nimport { i as readContractIR, r as executeRefAdvancement } from \"../ref-advancement-CSPMoQs3.mjs\";\nimport { t as mapContractAtError } from \"../contract-at-errors-BX7w-p19.mjs\";\nimport { d as highlightFromEdgeAnnotations, f as indentMigrationGraphTreeBlock, h as buildGrid, i as formatOnPathMigrationRow, m as buildMigrationGraphRows, n as computeMaxDirNameWidth, r as renderMigrationGraphCommand, t as computeLabelColumn } from \"../migration-graph-command-render-BKrg6BPv.mjs\";\nimport { r as listRefsByContractHash } from \"../migration-list-BFBeo1_X.mjs\";\nimport { Command } from \"commander\";\nimport { loadConfig } from \"@internal/config-loader\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { readFile } from \"node:fs/promises\";\nimport { createControlStack } from \"@internal/framework-components/control\";\nimport { requireHeadRef } from \"@internal/migration-tools/aggregate\";\nimport { EMPTY_CONTRACT_HASH } from \"@internal/migration-tools/constants\";\nimport { MigrationToolsError, errorUnknownInvariant } from \"@internal/migration-tools/errors\";\nimport { findLatestMigration, isGraphNode } from \"@internal/migration-tools/migration-graph\";\nimport { readRefs } from \"@internal/migration-tools/refs\";\nimport { parseContractRef } from \"@internal/migration-tools/ref-resolution\";\n//#region src/commands/migrate.ts\n/**\n* Read-only preview of the migration path `migrate` will take.\n*\n* Computes the path through the SAME seam as `executeMigrate`:\n* - `readAllMarkers()` for the from-state (when no `--from` is given), preserving\n* the full marker including `invariants` (not just `storageHash`).\n* - `planSpacePath()` (shared with `executeMigrate`) for per-space path selection,\n* which feeds `resolveRecordedPath()` with the same target hash, target invariants,\n* and current marker as the real apply path uses.\n*\n* Returns BEFORE any write boundary (`runMigration` / marker / DDL). No\n* DB state is mutated.\n*/\nasync function executeMigrateShowCommand(options, flags, ui) {\n\tconst config = await loadConfig(options.config);\n\tconst { configPath, migrationsDir, migrationsRelative, refsDir } = resolveMigrationPaths(options.config, config);\n\tconst dbConnection = options.db ?? config.db?.connection;\n\tconst hasDriver = !!config.driver;\n\tconst hasExplicitFrom = options.from !== void 0;\n\tif (!hasExplicitFrom) {\n\t\tconst missingDb = requireLiveDatabase({\n\t\t\tdbConnection,\n\t\t\thasDriver,\n\t\t\twhy: \"migrate --show needs a database connection to read the live marker (or pass --from <contract> for an offline preview)\",\n\t\t\tretryCommand: \"prisma-next migrate --show --from <contract>\"\n\t\t});\n\t\tif (missingDb) return notOk(missingDb);\n\t}\n\tlet allRefs = {};\n\ttry {\n\t\tallRefs = await readRefs(refsDir);\n\t} catch (error) {\n\t\tif (MigrationToolsError.is(error)) return notOk(mapMigrationToolsError(error));\n\t\tthrow error;\n\t}\n\tconst loaded = await buildReadAggregate(config, { migrationsDir });\n\tif (!loaded.ok) return notOk(loaded.failure);\n\tconst { aggregate, contractHash } = loaded.value;\n\tconst appGraph = aggregate.app.graph();\n\tlet targetHash = contractHash;\n\tlet refInvariants;\n\tif (options.to) {\n\t\tconst toResult = parseContractRef(options.to, {\n\t\t\tgraph: appGraph,\n\t\t\trefs: allRefs,\n\t\t\tcontractHash\n\t\t});\n\t\tif (!toResult.ok) return notOk(mapRefResolutionError(toResult.failure));\n\t\tif (toResult.value.provenance.kind === \"reserved-db\") return notOk(errorDatabaseConnectionRequired({\n\t\t\twhy: \"@db is not valid as a --to target; it names the live database state, not a target contract.\",\n\t\t\tcommandName: \"migrate --show\"\n\t\t}));\n\t\ttargetHash = toResult.value.hash;\n\t\tif (toResult.value.provenance.kind === \"ref\") {\n\t\t\tconst refEntry = allRefs[toResult.value.provenance.refName];\n\t\t\tif (refEntry) refInvariants = refEntry.invariants;\n\t\t}\n\t}\n\tif (!flags.json && !flags.quiet) {\n\t\tconst details = [{\n\t\t\tlabel: \"config\",\n\t\t\tvalue: configPath\n\t\t}, {\n\t\t\tlabel: \"migrations\",\n\t\t\tvalue: migrationsRelative\n\t\t}];\n\t\tif (dbConnection && !hasExplicitFrom) details.push({\n\t\t\tlabel: \"database\",\n\t\t\tvalue: maskConnectionUrl(String(dbConnection))\n\t\t});\n\t\tif (options.from) details.push({\n\t\t\tlabel: \"from\",\n\t\t\tvalue: options.from\n\t\t});\n\t\tif (options.to) details.push({\n\t\t\tlabel: \"to\",\n\t\t\tvalue: options.to\n\t\t});\n\t\tconst header = formatStyledHeader({\n\t\t\tcommand: \"migrate --show\",\n\t\t\tdescription: \"Preview the migration path migrate will take (read-only)\",\n\t\t\tdetails,\n\t\t\tflags\n\t\t});\n\t\tui.stderr(header);\n\t}\n\tconst markerBySpace = /* @__PURE__ */ new Map();\n\tconst allSpaces = [aggregate.app, ...aggregate.extensions];\n\tif (hasExplicitFrom) if (options.from === \"@db\") {\n\t\tconst missingDb = requireLiveDatabase({\n\t\t\tdbConnection,\n\t\t\thasDriver,\n\t\t\twhy: \"@db resolves to the live database marker and requires a --db connection\",\n\t\t\tretryCommand: \"prisma-next migrate --show --from @db --db $DATABASE_URL\"\n\t\t});\n\t\tif (missingDb) return notOk(missingDb);\n\t} else {\n\t\tconst fromResult = parseContractRef(options.from, {\n\t\t\tgraph: appGraph,\n\t\t\trefs: allRefs,\n\t\t\tcontractHash\n\t\t});\n\t\tif (!fromResult.ok) return notOk(mapRefResolutionError(fromResult.failure));\n\t\tif (fromResult.value.provenance.kind === \"reserved-db\") {\n\t\t\tconst missingDb = requireLiveDatabase({\n\t\t\t\tdbConnection,\n\t\t\t\thasDriver,\n\t\t\t\twhy: \"@db resolves to the live database marker and requires a --db connection\"\n\t\t\t});\n\t\t\tif (missingDb) return notOk(missingDb);\n\t\t} else {\n\t\t\tconst fromHash = fromResult.value.hash;\n\t\t\tconst offlineMarker = fromHash === EMPTY_CONTRACT_HASH ? null : {\n\t\t\t\tstorageHash: fromHash,\n\t\t\t\tinvariants: []\n\t\t\t};\n\t\t\tmarkerBySpace.set(aggregate.app.spaceId, offlineMarker);\n\t\t}\n\t}\n\tconst needsLiveMarker = !hasExplicitFrom || options.from === \"@db\";\n\tif (needsLiveMarker) {\n\t\tif (!dbConnection || !hasDriver) return notOk(errorDatabaseConnectionRequired({\n\t\t\twhy: \"A database connection is required to read the live marker for migrate --show\",\n\t\t\tcommandName: \"migrate --show\"\n\t\t}));\n\t\tconst client = createControlClient({\n\t\t\tfamily: config.family,\n\t\t\ttarget: config.target,\n\t\t\tadapter: config.adapter,\n\t\t\tdriver: config.driver,\n\t\t\textensions: config.extensions ?? []\n\t\t});\n\t\ttry {\n\t\t\tawait client.connect(dbConnection);\n\t\t\tconst allMarkers = await client.readAllMarkers();\n\t\t\tfor (const space of allSpaces) {\n\t\t\t\tconst marker = allMarkers.get(space.spaceId);\n\t\t\t\tmarkerBySpace.set(space.spaceId, marker ?? null);\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tif (CliStructuredError.is(error)) return notOk(error);\n\t\t\tif (MigrationToolsError.is(error)) return notOk(mapMigrationToolsError(error));\n\t\t\treturn notOk(errorUnexpected(error instanceof Error ? error.message : String(error), { why: `Failed to read live DB marker: ${error instanceof Error ? error.message : String(error)}` }));\n\t\t} finally {\n\t\t\tawait client.close();\n\t\t}\n\t}\n\tconst canonicalOrderSpaces = [...aggregate.extensions, aggregate.app];\n\tconst orderedMigrations = [];\n\tfor (const space of canonicalOrderSpaces) {\n\t\tconst isAppSpace = space.spaceId === aggregate.app.spaceId;\n\t\tconst headRef = requireHeadRef(space);\n\t\tconst outcome = planSpacePath({\n\t\t\tspace,\n\t\t\taggregate,\n\t\t\ttargetHash: isAppSpace ? targetHash : headRef.hash,\n\t\t\trefInvariants: isAppSpace ? refInvariants : void 0,\n\t\t\tliveMarker: markerBySpace.get(space.spaceId) ?? null\n\t\t});\n\t\tif (outcome.kind === \"at-head\") continue;\n\t\tif (outcome.kind === \"never-planned\") return notOk(errorPathUnreachable({\n\t\t\tcode: \"MIGRATION_PATH_NOT_FOUND\",\n\t\t\tsummary: `No on-disk migrations for contract space \"${outcome.spaceId}\"`,\n\t\t\twhy: `migrate is replay-only: space \"${outcome.spaceId}\" has no on-disk migrations but its head ref targets \"${outcome.targetHash}\".`,\n\t\t\tmeta: {\n\t\t\t\tspaceId: outcome.spaceId,\n\t\t\t\ttarget: outcome.targetHash,\n\t\t\t\tkind: \"neverPlanned\"\n\t\t\t}\n\t\t}));\n\t\tif (outcome.kind === \"unreachable\") {\n\t\t\tconst fromHash = outcome.liveMarker?.storageHash ?? EMPTY_CONTRACT_HASH;\n\t\t\treturn notOk(errorPathUnreachable({\n\t\t\t\tcode: \"MIGRATION_PATH_NOT_FOUND\",\n\t\t\t\tsummary: `No migration path from ${fromHash.slice(0, 14)} to ${outcome.targetHash.slice(0, 14)} in space \"${outcome.spaceId}\".`,\n\t\t\t\twhy: `The migration graph has no path from the from-state to the target in space \"${outcome.spaceId}\".`,\n\t\t\t\tmeta: {\n\t\t\t\t\tspaceId: outcome.spaceId,\n\t\t\t\t\tfrom: fromHash,\n\t\t\t\t\tto: outcome.targetHash\n\t\t\t\t}\n\t\t\t}));\n\t\t}\n\t\tif (outcome.kind === \"unsatisfiable\") return notOk(errorRuntime(`Missing required invariants for space \"${outcome.spaceId}\"`, { why: `The path requires invariants not available on disk: ${outcome.missing.join(\", \")}` }));\n\t\tfor (const edge of outcome.plan.migrationEdges) orderedMigrations.push({\n\t\t\tspaceId: space.spaceId,\n\t\t\tdirName: edge.dirName,\n\t\t\tmigrationHash: edge.migrationHash,\n\t\t\tfrom: edge.from,\n\t\t\tto: edge.to\n\t\t});\n\t}\n\tconst count = orderedMigrations.length;\n\tconst summary = count === 0 ? \"Already up to date — nothing to run\" : `${count} migration${count === 1 ? \"\" : \"s\"} will run`;\n\tlet graphOutput;\n\tlet runListDirNameWidth;\n\tlet runListLeftPad;\n\tif (!flags.json) {\n\t\tconst onPathHashes = new Set(orderedMigrations.map((m) => m.migrationHash));\n\t\tconst colorize = flags.color !== false;\n\t\tconst spaceLayouts = allSpaces.map((space) => {\n\t\t\tconst isApp = space.spaceId === aggregate.app.spaceId;\n\t\t\tconst spaceGraph = space.graph();\n\t\t\tconst rowModel = buildMigrationGraphRows(spaceGraph, isApp ? { contractHash } : {});\n\t\t\tconst edgeAnnotations = /* @__PURE__ */ new Map();\n\t\t\tfor (const edge of spaceGraph.migrationByHash.values()) edgeAnnotations.set(edge.migrationHash, { pathHighlight: onPathHashes.has(edge.migrationHash) ? \"on-path\" : \"off-path\" });\n\t\t\treturn {\n\t\t\t\tspace,\n\t\t\t\tisApp,\n\t\t\t\tspaceGraph,\n\t\t\t\trowModel,\n\t\t\t\tgrid: buildGrid(rowModel, {}, highlightFromEdgeAnnotations(edgeAnnotations)),\n\t\t\t\tedgeAnnotations\n\t\t\t};\n\t\t});\n\t\tconst globalLabelColumn = spaceLayouts.length > 1 ? Math.max(...spaceLayouts.map(({ grid }) => computeLabelColumn(grid, \"unicode\"))) : void 0;\n\t\tconst globalMaxDirNameWidthFromLayouts = spaceLayouts.length > 1 ? Math.max(...spaceLayouts.map(({ rowModel }) => computeMaxDirNameWidth(rowModel))) : void 0;\n\t\tconst runListMaxFromMigrations = orderedMigrations.length > 0 ? Math.max(...orderedMigrations.map((m) => m.dirName.length)) : 0;\n\t\tconst globalMaxDirNameWidth = globalMaxDirNameWidthFromLayouts !== void 0 ? Math.max(globalMaxDirNameWidthFromLayouts, runListMaxFromMigrations) : void 0;\n\t\trunListDirNameWidth = globalMaxDirNameWidth ?? runListMaxFromMigrations;\n\t\trunListLeftPad = globalLabelColumn;\n\t\tconst showSpaceHeadings = allSpaces.length > 1;\n\t\tconst sections = [];\n\t\tfor (const { space, isApp, rowModel, grid, edgeAnnotations } of spaceLayouts) {\n\t\t\tconst liveMarkerHash = (markerBySpace.get(space.spaceId) ?? null)?.storageHash ?? EMPTY_CONTRACT_HASH;\n\t\t\tconst tree = renderMigrationGraphCommand({\n\t\t\t\tgrid,\n\t\t\t\trowModel,\n\t\t\t\tcontractHash,\n\t\t\t\tisAppSpace: isApp,\n\t\t\t\t...needsLiveMarker ? { dbHash: liveMarkerHash } : {},\n\t\t\t\trefsByHash: listRefsByContractHash(space),\n\t\t\t\tedgeAnnotationsByHash: edgeAnnotations,\n\t\t\t\tcolorize,\n\t\t\t\tglyphMode: \"unicode\",\n\t\t\t\t...globalLabelColumn !== void 0 ? { globalLabelColumn } : {},\n\t\t\t\t...globalMaxDirNameWidth !== void 0 ? { globalMaxDirNameWidth } : {}\n\t\t\t});\n\t\t\tif (tree.length === 0) continue;\n\t\t\tif (showSpaceHeadings) sections.push(`${space.spaceId}:\\n${indentMigrationGraphTreeBlock(tree, \" \")}`);\n\t\t\telse sections.push(tree);\n\t\t}\n\t\tgraphOutput = sections.join(\"\\n\\n\");\n\t}\n\treturn ok({\n\t\tok: true,\n\t\tmigrations: orderedMigrations,\n\t\tsummary,\n\t\t...graphOutput !== void 0 ? { graphOutput } : {},\n\t\t...runListDirNameWidth !== void 0 ? { runListDirNameWidth } : {},\n\t\t...runListLeftPad !== void 0 ? { runListLeftPad } : {}\n\t});\n}\nfunction formatMigrateShowOutput(result, flags) {\n\tif (flags.quiet) return \"\";\n\tconst colorize = flags.color !== false;\n\tconst lines = [];\n\tif (result.graphOutput !== void 0 && result.graphOutput.length > 0) {\n\t\tlines.push(result.graphOutput);\n\t\tlines.push(\"\");\n\t}\n\tconst n = result.migrations.length;\n\tif (n > 0) {\n\t\tlines.push(`The following ${n} migration${n === 1 ? \"\" : \"s\"} will run:`);\n\t\tconst isMultiSpace = result.runListLeftPad !== void 0;\n\t\tconst gutter = result.runListLeftPad ?? 0;\n\t\tconst rawDirNameWidth = result.runListDirNameWidth ?? Math.max(...result.migrations.map((m) => m.dirName.length));\n\t\tconst listDirNameWidth = gutter + Math.max(rawDirNameWidth + 2, 25 - gutter) - (isMultiSpace ? 2 : 4);\n\t\tfor (const m of result.migrations) lines.push(` ${formatOnPathMigrationRow(m.dirName, m.from, m.to, listDirNameWidth, colorize, \"unicode\")}`);\n\t} else lines.push(result.summary);\n\treturn lines.join(\"\\n\");\n}\nfunction mapApplyFailure(failure) {\n\tif (failure.code === \"MIGRATION_PATH_NOT_FOUND\") return errorPathUnreachable(failure);\n\treturn errorRuntime(failure.summary, {\n\t\twhy: failure.why ?? \"Migration runner failed\",\n\t\tfix: \"Fix the issue and re-run `prisma-next migrate --to <contract>` — previously applied migrations are preserved.\",\n\t\tmeta: failure.meta ?? {}\n\t});\n}\nasync function executeMigrateCommand(options, flags, ui, startTime) {\n\tconst config = await loadConfig(options.config);\n\tconst { configPath, migrationsDir, appMigrationsRelative, refsDir } = resolveMigrationPaths(options.config, config);\n\tconst dbConnection = options.db ?? config.db?.connection;\n\tif (!dbConnection) return notOk(errorDatabaseConnectionRequired({\n\t\twhy: `Database connection is required for migrate (set db.connection in ${configPath}, or pass --db <url>)`,\n\t\tcommandName: \"migrate\"\n\t}));\n\tif (!config.driver) return notOk(errorDriverRequired({ why: \"Config.driver is required for migrate\" }));\n\tif (!targetSupportsMigrations(config.target)) return notOk(errorTargetMigrationNotSupported({ why: `Target \"${config.target.id}\" does not support migrations` }));\n\tconst toArg = options.to;\n\tconst stack = createControlStack(config);\n\tconst familyInstance = config.family.create(stack);\n\tconst contractPathAbsolute = resolveContractPath(config);\n\tlet contractRaw;\n\tlet contractContent;\n\ttry {\n\t\tcontractContent = await readFile(contractPathAbsolute, \"utf-8\");\n\t} catch (error) {\n\t\tif (error instanceof Error && error.code === \"ENOENT\") return notOk(errorFileNotFound(contractPathAbsolute, {\n\t\t\twhy: `Contract file not found at ${contractPathAbsolute}`,\n\t\t\tfix: \"Run `prisma-next contract emit` to generate a valid contract.json, then retry.\"\n\t\t}));\n\t\treturn notOk(errorContractValidationFailed(`Failed to read contract file: ${error instanceof Error ? error.message : String(error)}`, { where: { path: contractPathAbsolute } }));\n\t}\n\ttry {\n\t\tcontractRaw = familyInstance.deserializeContract(JSON.parse(contractContent));\n\t} catch (error) {\n\t\treturn notOk(errorContractValidationFailed(`Contract at ${contractPathAbsolute} failed to deserialize: ${error instanceof Error ? error.message : String(error)}`, { where: { path: contractPathAbsolute } }));\n\t}\n\tconst loadedAggregate = await loadContractSpaceAggregateForCli({\n\t\ttargetId: config.target.targetId,\n\t\tmigrationsDir,\n\t\tappContract: contractRaw,\n\t\textensions: config.extensions ?? [],\n\t\tdeserializeContract: (json) => familyInstance.deserializeContract(json)\n\t});\n\tif (!loadedAggregate.ok) return notOk(loadedAggregate.failure);\n\tconst aggregate = loadedAggregate.value;\n\tconst integrityFailure = refuseContractSpaceIntegrity(aggregate, {\n\t\tdeclaredExtensions: toDeclaredExtensionsFromRaw(config.extensions ?? []),\n\t\tcheckContracts: true\n\t});\n\tif (integrityFailure) return notOk(integrityFailure);\n\tlet refEntry;\n\tlet refName;\n\tif (toArg) {\n\t\tconst refs = aggregate.app.refs;\n\t\tconst refResult = parseContractRef(toArg, {\n\t\t\tgraph: aggregate.app.graph(),\n\t\t\trefs\n\t\t});\n\t\tif (!refResult.ok) return notOk(mapRefResolutionError(refResult.failure));\n\t\tif (refResult.value.provenance.kind === \"ref\") {\n\t\t\trefName = refResult.value.provenance.refName;\n\t\t\tconst resolved = refs[refName];\n\t\t\tif (resolved) refEntry = resolved;\n\t\t} else refEntry = {\n\t\t\thash: refResult.value.hash,\n\t\t\tinvariants: []\n\t\t};\n\t}\n\tif (!flags.json && !flags.quiet) {\n\t\tconst details = [{\n\t\t\tlabel: \"config\",\n\t\t\tvalue: configPath\n\t\t}, {\n\t\t\tlabel: \"migrations\",\n\t\t\tvalue: appMigrationsRelative\n\t\t}];\n\t\tif (typeof dbConnection === \"string\") details.push({\n\t\t\tlabel: \"database\",\n\t\t\tvalue: maskConnectionUrl(dbConnection)\n\t\t});\n\t\tif (toArg) details.push({\n\t\t\tlabel: \"to\",\n\t\t\tvalue: toArg\n\t\t});\n\t\tconst header = formatStyledHeader({\n\t\t\tcommand: \"migrate\",\n\t\t\tdescription: \"Apply planned migrations to advance the database\",\n\t\t\turl: \"https://pris.ly/migrate\",\n\t\t\tdetails,\n\t\t\tflags\n\t\t});\n\t\tui.stderr(header);\n\t}\n\tconst appGraph = aggregate.app.graph();\n\tconst client = createControlClient({\n\t\tfamily: config.family,\n\t\ttarget: config.target,\n\t\tadapter: config.adapter,\n\t\tdriver: config.driver,\n\t\textensions: config.extensions ?? []\n\t});\n\ttry {\n\t\tawait client.connect(dbConnection);\n\t\tconst appMarker = (await client.readAllMarkers()).get(\"app\") ?? null;\n\t\tif (appMarker !== null && !isGraphNode(appMarker.storageHash, appGraph)) return notOk(errorMarkerMismatch(appMarker.storageHash, [...appGraph.nodes].sort(), findLatestMigration(appGraph)?.to ?? null));\n\t\tif (refEntry && refEntry.invariants.length > 0) {\n\t\t\tconst declared = collectDeclaredInvariants(appGraph);\n\t\t\tconst known = new Set(declared);\n\t\t\tfor (const id of appMarker?.invariants ?? []) known.add(id);\n\t\t\tconst unknown = refEntry.invariants.filter((id) => !known.has(id));\n\t\t\tif (unknown.length > 0) return notOk(mapMigrationToolsError(errorUnknownInvariant({\n\t\t\t\t...ifDefined(\"refName\", toArg),\n\t\t\t\tunknown,\n\t\t\t\tdeclared: [...declared].sort()\n\t\t\t})));\n\t\t}\n\t\tif (!flags.quiet && !flags.json) ui.step(\"Loading contract spaces…\");\n\t\tlet applyContract = contractRaw;\n\t\tlet snapshotContractJson = JSON.parse(contractContent);\n\t\tlet snapshotContractDts;\n\t\tif (toArg && refEntry) {\n\t\t\tconst targetHash = refEntry.hash;\n\t\t\tif (aggregate.app.packages.find((p) => p.metadata.to === targetHash)) try {\n\t\t\t\tconst at = await aggregate.app.contractAt(targetHash, refName !== void 0 ? { refName } : void 0);\n\t\t\t\tapplyContract = at.contract;\n\t\t\t\tsnapshotContractJson = at.contractJson;\n\t\t\t\tsnapshotContractDts = at.contractDts;\n\t\t\t} catch (error) {\n\t\t\t\treturn mapContractAtError(error, { artifactRole: \"to\" });\n\t\t\t}\n\t\t}\n\t\tconst applyResult = await client.migrate({\n\t\t\tcontract: applyContract,\n\t\t\tmigrationsDir,\n\t\t\t...ifDefined(\"refHash\", refEntry?.hash),\n\t\t\t...refEntry?.invariants ? { refInvariants: refEntry.invariants } : {},\n\t\t\t...refEntry !== void 0 ? ifDefined(\"refName\", toArg) : {}\n\t\t});\n\t\tif (!applyResult.ok) return notOk(mapApplyFailure(applyResult.failure));\n\t\tconst { value } = applyResult;\n\t\tlet advancedRef = null;\n\t\tif (options.advanceRef !== void 0) try {\n\t\t\tconst contractIR = snapshotContractDts !== void 0 ? {\n\t\t\t\tcontract: snapshotContractJson,\n\t\t\t\tcontractDts: snapshotContractDts\n\t\t\t} : await readContractIR(snapshotContractJson, contractPathAbsolute);\n\t\t\tadvancedRef = await executeRefAdvancement(refsDir, migrationsDir, options.advanceRef, value.markerHash, contractIR);\n\t\t} catch (error) {\n\t\t\tif (MigrationToolsError.is(error)) return notOk(mapMigrationToolsError(error));\n\t\t\tthrow error;\n\t\t}\n\t\treturn ok({\n\t\t\tok: true,\n\t\t\tmigrationsApplied: value.migrationsApplied,\n\t\t\tmigrationsTotal: value.perSpace.length,\n\t\t\tmarkerHash: value.markerHash,\n\t\t\tapplied: value.applied,\n\t\t\tsummary: value.summary,\n\t\t\tperSpace: value.perSpace,\n\t\t\t...ifDefined(\"pathDecision\", value.pathDecision),\n\t\t\ttimings: { total: Date.now() - startTime },\n\t\t\tadvancedRef\n\t\t});\n\t} catch (error) {\n\t\tif (CliStructuredError.is(error)) return notOk(error);\n\t\tif (MigrationToolsError.is(error)) return notOk(mapMigrationToolsError(error));\n\t\treturn notOk(errorUnexpected(error instanceof Error ? error.message : String(error), { why: `Unexpected error during migrate: ${error instanceof Error ? error.message : String(error)}` }));\n\t} finally {\n\t\tawait client.close();\n\t}\n}\nfunction createMigrateCommand() {\n\tconst command = new Command(\"migrate\");\n\tsetCommandDescriptions(command, \"Apply planned migrations to advance the database\", \"Walks every contract space (app + extensions) and applies pending\\non-disk migrations in canonical order (extensions alphabetically,\\nthen app). Graph-walks the on-disk migration graph for every space.\\nUse --to to target a specific contract (hash, ref name, migration dir).\\nUse --show for a read-only preview of the path that would run.\");\n\tsetCommandExamples(command, [\n\t\t\"prisma-next migrate --db $DATABASE_URL\",\n\t\t\"prisma-next migrate --to production --db $DATABASE_URL\",\n\t\t\"prisma-next migrate --to abc123 --db $DATABASE_URL\",\n\t\t\"prisma-next migrate --show --db $DATABASE_URL\",\n\t\t\"prisma-next migrate --show --from @contract --to production\"\n\t]);\n\taddGlobalOptions(command).option(\"--db <url>\", \"Database connection string\").option(\"--config <path>\", \"Path to prisma-next.config.ts\").option(\"--to <contract>\", \"Target contract reference (hash, prefix, ref name, migration dir name, <dir>^, or ./path)\").option(\"--advance-ref <name>\", \"Advance the named ref to the post-apply marker after success\").option(\"--show\", \"Preview the migration path without applying (read-only)\").option(\"--from <contract>\", \"From-state for --show preview (@contract, @db, hash, ref name, or migration dir)\").action(async (options) => {\n\t\tconst flags = parseGlobalFlagsOrExit(options);\n\t\tconst startTime = Date.now();\n\t\tconst ui = createTerminalUI(flags);\n\t\tif (options.show) {\n\t\t\tconst exitCode = handleResult(await executeMigrateShowCommand(options, flags, ui), flags, ui, (showResult) => {\n\t\t\t\tif (flags.json) ui.output(JSON.stringify(showResult, null, 2));\n\t\t\t\telse ui.output(formatMigrateShowOutput(showResult, flags));\n\t\t\t});\n\t\t\tprocess.exit(exitCode);\n\t\t\treturn;\n\t\t}\n\t\tconst exitCode = handleResult(await executeMigrateCommand(options, flags, ui, startTime), flags, ui, (migrateResult) => {\n\t\t\tif (flags.json) ui.output(JSON.stringify(migrateResult, null, 2));\n\t\t\telse if (!flags.quiet) ui.log(formatMigrationApplyCommandOutput(migrateResult, flags));\n\t\t});\n\t\tprocess.exit(exitCode);\n\t});\n\treturn command;\n}\n//#endregion\nexport { createMigrateCommand };\n\n//# sourceMappingURL=migrate.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,eAAe,0BAA0B,SAAS,OAAO,IAAI;CAC5D,MAAM,SAAS,MAAM,WAAW,QAAQ,MAAM;CAC9C,MAAM,EAAE,YAAY,eAAe,oBAAoB,YAAY,sBAAsB,QAAQ,QAAQ,MAAM;CAC/G,MAAM,eAAe,QAAQ,MAAM,OAAO,IAAI;CAC9C,MAAM,YAAY,CAAC,CAAC,OAAO;CAC3B,MAAM,kBAAkB,QAAQ,SAAS,KAAK;CAC9C,IAAI,CAAC,iBAAiB;EACrB,MAAM,YAAY,oBAAoB;GACrC;GACA;GACA,KAAK;GACL,cAAc;EACf,CAAC;EACD,IAAI,WAAW,OAAO,MAAM,SAAS;CACtC;CACA,IAAI,UAAU,CAAC;CACf,IAAI;EACH,UAAU,MAAM,SAAS,OAAO;CACjC,SAAS,OAAO;EACf,IAAI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