@prisma/orm-target-sqlite 8.0.0-rc.9-dev.13 → 8.0.1-dev.2
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 +5 -1
- package/dist/adapter-BQZBUROY.d.mts +205 -0
- package/dist/adapter-BQZBUROY.d.mts.map +1 -0
- package/dist/{adapter-jwxys1MM-CmUELyBs.mjs → adapter-CxzIV2_z-DKbo2Ebu.mjs} +347 -137
- package/dist/adapter-CxzIV2_z-DKbo2Ebu.mjs.map +1 -0
- package/dist/{adapter-DEYUC-KO-DO_abhIq.d.mts → adapter-xFPDhkod-Bfb8AQQJ.d.mts} +12 -9
- package/dist/adapter-xFPDhkod-Bfb8AQQJ.d.mts.map +1 -0
- package/dist/adapter.d.mts +14 -15
- package/dist/adapter.mjs +7 -6
- package/dist/adapter__adapter.d.mts +4 -4
- package/dist/adapter__adapter.mjs +3 -2
- package/dist/adapter__codec-types.d.mts +3 -3
- package/dist/adapter__column-types.d.mts +2 -2
- package/dist/adapter__column-types.mjs +2 -2
- package/dist/adapter__control.d.mts +5 -5
- package/dist/adapter__control.mjs +12 -247
- package/dist/adapter__control.mjs.map +1 -1
- package/dist/adapter__runtime.d.mts +1 -1
- package/dist/adapter__runtime.mjs +30 -16
- package/dist/adapter__runtime.mjs.map +1 -1
- package/dist/adapter__sql-renderer.d.mts +2 -2
- package/dist/adapter__sql-renderer.mjs +1 -1
- package/dist/adapter__types.d.mts +3 -2
- package/dist/aggregates--0FaH9Te.d.mts +164 -0
- package/dist/aggregates--0FaH9Te.d.mts.map +1 -0
- package/dist/{aggregates-DWyPO7t6.mjs → aggregates-hLiHPHBG.mjs} +44 -26
- package/dist/aggregates-hLiHPHBG.mjs.map +1 -0
- package/dist/codec-descriptor-3oN7rtrW-Cc_u7U5-.d.mts +1 -0
- package/dist/codec-descriptor-C16gQAdS.d.mts +2 -0
- package/dist/{codec-descriptor-B9ru99aI-DTkdKFU5.mjs → codec-descriptor-DRmF-crq-BALI5Jtz.mjs} +11 -15
- package/dist/codec-descriptor-DRmF-crq-BALI5Jtz.mjs.map +1 -0
- package/dist/codec-descriptor-DuW-d9ef-BBRBN0Ri.d.mts +45 -0
- package/dist/codec-descriptor-DuW-d9ef-BBRBN0Ri.d.mts.map +1 -0
- package/dist/codec-ids-CH8Nqk89-LNT9hksu.d.mts +23 -0
- package/dist/codec-ids-CH8Nqk89-LNT9hksu.d.mts.map +1 -0
- package/dist/codec-ids-CTshXpbg-tcdbf_VC.mjs +23 -0
- package/dist/codec-ids-CTshXpbg-tcdbf_VC.mjs.map +1 -0
- package/dist/codec-ids-Do7Ml2pg.d.mts +1 -0
- package/dist/codec-types-CBLOfyrr.d.mts +2 -0
- package/dist/codec-types-CcuzuROC.d.mts +1 -0
- package/dist/codec-types-Ci-h2uxN-41PNpdNL.d.mts +35 -0
- package/dist/codec-types-Ci-h2uxN-41PNpdNL.d.mts.map +1 -0
- package/dist/codecs-BO3frExA.mjs +49 -0
- package/dist/codecs-BO3frExA.mjs.map +1 -0
- package/dist/codecs-DBQsDiM--Cy-r45H3.d.mts +378 -0
- package/dist/codecs-DBQsDiM--Cy-r45H3.d.mts.map +1 -0
- package/dist/codecs-Dou3fR1K.d.mts +1 -0
- package/dist/codecs-izq9l1NG-Bb2RnXsx.mjs +1081 -0
- package/dist/codecs-izq9l1NG-Bb2RnXsx.mjs.map +1 -0
- package/dist/column-types-D3MMpY3X.d.mts +42 -0
- package/dist/column-types-D3MMpY3X.d.mts.map +1 -0
- package/dist/column-types-D_PjRS6w.mjs +24 -0
- package/dist/column-types-D_PjRS6w.mjs.map +1 -0
- package/dist/contract-contributions-DEePsuJb-CXE-f6pP.mjs +28 -0
- package/dist/contract-contributions-DEePsuJb-CXE-f6pP.mjs.map +1 -0
- package/dist/{contract-free-D5cZrgNl.mjs → contract-free-B5S1OSEd.mjs} +8 -7
- package/dist/contract-free-B5S1OSEd.mjs.map +1 -0
- package/dist/{contract-free-CCLAXZV2.d.mts → contract-free-IqKgq8Pk.d.mts} +6 -6
- package/dist/contract-free-IqKgq8Pk.d.mts.map +1 -0
- package/dist/{control-D9vMRRgU.d.mts → control-C2TjacST.d.mts} +3 -3
- package/dist/control-C2TjacST.d.mts.map +1 -0
- package/dist/control-CtCvtwJx.d.mts +408 -0
- package/dist/control-CtCvtwJx.d.mts.map +1 -0
- package/dist/{control-CLirKz11.d.mts → control-DfWteXy-.d.mts} +31 -45
- package/dist/control-DfWteXy-.d.mts.map +1 -0
- package/dist/control-V3kPfMTR.mjs +61 -0
- package/dist/control-V3kPfMTR.mjs.map +1 -0
- package/dist/{control-tables-Dua-YcJL.d.mts → control-tables-DKXLHvMU.d.mts} +2 -2
- package/dist/control-tables-DKXLHvMU.d.mts.map +1 -0
- package/dist/{control-tables-D_o8dKRB-BXi43noL.mjs → control-tables-D_o8dKRB-n_QqsXcm.mjs} +2 -2
- package/dist/control-tables-D_o8dKRB-n_QqsXcm.mjs.map +1 -0
- package/dist/data-type-entries-DaT4D2GV-DE0V_N6k.mjs +120 -0
- package/dist/data-type-entries-DaT4D2GV-DE0V_N6k.mjs.map +1 -0
- package/dist/data-types-C1nzwKt7.d.mts +68 -0
- package/dist/data-types-C1nzwKt7.d.mts.map +1 -0
- package/dist/data-types-Djvapurb-BR-Y4NWN.mjs +239 -0
- package/dist/data-types-Djvapurb-BR-Y4NWN.mjs.map +1 -0
- package/dist/date-time-now-generators-DUb3x91B-D0keGG59.mjs +64 -0
- package/dist/date-time-now-generators-DUb3x91B-D0keGG59.mjs.map +1 -0
- package/dist/datetime-text-DPjoF6HJ-se0mLEbc.mjs +32 -0
- package/dist/datetime-text-DPjoF6HJ-se0mLEbc.mjs.map +1 -0
- package/dist/ddl-31OBcTco.d.mts +1 -0
- package/dist/{ddl-CXduXyOT-nlDP6DGx.mjs → ddl-CgkyurGo-B2o4mSIT.mjs} +45 -8
- package/dist/ddl-CgkyurGo-B2o4mSIT.mjs.map +1 -0
- package/dist/default-normalizer-BANdMVGr-BiUHyBX1.mjs +124 -0
- package/dist/default-normalizer-BANdMVGr-BiUHyBX1.mjs.map +1 -0
- package/dist/default-normalizer-CtNsZNRZ.d.mts +25 -0
- package/dist/default-normalizer-CtNsZNRZ.d.mts.map +1 -0
- package/dist/descriptor-meta-CafFMPhN-x3YQXDSX.mjs +26 -0
- package/dist/descriptor-meta-CafFMPhN-x3YQXDSX.mjs.map +1 -0
- package/dist/descriptor-meta-CkiPlqDS-n3hDP01X.mjs +137 -0
- package/dist/descriptor-meta-CkiPlqDS-n3hDP01X.mjs.map +1 -0
- package/dist/descriptor-meta-DEr1ALec-DvT6glGq.mjs +385 -0
- package/dist/descriptor-meta-DEr1ALec-DvT6glGq.mjs.map +1 -0
- package/dist/driver.d.mts +2 -2
- package/dist/driver.mjs +1 -1
- package/dist/driver__control.d.mts +1 -1
- package/dist/driver__control.mjs +1 -1
- package/dist/driver__runtime.d.mts +1 -1
- package/dist/driver__runtime.mjs +58 -20
- package/dist/driver__runtime.mjs.map +1 -1
- package/dist/errors-DxbvEzQp-CeTjoGtL.mjs +146 -0
- package/dist/errors-DxbvEzQp-CeTjoGtL.mjs.map +1 -0
- package/dist/{migration-DOKPHtxn.mjs → migration-BYRMZiPU.mjs} +6 -5
- package/dist/migration-BYRMZiPU.mjs.map +1 -0
- package/dist/{migration-uylRe5MP.d.mts → migration-Dekon_QC.d.mts} +6 -5
- package/dist/migration-Dekon_QC.d.mts.map +1 -0
- package/dist/{nodes-D8EC1yCx-rpfpuJ4T.d.mts → nodes-D8EC1yCx-BS-fKla6.d.mts} +2 -2
- package/dist/nodes-D8EC1yCx-BS-fKla6.d.mts.map +1 -0
- package/dist/{nodes-DUZSdX86-BBEEaxXY.mjs → nodes-DUZSdX86-DWyLY3OW.mjs} +2 -2
- package/dist/nodes-DUZSdX86-DWyLY3OW.mjs.map +1 -0
- package/dist/op-factory-call-DjbjegGT-DsQBI5Ll.mjs +2044 -0
- package/dist/op-factory-call-DjbjegGT-DsQBI5Ll.mjs.map +1 -0
- package/dist/op-factory-call-gQ5ddSys.d.mts +327 -0
- package/dist/op-factory-call-gQ5ddSys.d.mts.map +1 -0
- package/dist/pack-CHESErO8.d.mts +1477 -0
- package/dist/pack-CHESErO8.d.mts.map +1 -0
- package/dist/{planner-Bxdi7jZF.d.mts → planner-Bu5XBkHm.d.mts} +21 -10
- package/dist/planner-Bu5XBkHm.d.mts.map +1 -0
- package/dist/planner-C1OMkqV5-BAv-WPw6.mjs +497 -0
- package/dist/planner-C1OMkqV5-BAv-WPw6.mjs.map +1 -0
- package/dist/{planner-produced-sqlite-migration-BuJysRxx-CaDUbNVx.d.mts → planner-produced-sqlite-migration-CMjzJW5V-dVv0SjJm.d.mts} +5 -6
- package/dist/planner-produced-sqlite-migration-CMjzJW5V-dVv0SjJm.d.mts.map +1 -0
- package/dist/{planner-produced-sqlite-migration-C9uVDKrJ-CWbxSANn.mjs → planner-produced-sqlite-migration-CrbMD1ch-O7Mh_aKY.mjs} +13 -23
- package/dist/planner-produced-sqlite-migration-CrbMD1ch-O7Mh_aKY.mjs.map +1 -0
- package/dist/planner-produced-sqlite-migration-DtytlAAY.d.mts +1 -0
- package/dist/{planner-target-details-xR6UfIcz-CMahymzq.d.mts → planner-target-details-B-qtfkmj-DIGpv7YQ.d.mts} +2 -3
- package/dist/planner-target-details-B-qtfkmj-DIGpv7YQ.d.mts.map +1 -0
- package/dist/{planner-target-details-CIQ789Gc-C5U4yVY9.mjs → planner-target-details-Daaeo8s9-BGAN4JVc.mjs} +2 -4
- package/dist/planner-target-details-Daaeo8s9-BGAN4JVc.mjs.map +1 -0
- package/dist/render-ops-CQ-Kf4P0-DDUU4OFY.mjs +34 -0
- package/dist/render-ops-CQ-Kf4P0-DDUU4OFY.mjs.map +1 -0
- package/dist/{render-ops-B10yqmdG.d.mts → render-ops-Wlf_Pawh.d.mts} +3 -3
- package/dist/render-ops-Wlf_Pawh.d.mts.map +1 -0
- package/dist/require-temporal-CHWqSDF3-ElFTiAh6.mjs +16 -0
- package/dist/require-temporal-CHWqSDF3-ElFTiAh6.mjs.map +1 -0
- package/dist/{runtime-B1coahKC.d.mts → runtime-BvMPuBrJ.d.mts} +3 -3
- package/dist/runtime-BvMPuBrJ.d.mts.map +1 -0
- package/dist/runtime-C43fN_cJ.mjs +32 -0
- package/dist/runtime-C43fN_cJ.mjs.map +1 -0
- package/dist/{runtime-C5J9fusd.d.mts → runtime-CVBk_GlD.d.mts} +4 -4
- package/dist/runtime-CVBk_GlD.d.mts.map +1 -0
- package/dist/runtime-DqzT70C4.d.mts +67 -0
- package/dist/runtime-DqzT70C4.d.mts.map +1 -0
- package/dist/sql-renderer-DlZKtvVf.d.mts +1 -0
- package/dist/{sql-utils-0SJZOd7Q.d.mts → sql-utils-BqHka8P6.d.mts} +2 -2
- package/dist/sql-utils-BqHka8P6.d.mts.map +1 -0
- package/dist/{sql-utils-C2O4zVkP-Dz3Hb85I.mjs → sql-utils-CHBxMmv--Dl7wl7n3.mjs} +31 -4
- package/dist/sql-utils-CHBxMmv--Dl7wl7n3.mjs.map +1 -0
- package/dist/{sqlite-contract-view-BpNMaU2m-COMDaGaq.d.mts → sqlite-contract-view-BDw8T5Cp-BfFajhe4.d.mts} +5 -4
- package/dist/sqlite-contract-view-BDw8T5Cp-BfFajhe4.d.mts.map +1 -0
- package/dist/sqlite-contract-view-c-qO_pKt-DOCoqwrD.mjs +51 -0
- package/dist/sqlite-contract-view-c-qO_pKt-DOCoqwrD.mjs.map +1 -0
- package/dist/sqlite-migration-C_9TPlLD-DtKN8bi9.d.mts +227 -0
- package/dist/sqlite-migration-C_9TPlLD-DtKN8bi9.d.mts.map +1 -0
- package/dist/sqlite-migration-Cmzykasm--GxBXXny.mjs +1363 -0
- package/dist/sqlite-migration-Cmzykasm--GxBXXny.mjs.map +1 -0
- package/dist/{sqlite-contract-view-BYR10usg-BteDAUZr.mjs → sqlite-unbound-database-CfLXSiVo-Dy5VBXGz.mjs} +6 -47
- package/dist/sqlite-unbound-database-CfLXSiVo-Dy5VBXGz.mjs.map +1 -0
- package/dist/{shared-BYAX0FaQ--VvRXVRC.d.mts → tables-BY3u6rl_-Coqqy4JK.d.mts} +46 -10
- package/dist/tables-BY3u6rl_-Coqqy4JK.d.mts.map +1 -0
- package/dist/target.d.mts +30 -29
- package/dist/target.mjs +27 -20
- package/dist/target__aggregates.d.mts +1 -1
- package/dist/target__aggregates.mjs +1 -1
- package/dist/target__codec-descriptor.d.mts +2 -2
- package/dist/target__codec-descriptor.mjs +1 -1
- package/dist/target__codec-ids.d.mts +3 -3
- package/dist/target__codec-ids.mjs +2 -2
- package/dist/target__codec-types.d.mts +3 -3
- package/dist/target__codecs.d.mts +3 -3
- package/dist/target__codecs.mjs +4 -2
- package/dist/target__contract-free.d.mts +1 -1
- package/dist/target__contract-free.mjs +2 -2
- package/dist/target__control-tables.d.mts +1 -1
- package/dist/target__control-tables.mjs +1 -1
- package/dist/target__control.d.mts +3 -3
- package/dist/target__control.mjs +332 -114
- package/dist/target__control.mjs.map +1 -1
- package/dist/target__data-types.d.mts +2 -0
- package/dist/target__data-types.mjs +3 -0
- package/dist/target__ddl.d.mts +2 -2
- package/dist/target__ddl.mjs +1 -1
- package/dist/target__default-normalizer.d.mts +2 -2
- package/dist/target__default-normalizer.mjs +2 -2
- package/dist/target__migration.d.mts +3 -3
- package/dist/target__migration.mjs +3 -3
- package/dist/target__op-factory-call.d.mts +2 -2
- package/dist/target__op-factory-call.mjs +2 -2
- package/dist/target__pack.d.mts +1 -1
- package/dist/target__pack.mjs +1 -1
- package/dist/target__planner-produced-sqlite-migration.d.mts +2 -2
- package/dist/target__planner-produced-sqlite-migration.mjs +1 -1
- package/dist/target__planner-target-details.d.mts +1 -1
- package/dist/target__planner-target-details.mjs +1 -1
- package/dist/target__planner.d.mts +1 -1
- package/dist/target__planner.mjs +1 -1
- package/dist/target__render-ops.d.mts +1 -1
- package/dist/target__render-ops.mjs +1 -1
- package/dist/target__runtime.d.mts +3 -3
- package/dist/target__runtime.mjs +4 -17
- package/dist/target__sql-utils.d.mts +1 -1
- package/dist/target__sql-utils.mjs +1 -1
- package/dist/target__types.d.mts +2 -0
- package/dist/target__types.mjs +2 -0
- package/dist/{control--wMueaTg.d.mts → types-COqCbSev.d.mts} +3 -8
- package/dist/types-COqCbSev.d.mts.map +1 -0
- package/dist/types-CexPOm8x.d.mts +2 -0
- package/dist/{types-C5FSREvo-CwUlKK34.d.mts → types-RJMd2PlL-BTGAJrBQ.d.mts} +5 -7
- package/dist/types-RJMd2PlL-BTGAJrBQ.d.mts.map +1 -0
- package/package.json +23 -14
- package/dist/adapter-D7zw14p5.d.mts +0 -2
- package/dist/adapter-DEYUC-KO-DO_abhIq.d.mts.map +0 -1
- package/dist/adapter-jwxys1MM-CmUELyBs.mjs.map +0 -1
- package/dist/aggregates-BGuKJwfI.d.mts +0 -10
- package/dist/aggregates-BGuKJwfI.d.mts.map +0 -1
- package/dist/aggregates-DWyPO7t6.mjs.map +0 -1
- package/dist/codec-descriptor-B9ru99aI-DTkdKFU5.mjs.map +0 -1
- package/dist/codec-descriptor-BcgD9f3L-yDi5nh_k.d.mts +0 -31
- package/dist/codec-descriptor-BcgD9f3L-yDi5nh_k.d.mts.map +0 -1
- package/dist/codec-descriptor-rFuZ9DzY-CKRIRxah.d.mts +0 -1
- package/dist/codec-descriptor-vwfD3BMy.d.mts +0 -2
- package/dist/codec-ids-7WqtUuda.d.mts +0 -1
- package/dist/codec-ids-CzeDyMWW-BZAcI50I.d.mts +0 -14
- package/dist/codec-ids-CzeDyMWW-BZAcI50I.d.mts.map +0 -1
- package/dist/codec-ids-KMliSCRp-BhTbmbGr.mjs +0 -14
- package/dist/codec-ids-KMliSCRp-BhTbmbGr.mjs.map +0 -1
- package/dist/codec-types-B-TDcvQc.d.mts +0 -1
- package/dist/codec-types-CS0bD1kX.d.mts +0 -2
- package/dist/codec-types-D7uWRvQ1-DPnvquS8.d.mts +0 -25
- package/dist/codec-types-D7uWRvQ1-DPnvquS8.d.mts.map +0 -1
- package/dist/codecs-BDdR6FbY.mjs +0 -504
- package/dist/codecs-BDdR6FbY.mjs.map +0 -1
- package/dist/codecs-BQWqLgCl-CdB8t7HI.d.mts +0 -193
- package/dist/codecs-BQWqLgCl-CdB8t7HI.d.mts.map +0 -1
- package/dist/codecs-BTv6fRXv.d.mts +0 -1
- package/dist/column-types-NVxgsjFA.mjs +0 -34
- package/dist/column-types-NVxgsjFA.mjs.map +0 -1
- package/dist/column-types-iWGuW-0W.d.mts +0 -33
- package/dist/column-types-iWGuW-0W.d.mts.map +0 -1
- package/dist/contract-free-CCLAXZV2.d.mts.map +0 -1
- package/dist/contract-free-D5cZrgNl.mjs.map +0 -1
- package/dist/control--wMueaTg.d.mts.map +0 -1
- package/dist/control-B16T9OoX.mjs +0 -51
- package/dist/control-B16T9OoX.mjs.map +0 -1
- package/dist/control-CLirKz11.d.mts.map +0 -1
- package/dist/control-D9vMRRgU.d.mts.map +0 -1
- package/dist/control-tables-D_o8dKRB-BXi43noL.mjs.map +0 -1
- package/dist/control-tables-Dua-YcJL.d.mts.map +0 -1
- package/dist/ddl-CXduXyOT-nlDP6DGx.mjs.map +0 -1
- package/dist/ddl-CfSqNT0M.d.mts +0 -1
- package/dist/default-normalizer-B9V7TY5u.d.mts +0 -7
- package/dist/default-normalizer-B9V7TY5u.d.mts.map +0 -1
- package/dist/default-normalizer-DuoHj9-O-DsK7lJZn.mjs +0 -69
- package/dist/default-normalizer-DuoHj9-O-DsK7lJZn.mjs.map +0 -1
- package/dist/descriptor-meta-C0sCVHMY-1P-YUnEW.mjs +0 -34
- package/dist/descriptor-meta-C0sCVHMY-1P-YUnEW.mjs.map +0 -1
- package/dist/descriptor-meta-DjKgG4z5-D_0obUB8.mjs +0 -34
- package/dist/descriptor-meta-DjKgG4z5-D_0obUB8.mjs.map +0 -1
- package/dist/descriptor-meta-runtime-BkXK3OjD-CxZdKHCw.mjs +0 -13
- package/dist/descriptor-meta-runtime-BkXK3OjD-CxZdKHCw.mjs.map +0 -1
- package/dist/descriptor-meta-vjJkUDsn-Hz3rnAnk.mjs +0 -70
- package/dist/descriptor-meta-vjJkUDsn-Hz3rnAnk.mjs.map +0 -1
- package/dist/errors-DnR-sMHS-KkMLIP2U.mjs +0 -38
- package/dist/errors-DnR-sMHS-KkMLIP2U.mjs.map +0 -1
- package/dist/migration-DOKPHtxn.mjs.map +0 -1
- package/dist/migration-uylRe5MP.d.mts.map +0 -1
- package/dist/native-type-normalizer-CO2wKGL6.d.mts +0 -12
- package/dist/native-type-normalizer-CO2wKGL6.d.mts.map +0 -1
- package/dist/native-type-normalizer-GpQMEyN5.mjs +0 -14
- package/dist/native-type-normalizer-GpQMEyN5.mjs.map +0 -1
- package/dist/nodes-D8EC1yCx-rpfpuJ4T.d.mts.map +0 -1
- package/dist/nodes-DUZSdX86-BBEEaxXY.mjs.map +0 -1
- package/dist/op-factory-call-DoHN7Q7L.d.mts +0 -161
- package/dist/op-factory-call-DoHN7Q7L.d.mts.map +0 -1
- package/dist/op-factory-call-gc26GqyA-Db5Fasef.mjs +0 -829
- package/dist/op-factory-call-gc26GqyA-Db5Fasef.mjs.map +0 -1
- package/dist/pack-Cn0GAuEa.d.mts +0 -103
- package/dist/pack-Cn0GAuEa.d.mts.map +0 -1
- package/dist/planner-Bxdi7jZF.d.mts.map +0 -1
- package/dist/planner-Cqjr2usR-4wg3FB78.mjs +0 -824
- package/dist/planner-Cqjr2usR-4wg3FB78.mjs.map +0 -1
- package/dist/planner-produced-sqlite-migration-BuJysRxx-CaDUbNVx.d.mts.map +0 -1
- package/dist/planner-produced-sqlite-migration-C9uVDKrJ-CWbxSANn.mjs.map +0 -1
- package/dist/planner-produced-sqlite-migration-uySoqJO-.d.mts +0 -1
- package/dist/planner-target-details-CIQ789Gc-C5U4yVY9.mjs.map +0 -1
- package/dist/planner-target-details-xR6UfIcz-CMahymzq.d.mts.map +0 -1
- package/dist/render-ops-B10yqmdG.d.mts.map +0 -1
- package/dist/render-ops-KxAmAz6d-W2xyvA5y.mjs +0 -27
- package/dist/render-ops-KxAmAz6d-W2xyvA5y.mjs.map +0 -1
- package/dist/runtime-B1coahKC.d.mts.map +0 -1
- package/dist/runtime-B99c4n56.d.mts +0 -28
- package/dist/runtime-B99c4n56.d.mts.map +0 -1
- package/dist/runtime-C5J9fusd.d.mts.map +0 -1
- package/dist/shared-BYAX0FaQ--VvRXVRC.d.mts.map +0 -1
- package/dist/sql-renderer-KX6hn_tg.d.mts +0 -1
- package/dist/sql-utils-0SJZOd7Q.d.mts.map +0 -1
- package/dist/sql-utils-C2O4zVkP-Dz3Hb85I.mjs.map +0 -1
- package/dist/sqlite-contract-view-BYR10usg-BteDAUZr.mjs.map +0 -1
- package/dist/sqlite-contract-view-BpNMaU2m-COMDaGaq.d.mts.map +0 -1
- package/dist/sqlite-migration-CjMkH4Id-c6dM9w61.mjs +0 -94
- package/dist/sqlite-migration-CjMkH4Id-c6dM9w61.mjs.map +0 -1
- package/dist/sqlite-migration-o23JHwzY-CwNJcqwl.d.mts +0 -105
- package/dist/sqlite-migration-o23JHwzY-CwNJcqwl.d.mts.map +0 -1
- package/dist/target__native-type-normalizer.d.mts +0 -2
- package/dist/target__native-type-normalizer.mjs +0 -2
- package/dist/target__runtime.mjs.map +0 -1
- package/dist/types-B7e2QVEx.d.mts +0 -1
- package/dist/types-C5FSREvo-CwUlKK34.d.mts.map +0 -1
package/dist/target__control.mjs
CHANGED
|
@@ -1,18 +1,40 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { r as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { l as sqliteError } from "./errors-DxbvEzQp-CeTjoGtL.mjs";
|
|
2
|
+
import { n as sqliteTargetDescriptorMeta, t as sqliteScalarTypeConstructors } from "./descriptor-meta-DEr1ALec-DvT6glGq.mjs";
|
|
3
|
+
import { r as quoteIdentifier } from "./sql-utils-CHBxMmv--Dl7wl7n3.mjs";
|
|
4
|
+
import { t as SqliteContractSerializer } from "./sqlite-contract-view-c-qO_pKt-DOCoqwrD.mjs";
|
|
5
|
+
import { O as rebuiltTableName, T as holdingStoredValue, n as ConversionCopyJson, w as conversionCopyOf, x as affinityStorageClasses } from "./op-factory-call-DjbjegGT-DsQBI5Ll.mjs";
|
|
6
|
+
import { b as verifySqliteDatabaseSchema, h as sqliteContractToSchema, o as diffSqliteSchema } from "./sqlite-migration-Cmzykasm--GxBXXny.mjs";
|
|
7
|
+
import { i as sqliteStoredValueCallClasses, n as createSqliteMigrationPlanner, r as sqliteMarkedRemoval } from "./planner-C1OMkqV5-BAv-WPw6.mjs";
|
|
6
8
|
import { ifDefined } from "@prisma/orm-framework/utils/defined";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
9
|
+
import { InternalError } from "@prisma/orm-framework/utils/internal-error";
|
|
10
|
+
import { type } from "arktype";
|
|
11
|
+
import { setFallbackTemporal } from "@prisma/orm-framework/type-implementations/temporal";
|
|
12
|
+
import { APP_SPACE_ID, failedPostcheckWhy, failedPrecheckWhy, schemaCheckWhy, withDatabaseUnchanged, withFailingSpace } from "@prisma/orm-framework/components/control";
|
|
11
13
|
import { SqlStorage } from "@prisma/orm-family-sql/contract/types";
|
|
12
14
|
import { SqlSchemaVerifierBase } from "@prisma/orm-family-sql/family/ir";
|
|
15
|
+
import { checkDatabasePoliciesHeld, convertedColumnOf, createSqlOperationsReader, fieldOfColumn, keepRowsEdit, removalsOfMigration, requiredColumnsOfMigration, rowsHoldingValueFailure, rowsHoldingValueOf, rowsWithoutValueFailure, runnerFailure, runnerSuccess, sqlTypeLookupsOf, unconvertedFieldOf } from "@prisma/orm-family-sql/family/control";
|
|
16
|
+
import { relationalNodeEntityKind, relationalNodeGranularity } from "@prisma/orm-family-sql/schema-ir/types";
|
|
13
17
|
import { notOk, ok, okVoid } from "@prisma/orm-framework/utils/result";
|
|
14
|
-
import {
|
|
15
|
-
|
|
18
|
+
import { Temporal } from "temporal-polyfill/full/implementation";
|
|
19
|
+
import { SqlConnectionError, SqlQueryError } from "@prisma/orm-family-sql/errors";
|
|
20
|
+
//#region ../../../3-targets/sqlite/1-target/dist/control.mjs
|
|
21
|
+
const SqliteTargetDetailsJson = type({
|
|
22
|
+
"+": "reject",
|
|
23
|
+
objectType: "'table' | 'column' | 'primaryKey' | 'unique' | 'index' | 'foreignKey'",
|
|
24
|
+
name: "string",
|
|
25
|
+
"table?": "string"
|
|
26
|
+
});
|
|
27
|
+
/** Releases up to 8.0.0-rc.20 wrote the schema `main` into every operation's details. */
|
|
28
|
+
function toCurrentTargetDetails(details) {
|
|
29
|
+
const { schema, ...current } = details;
|
|
30
|
+
return schema === "main" ? current : details;
|
|
31
|
+
}
|
|
32
|
+
const readSqliteOperations = createSqlOperationsReader({
|
|
33
|
+
targetDetails: SqliteTargetDetailsJson,
|
|
34
|
+
toCurrentTargetDetails,
|
|
35
|
+
stepMeta: type({ "conversionCopy?": ConversionCopyJson })
|
|
36
|
+
});
|
|
37
|
+
const NOT_NULL_VIOLATION_SQLSTATE = "23502";
|
|
16
38
|
function createSqliteMigrationRunner(family) {
|
|
17
39
|
return new SqliteMigrationRunner(family);
|
|
18
40
|
}
|
|
@@ -34,7 +56,10 @@ var SqliteMigrationRunner = class {
|
|
|
34
56
|
planSpaceId: options.plan.spaceId
|
|
35
57
|
} });
|
|
36
58
|
const space = options.plan.spaceId;
|
|
37
|
-
const planOps =
|
|
59
|
+
const planOps = readSqliteOperations(await Promise.all(options.plan.operations), {
|
|
60
|
+
space,
|
|
61
|
+
migrations: options.migrationEdges
|
|
62
|
+
});
|
|
38
63
|
const destinationCheck = this.ensurePlanMatchesDestinationContract(options.plan.destination, options.destinationContract);
|
|
39
64
|
if (!destinationCheck.ok) return destinationCheck;
|
|
40
65
|
const policyCheck = this.enforcePolicyCompatibility(options.policy, planOps);
|
|
@@ -70,22 +95,23 @@ var SqliteMigrationRunner = class {
|
|
|
70
95
|
contract: options.destinationContract,
|
|
71
96
|
actualSchema: schemaNode,
|
|
72
97
|
strict: options.strictVerification ?? true,
|
|
73
|
-
typeMetadataRegistry: this.family.typeMetadataRegistry,
|
|
74
98
|
frameworkComponents: options.frameworkComponents
|
|
75
99
|
});
|
|
76
100
|
if (!schemaVerifyResult.ok) return runnerFailure("MIGRATION.SCHEMA_VERIFY_FAILED", schemaVerifyResult.summary, {
|
|
77
|
-
why:
|
|
78
|
-
meta: {
|
|
101
|
+
why: schemaCheckWhy(schemaVerifyResult.schema.issues),
|
|
102
|
+
meta: { schemaIssues: schemaVerifyResult.schema.issues }
|
|
79
103
|
});
|
|
80
104
|
}
|
|
81
105
|
const incomingInvariants = options.plan.providedInvariants;
|
|
82
106
|
const existingInvariants = new Set(existingMarker?.invariants ?? []);
|
|
83
107
|
const incomingIsSubsetOfExisting = incomingInvariants.every((id) => existingInvariants.has(id));
|
|
84
|
-
|
|
108
|
+
const isSelfEdgeNoOp = isSelfEdge && operationsExecuted === 0 && incomingIsSubsetOfExisting;
|
|
109
|
+
if (!isSelfEdgeNoOp || options.databasePolicies !== void 0) {
|
|
85
110
|
const markerResult = await this.upsertMarker(driver, options, existingMarker, space);
|
|
86
111
|
if (!markerResult.ok) return markerResult;
|
|
87
|
-
await this.recordLedgerEntries(driver, options, executedOperations);
|
|
88
112
|
}
|
|
113
|
+
const recordsPoliciesOnly = options.databasePolicies !== void 0 && operationsExecuted === 0 && markerAtDestination && incomingIsSubsetOfExisting;
|
|
114
|
+
if (!isSelfEdgeNoOp && !recordsPoliciesOnly) await this.recordLedgerEntries(driver, options, executedOperations);
|
|
89
115
|
return runnerSuccess({
|
|
90
116
|
operationsPlanned: planOps.length,
|
|
91
117
|
operationsExecuted
|
|
@@ -97,45 +123,66 @@ var SqliteMigrationRunner = class {
|
|
|
97
123
|
if (perSpaceOptions.length === 0) return ok({ perSpaceResults: [] });
|
|
98
124
|
const fkWasEnabled = await this.readForeignKeysEnabled(driver);
|
|
99
125
|
if (fkWasEnabled) await driver.query("PRAGMA foreign_keys = OFF");
|
|
126
|
+
let result;
|
|
100
127
|
try {
|
|
101
|
-
await this.
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
let lastProcessedSpace;
|
|
106
|
-
for (const spaceOptions of perSpaceOptions) {
|
|
107
|
-
const space = spaceOptions.space ?? spaceOptions.plan.spaceId;
|
|
108
|
-
const result = await this.executeOnConnection({
|
|
109
|
-
...spaceOptions,
|
|
110
|
-
driver,
|
|
111
|
-
space
|
|
112
|
-
});
|
|
113
|
-
if (!result.ok) return notOk({
|
|
114
|
-
...result.failure,
|
|
115
|
-
failingSpace: space
|
|
116
|
-
});
|
|
117
|
-
perSpaceResults.push({
|
|
118
|
-
space,
|
|
119
|
-
value: result.value
|
|
120
|
-
});
|
|
121
|
-
lastProcessedSpace = space;
|
|
122
|
-
}
|
|
123
|
-
if (fkWasEnabled) {
|
|
124
|
-
const fkIntegrityCheck = await this.verifyForeignKeyIntegrity(driver);
|
|
125
|
-
if (!fkIntegrityCheck.ok) return notOk({
|
|
126
|
-
...fkIntegrityCheck.failure,
|
|
127
|
-
failingSpace: lastProcessedSpace ?? APP_SPACE_ID
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
await this.commitTransaction(driver);
|
|
131
|
-
committed = true;
|
|
132
|
-
return ok({ perSpaceResults });
|
|
133
|
-
} finally {
|
|
134
|
-
if (!committed) await this.rollbackTransaction(driver);
|
|
135
|
-
}
|
|
136
|
-
} finally {
|
|
137
|
-
if (fkWasEnabled) await driver.query("PRAGMA foreign_keys = ON");
|
|
128
|
+
result = await this.executeInTransaction(driver, perSpaceOptions, fkWasEnabled, options.expectedDatabasePolicies);
|
|
129
|
+
} catch (error) {
|
|
130
|
+
if (fkWasEnabled) await this.afterFailure(driver.query("PRAGMA foreign_keys = ON"));
|
|
131
|
+
throw error;
|
|
138
132
|
}
|
|
133
|
+
if (fkWasEnabled) {
|
|
134
|
+
const restore = driver.query("PRAGMA foreign_keys = ON");
|
|
135
|
+
await (result.ok ? restore : this.afterFailure(restore));
|
|
136
|
+
}
|
|
137
|
+
return result;
|
|
138
|
+
}
|
|
139
|
+
async executeInTransaction(driver, perSpaceOptions, fkWasEnabled, expectedDatabasePolicies) {
|
|
140
|
+
await this.beginExclusiveTransaction(driver);
|
|
141
|
+
let result;
|
|
142
|
+
try {
|
|
143
|
+
const policiesCheck = expectedDatabasePolicies === void 0 ? okVoid() : await checkDatabasePoliciesHeld(this.family, driver, expectedDatabasePolicies);
|
|
144
|
+
result = policiesCheck.ok ? await this.executeSpaces(driver, perSpaceOptions, fkWasEnabled) : policiesCheck;
|
|
145
|
+
} catch (error) {
|
|
146
|
+
await this.afterFailure(this.rollbackTransaction(driver));
|
|
147
|
+
throw error;
|
|
148
|
+
}
|
|
149
|
+
if (!result.ok) {
|
|
150
|
+
await this.afterFailure(this.rollbackTransaction(driver));
|
|
151
|
+
return notOk(withDatabaseUnchanged(result.failure, true));
|
|
152
|
+
}
|
|
153
|
+
try {
|
|
154
|
+
await this.commitTransaction(driver);
|
|
155
|
+
} catch (error) {
|
|
156
|
+
await this.afterFailure(this.rollbackTransaction(driver));
|
|
157
|
+
throw error;
|
|
158
|
+
}
|
|
159
|
+
return result;
|
|
160
|
+
}
|
|
161
|
+
async afterFailure(cleanup) {
|
|
162
|
+
await cleanup.catch(() => void 0);
|
|
163
|
+
}
|
|
164
|
+
async executeSpaces(driver, perSpaceOptions, fkWasEnabled) {
|
|
165
|
+
const perSpaceResults = [];
|
|
166
|
+
let lastProcessedSpace;
|
|
167
|
+
for (const spaceOptions of perSpaceOptions) {
|
|
168
|
+
const space = spaceOptions.space ?? spaceOptions.plan.spaceId;
|
|
169
|
+
const result = await this.executeOnConnection({
|
|
170
|
+
...spaceOptions,
|
|
171
|
+
driver,
|
|
172
|
+
space
|
|
173
|
+
});
|
|
174
|
+
if (!result.ok) return notOk(withFailingSpace(result.failure, space));
|
|
175
|
+
perSpaceResults.push({
|
|
176
|
+
space,
|
|
177
|
+
value: result.value
|
|
178
|
+
});
|
|
179
|
+
lastProcessedSpace = space;
|
|
180
|
+
}
|
|
181
|
+
if (fkWasEnabled) {
|
|
182
|
+
const fkIntegrityCheck = await this.verifyForeignKeyIntegrity(driver);
|
|
183
|
+
if (!fkIntegrityCheck.ok) return notOk(withFailingSpace(fkIntegrityCheck.failure, lastProcessedSpace ?? APP_SPACE_ID));
|
|
184
|
+
}
|
|
185
|
+
return ok({ perSpaceResults });
|
|
139
186
|
}
|
|
140
187
|
async readForeignKeysEnabled(driver) {
|
|
141
188
|
return (await driver.query("PRAGMA foreign_keys")).rows[0]?.foreign_keys === 1;
|
|
@@ -144,7 +191,7 @@ var SqliteMigrationRunner = class {
|
|
|
144
191
|
const result = await driver.query("PRAGMA foreign_key_check");
|
|
145
192
|
if (result.rows.length === 0) return okVoid();
|
|
146
193
|
return runnerFailure("MIGRATION.FOREIGN_KEY_VIOLATION", `Foreign key integrity check failed after migration: ${result.rows.length} violation(s).`, {
|
|
147
|
-
why:
|
|
194
|
+
why: `PRAGMA foreign_key_check reported violations after the migration ran with foreign keys off: ${violatedReferences(result.rows)} rows that a recreate-table or deleteRows operation removed, and no cascade ran. Delete or change the referencing rows first.`,
|
|
148
195
|
meta: { violations: result.rows }
|
|
149
196
|
});
|
|
150
197
|
}
|
|
@@ -165,13 +212,28 @@ var SqliteMigrationRunner = class {
|
|
|
165
212
|
}
|
|
166
213
|
}
|
|
167
214
|
if (runPrechecks) {
|
|
168
|
-
const precheckResult = await this.runExpectationSteps(driver, operation.precheck, operation, "precheck"
|
|
215
|
+
const precheckResult = await this.runExpectationSteps(driver, operation.precheck, operation, "precheck", {
|
|
216
|
+
contract: options.destinationContract,
|
|
217
|
+
operationIndex: ops.indexOf(operation),
|
|
218
|
+
operations: ops,
|
|
219
|
+
edges: options.migrationEdges
|
|
220
|
+
});
|
|
169
221
|
if (!precheckResult.ok) return precheckResult;
|
|
170
222
|
}
|
|
171
|
-
const executeResult = await this.runExecuteSteps(driver, operation.execute, operation
|
|
223
|
+
const executeResult = await this.runExecuteSteps(driver, operation.execute, operation, {
|
|
224
|
+
contract: options.destinationContract,
|
|
225
|
+
operationIndex: ops.indexOf(operation),
|
|
226
|
+
operations: ops,
|
|
227
|
+
edges: options.migrationEdges
|
|
228
|
+
});
|
|
172
229
|
if (!executeResult.ok) return executeResult;
|
|
173
230
|
if (runPostchecks) {
|
|
174
|
-
const postcheckResult = await this.runExpectationSteps(driver, operation.postcheck, operation, "postcheck"
|
|
231
|
+
const postcheckResult = await this.runExpectationSteps(driver, operation.postcheck, operation, "postcheck", {
|
|
232
|
+
contract: options.destinationContract,
|
|
233
|
+
operationIndex: ops.indexOf(operation),
|
|
234
|
+
operations: ops,
|
|
235
|
+
edges: options.migrationEdges
|
|
236
|
+
});
|
|
175
237
|
if (!postcheckResult.ok) return postcheckResult;
|
|
176
238
|
}
|
|
177
239
|
executedOperations.push(operation);
|
|
@@ -186,49 +248,171 @@ var SqliteMigrationRunner = class {
|
|
|
186
248
|
});
|
|
187
249
|
}
|
|
188
250
|
async ensureControlTables(driver, contract) {
|
|
189
|
-
const legacyDetection = await this.detectLegacyMarkerShape(driver);
|
|
190
|
-
if (!legacyDetection.ok) return legacyDetection;
|
|
191
251
|
const lowererContext = { contract };
|
|
192
252
|
for (const query of this.family.bootstrapControlTableQueries()) await this.executeStatement(driver, await this.family.lowerAst(query, lowererContext));
|
|
193
253
|
return okVoid();
|
|
194
254
|
}
|
|
195
|
-
async
|
|
196
|
-
const tableInfo = await driver.query(`PRAGMA table_info("${MARKER_TABLE_NAME}")`);
|
|
197
|
-
if (tableInfo.rows.length === 0) return okVoid();
|
|
198
|
-
const columns = new Set(tableInfo.rows.map((row) => row.name));
|
|
199
|
-
if (columns.has("space")) return okVoid();
|
|
200
|
-
return runnerFailure("MIGRATION.LEGACY_MARKER_SHAPE", `Legacy marker-table shape detected on ${MARKER_TABLE_NAME} (no \`space\` column). Prisma 8 is in pre-1.0; the previous transitional auto-migration to the per-space-row schema has been removed. Drop \`${MARKER_TABLE_NAME}\` and re-run \`dbInit\` to reinitialise from a clean baseline.`, { meta: {
|
|
201
|
-
table: MARKER_TABLE_NAME,
|
|
202
|
-
columns: [...columns].sort()
|
|
203
|
-
} });
|
|
204
|
-
}
|
|
205
|
-
async runExpectationSteps(driver, steps, operation, phase) {
|
|
255
|
+
async runExpectationSteps(driver, steps, operation, phase, plan) {
|
|
206
256
|
for (const step of steps) {
|
|
207
257
|
const result = await driver.query(step.sql, step.params ?? []);
|
|
208
|
-
if (!this.stepResultIsTrue(result.rows))
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
258
|
+
if (!this.stepResultIsTrue(result.rows)) {
|
|
259
|
+
const code = phase === "precheck" ? "MIGRATION.PRECHECK_FAILED" : "MIGRATION.POSTCHECK_FAILED";
|
|
260
|
+
const field = plan === void 0 ? void 0 : unconvertedFieldOf(step, plan.contract);
|
|
261
|
+
const converted = convertedColumnOf(step);
|
|
262
|
+
const failedCheck = {
|
|
263
|
+
operationId: operation.id,
|
|
264
|
+
phase,
|
|
265
|
+
description: step.description,
|
|
266
|
+
...ifDefined("expectation", step.expectation)
|
|
267
|
+
};
|
|
268
|
+
const holding = phase === "precheck" && plan !== void 0 ? await this.rowsHoldingValue(driver, step, operation, plan) : void 0;
|
|
269
|
+
if (holding !== void 0) return runnerFailure(code, holding.summary, {
|
|
270
|
+
why: `Operation ${operation.id} failed during ${phase}: ${step.description}`,
|
|
271
|
+
meta: {
|
|
272
|
+
failedCheck,
|
|
273
|
+
rowsHoldingValue: holding.reports
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
const unconverted = converted === void 0 ? void 0 : await this.unconvertedValueText(driver, converted);
|
|
277
|
+
return runnerFailure(code, `Operation ${operation.id} failed during ${phase}: ${step.description}`, {
|
|
278
|
+
...ifDefined("why", unconverted ?? (phase === "precheck" ? failedPrecheckWhy(failedCheck) : failedPostcheckWhy(failedCheck))),
|
|
279
|
+
meta: {
|
|
280
|
+
failedCheck,
|
|
281
|
+
...ifDefined("failedTypeChange", field === void 0 || plan === void 0 || converted === void 0 ? void 0 : converted.by === "conversion" ? {
|
|
282
|
+
field,
|
|
283
|
+
by: "conversion",
|
|
284
|
+
reason: "invalidResult",
|
|
285
|
+
operationIndex: plan.operationIndex
|
|
286
|
+
} : {
|
|
287
|
+
field,
|
|
288
|
+
by: "cast",
|
|
289
|
+
reason: "value",
|
|
290
|
+
operationIndex: plan.operationIndex
|
|
291
|
+
})
|
|
292
|
+
}
|
|
293
|
+
});
|
|
294
|
+
}
|
|
213
295
|
}
|
|
214
296
|
return okVoid();
|
|
215
297
|
}
|
|
216
|
-
|
|
298
|
+
/**
|
|
299
|
+
* Counts the rows that hold the stored value a removal check guards, as `rowsHoldingValueMeta`
|
|
300
|
+
* marks the check, then those of every other removal of its migration whose check fails. A count
|
|
301
|
+
* of the failed check that fails leaves the failure without it.
|
|
302
|
+
*/
|
|
303
|
+
rowsHoldingValue(driver, step, operation, plan) {
|
|
304
|
+
const mark = rowsHoldingValueOf(step);
|
|
305
|
+
if (mark === void 0) return Promise.resolve(void 0);
|
|
306
|
+
return rowsHoldingValueFailure({
|
|
307
|
+
failed: {
|
|
308
|
+
operation,
|
|
309
|
+
operationIndex: plan.operationIndex,
|
|
310
|
+
check: step,
|
|
311
|
+
mark
|
|
312
|
+
},
|
|
313
|
+
others: removalsOfMigration(plan.operations, plan.edges, plan.operationIndex),
|
|
314
|
+
checkFails: async ({ check }) => !this.stepResultIsTrue((await driver.query(check.sql, check.params ?? [])).rows),
|
|
315
|
+
count: async ({ mark: counted }) => {
|
|
316
|
+
const holding = holdingStoredValue(counted.column, counted.storedValue, counted.path);
|
|
317
|
+
const rows = await driver.query(`SELECT COUNT(*) AS rows FROM ${quoteIdentifier(counted.table)} WHERE ${holding.condition}`, holding.params);
|
|
318
|
+
return Number(rows.rows[0]?.rows ?? 0);
|
|
319
|
+
},
|
|
320
|
+
keepDataEdit: ({ mark: kept }) => keepRowsEdit(sqliteMarkedRemoval(kept), kept, sqliteStoredValueCallClasses)
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
/** Names the first value of a retyped column that kept a storage class its new type does not hold. */
|
|
324
|
+
async unconvertedValueText(driver, cast) {
|
|
325
|
+
const typeSql = (await driver.query("SELECT type FROM pragma_table_info(?) WHERE name = ?", [cast.table, cast.column])).rows[0]?.type;
|
|
326
|
+
if (typeSql === void 0) return void 0;
|
|
327
|
+
const column = quoteIdentifier(cast.column);
|
|
328
|
+
const classes = ["null", ...affinityStorageClasses(typeSql)];
|
|
329
|
+
const row = (await driver.query(`SELECT quote(${column}) AS value, typeof(${column}) AS storageClass FROM ${quoteIdentifier(cast.table)} WHERE typeof(${column}) NOT IN (${classes.map(() => "?").join(", ")}) LIMIT 1`, classes)).rows[0];
|
|
330
|
+
if (row === void 0) return void 0;
|
|
331
|
+
return `The value ${row.value.length > 40 ? `${row.value.slice(0, 40)}…` : row.value} of column "${cast.column}" on "${cast.table}" is still stored as ${row.storageClass}, which ${typeSql} cannot hold.`;
|
|
332
|
+
}
|
|
333
|
+
async runExecuteSteps(driver, steps, operation, plan) {
|
|
217
334
|
for (const step of steps) try {
|
|
218
335
|
await driver.query(step.sql, step.params ?? []);
|
|
219
336
|
} catch (error) {
|
|
220
337
|
const message = error instanceof Error ? error.message : String(error);
|
|
221
|
-
|
|
338
|
+
const failed = `Operation ${operation.id} failed during execution: ${step.description}`;
|
|
339
|
+
if (SqlConnectionError.is(error)) return runnerFailure("MIGRATION.EXECUTION_FAILED", failed, {
|
|
222
340
|
why: message,
|
|
223
341
|
meta: {
|
|
224
342
|
operationId: operation.id,
|
|
225
343
|
stepDescription: step.description,
|
|
226
|
-
sql: step.sql
|
|
344
|
+
sql: step.sql,
|
|
345
|
+
connectionLost: error.transient === false,
|
|
346
|
+
transient: error.transient
|
|
347
|
+
}
|
|
348
|
+
});
|
|
349
|
+
const rowsWithoutValue = await this.rowsWithoutValue(driver, error, plan);
|
|
350
|
+
const failedConversion = rowsWithoutValue === void 0 ? await this.failedConversion(driver, step, error, plan) : void 0;
|
|
351
|
+
return runnerFailure("MIGRATION.EXECUTION_FAILED", rowsWithoutValue?.summary ?? failed, {
|
|
352
|
+
why: rowsWithoutValue === void 0 ? message : `${failed}: ${message}`,
|
|
353
|
+
meta: {
|
|
354
|
+
operationId: operation.id,
|
|
355
|
+
stepDescription: step.description,
|
|
356
|
+
sql: step.sql,
|
|
357
|
+
...ifDefined("rowsWithoutValue", rowsWithoutValue?.reports),
|
|
358
|
+
...ifDefined("failedTypeChange", failedConversion)
|
|
227
359
|
}
|
|
228
360
|
});
|
|
229
361
|
}
|
|
230
362
|
return okVoid();
|
|
231
363
|
}
|
|
364
|
+
/**
|
|
365
|
+
* The conversion that failed, when the failed step is the copy of a rebuild that converts columns
|
|
366
|
+
* and there is evidence for it: a copy expression that fails on its own has an error in its
|
|
367
|
+
* expression, and a constraint of the new table that names a converted column was broken by a
|
|
368
|
+
* value the conversion produced. Any other failure of the copy is not the conversion's.
|
|
369
|
+
*/
|
|
370
|
+
async failedConversion(driver, step, error, plan) {
|
|
371
|
+
const copy = conversionCopyOf(step);
|
|
372
|
+
if (copy === void 0) return void 0;
|
|
373
|
+
const columns = Object.keys(copy.expressions);
|
|
374
|
+
const failed = async (column) => {
|
|
375
|
+
try {
|
|
376
|
+
await driver.query(`SELECT ${copy.expressions[column]} FROM ${quoteIdentifier(copy.table)}`);
|
|
377
|
+
return false;
|
|
378
|
+
} catch {
|
|
379
|
+
return true;
|
|
380
|
+
}
|
|
381
|
+
};
|
|
382
|
+
for (const column of columns) if (await failed(column)) return this.conversionOf(plan, copy.table, column, "expressionError");
|
|
383
|
+
const constrainedList = SqlQueryError.is(error) ? error.constraint : void 0;
|
|
384
|
+
if (constrainedList === void 0) return void 0;
|
|
385
|
+
const constrained = new Set(constrainedList.split(", "));
|
|
386
|
+
const column = columns.find((name) => constrained.has(`${rebuiltTableName(copy.table)}.${name}`));
|
|
387
|
+
return column === void 0 ? void 0 : this.conversionOf(plan, copy.table, column, "invalidResult");
|
|
388
|
+
}
|
|
389
|
+
conversionOf(plan, table, column, reason) {
|
|
390
|
+
const field = fieldOfColumn(plan.contract, table, column);
|
|
391
|
+
return field === void 0 ? void 0 : {
|
|
392
|
+
field,
|
|
393
|
+
by: "conversion",
|
|
394
|
+
reason,
|
|
395
|
+
operationIndex: plan.operationIndex
|
|
396
|
+
};
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* The rows a table rebuild found no value for, when its copy failed on a NOT NULL column of the
|
|
400
|
+
* new table: the columns the rebuild's postchecks mark as becoming required are counted, the
|
|
401
|
+
* rebuild's own first, then those of every other operation of its migration.
|
|
402
|
+
*/
|
|
403
|
+
rowsWithoutValue(driver, error, plan) {
|
|
404
|
+
if (!(SqlQueryError.is(error) && error.sqlState === NOT_NULL_VIOLATION_SQLSTATE)) return Promise.resolve(void 0);
|
|
405
|
+
const marks = requiredColumnsOfMigration(plan.operations, plan.edges, plan.operationIndex);
|
|
406
|
+
return rowsWithoutValueFailure({
|
|
407
|
+
failed: marks.filter((mark) => mark.operationIndex === plan.operationIndex),
|
|
408
|
+
others: marks,
|
|
409
|
+
count: async ({ required }) => {
|
|
410
|
+
const where = required.reason !== "newField" ? ` WHERE ${quoteIdentifier(required.column)} IS NULL` : "";
|
|
411
|
+
return (await driver.query(`SELECT COUNT(*) AS rows FROM ${quoteIdentifier(required.table)}${where}`)).rows[0]?.rows ?? 0;
|
|
412
|
+
},
|
|
413
|
+
contract: plan.contract
|
|
414
|
+
});
|
|
415
|
+
}
|
|
232
416
|
stepResultIsTrue(rows) {
|
|
233
417
|
if (!rows || rows.length === 0) return false;
|
|
234
418
|
const firstRow = rows[0];
|
|
@@ -317,7 +501,8 @@ var SqliteMigrationRunner = class {
|
|
|
317
501
|
const destination = {
|
|
318
502
|
storageHash: options.plan.destination.storageHash,
|
|
319
503
|
profileHash: options.plan.destination.profileHash ?? options.destinationContract.profileHash ?? options.plan.destination.storageHash,
|
|
320
|
-
invariants: options.plan.providedInvariants ?? []
|
|
504
|
+
invariants: options.plan.providedInvariants ?? [],
|
|
505
|
+
...ifDefined("databasePolicies", options.databasePolicies)
|
|
321
506
|
};
|
|
322
507
|
if (!existingMarker) {
|
|
323
508
|
await this.family.initMarker({
|
|
@@ -332,11 +517,19 @@ var SqliteMigrationRunner = class {
|
|
|
332
517
|
space,
|
|
333
518
|
expectedFrom: existingMarker.storageHash,
|
|
334
519
|
destination
|
|
335
|
-
}))
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
520
|
+
})) {
|
|
521
|
+
const found = await this.family.readMarker({
|
|
522
|
+
driver,
|
|
523
|
+
space
|
|
524
|
+
});
|
|
525
|
+
return runnerFailure("MIGRATION.MARKER_CAS_FAILURE", "Marker was modified by another process during migration execution.", { meta: {
|
|
526
|
+
reason: "storageHash",
|
|
527
|
+
space,
|
|
528
|
+
expectedStorageHash: existingMarker.storageHash,
|
|
529
|
+
foundStorageHash: found?.storageHash ?? null,
|
|
530
|
+
destinationStorageHash: options.plan.destination.storageHash
|
|
531
|
+
} });
|
|
532
|
+
}
|
|
340
533
|
return okVoid();
|
|
341
534
|
}
|
|
342
535
|
async recordLedgerEntries(driver, options, executedOperations) {
|
|
@@ -376,6 +569,25 @@ var SqliteMigrationRunner = class {
|
|
|
376
569
|
await driver.query(statement.sql, statement.params);
|
|
377
570
|
}
|
|
378
571
|
};
|
|
572
|
+
/** The rows `PRAGMA foreign_key_check` reports, as how many rows of each table reference rows of another. */
|
|
573
|
+
function violatedReferences(rows) {
|
|
574
|
+
const counts = /* @__PURE__ */ new Map();
|
|
575
|
+
for (const row of rows) {
|
|
576
|
+
const table = String(row["table"]);
|
|
577
|
+
const parent = String(row["parent"]);
|
|
578
|
+
const key = JSON.stringify([table, parent]);
|
|
579
|
+
const counted = counts.get(key) ?? {
|
|
580
|
+
table,
|
|
581
|
+
parent,
|
|
582
|
+
rows: 0
|
|
583
|
+
};
|
|
584
|
+
counts.set(key, {
|
|
585
|
+
...counted,
|
|
586
|
+
rows: counted.rows + 1
|
|
587
|
+
});
|
|
588
|
+
}
|
|
589
|
+
return [...counts.values()].map(({ table, parent, rows: count }) => `${count} ${count === 1 ? "row" : "rows"} of "${table}" ${count === 1 ? "references" : "reference"} "${parent}"`).join(", ");
|
|
590
|
+
}
|
|
379
591
|
/**
|
|
380
592
|
* SQLite target `SchemaVerifier` concretion. Mirrors the Postgres
|
|
381
593
|
* shape: hooks return the empty list pending the call-site migration
|
|
@@ -392,41 +604,47 @@ var SqliteSchemaVerifier = class extends SqlSchemaVerifierBase {
|
|
|
392
604
|
function isSqlContract(contract) {
|
|
393
605
|
return contract === null || contract.storage instanceof SqlStorage;
|
|
394
606
|
}
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
607
|
+
function createSqliteControlTargetDescriptor() {
|
|
608
|
+
setFallbackTemporal(Temporal);
|
|
609
|
+
return {
|
|
610
|
+
...sqliteTargetDescriptorMeta,
|
|
611
|
+
contractSerializer: new SqliteContractSerializer(),
|
|
612
|
+
schemaVerifier: new SqliteSchemaVerifier(),
|
|
613
|
+
diffSchema(input) {
|
|
614
|
+
return diffSqliteSchema(input);
|
|
615
|
+
},
|
|
616
|
+
classifySubjectGranularity: relationalNodeGranularity,
|
|
617
|
+
classifyEntityKind: relationalNodeEntityKind,
|
|
618
|
+
accessChangesOf: () => [],
|
|
619
|
+
readOperations: readSqliteOperations,
|
|
620
|
+
migrations: {
|
|
621
|
+
createPlanner(adapter) {
|
|
622
|
+
return createSqliteMigrationPlanner(adapter);
|
|
623
|
+
},
|
|
624
|
+
createRunner(family) {
|
|
625
|
+
return createSqliteMigrationRunner(family);
|
|
626
|
+
},
|
|
627
|
+
contractToSchema(contract, frameworkComponents) {
|
|
628
|
+
if (!isSqlContract(contract)) throw sqliteError("CONTRACT.TARGET_MISMATCH", "sqliteControlTargetDescriptor.contractToSchema received a non-SQL contract; expected Contract<SqlStorage>");
|
|
629
|
+
return sqliteContractToSchema(contract, sqlTypeLookupsOf(frameworkComponents));
|
|
630
|
+
}
|
|
631
|
+
},
|
|
632
|
+
create() {
|
|
633
|
+
return {
|
|
634
|
+
familyId: "sql",
|
|
635
|
+
targetId: "sqlite"
|
|
636
|
+
};
|
|
637
|
+
},
|
|
405
638
|
createPlanner(adapter) {
|
|
406
639
|
return createSqliteMigrationPlanner(adapter);
|
|
407
640
|
},
|
|
408
641
|
createRunner(family) {
|
|
409
642
|
return createSqliteMigrationRunner(family);
|
|
410
|
-
},
|
|
411
|
-
contractToSchema(contract, _frameworkComponents) {
|
|
412
|
-
if (!isSqlContract(contract)) throw sqliteError("CONTRACT.TARGET_MISMATCH", "sqliteControlTargetDescriptor.contractToSchema received a non-SQL contract; expected Contract<SqlStorage>");
|
|
413
|
-
return sqliteContractToSchema(contract);
|
|
414
643
|
}
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
familyId: "sql",
|
|
419
|
-
targetId: "sqlite"
|
|
420
|
-
};
|
|
421
|
-
},
|
|
422
|
-
createPlanner(adapter) {
|
|
423
|
-
return createSqliteMigrationPlanner(adapter);
|
|
424
|
-
},
|
|
425
|
-
createRunner(family) {
|
|
426
|
-
return createSqliteMigrationRunner(family);
|
|
427
|
-
}
|
|
428
|
-
};
|
|
644
|
+
};
|
|
645
|
+
}
|
|
646
|
+
const sqliteControlTargetDescriptor = createSqliteControlTargetDescriptor();
|
|
429
647
|
//#endregion
|
|
430
|
-
export {
|
|
648
|
+
export { sqliteControlTargetDescriptor as default, sqliteScalarTypeConstructors };
|
|
431
649
|
|
|
432
650
|
//# sourceMappingURL=target__control.mjs.map
|