@prisma/orm-target-postgres 8.0.0-rc.19-dev.4 → 8.0.0-rc.19-dev.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/dist/{adapter-DLPamqZO.d.mts → adapter-CVkrJLWQ.d.mts} +3 -3
  2. package/dist/{adapter-DLPamqZO.d.mts.map → adapter-CVkrJLWQ.d.mts.map} +1 -1
  3. package/dist/{adapter-BLduF4bR-clgZ076o.mjs → adapter-svGTIjA2-DDDsFolD.mjs} +3 -3
  4. package/dist/{adapter-BLduF4bR-clgZ076o.mjs.map → adapter-svGTIjA2-DDDsFolD.mjs.map} +1 -1
  5. package/dist/adapter.d.mts +2 -2
  6. package/dist/adapter.mjs +2 -2
  7. package/dist/adapter__adapter.d.mts +1 -1
  8. package/dist/adapter__adapter.mjs +2 -2
  9. package/dist/adapter__control.d.mts +1 -1
  10. package/dist/adapter__control.mjs +2 -2
  11. package/dist/adapter__control.mjs.map +1 -1
  12. package/dist/adapter__runtime.mjs +2 -2
  13. package/dist/adapter__runtime.mjs.map +1 -1
  14. package/dist/{contract-contributions-CRCEK7Dx-DQWxpLgr.mjs → contract-contributions-Xz2FpyfI-3anGCDno.mjs} +25 -4
  15. package/dist/{contract-contributions-CRCEK7Dx-DQWxpLgr.mjs.map → contract-contributions-Xz2FpyfI-3anGCDno.mjs.map} +1 -1
  16. package/dist/{contract-free-CN4hGOBI.mjs → contract-free-2xXXmS01.mjs} +2 -2
  17. package/dist/{contract-free-CN4hGOBI.mjs.map → contract-free-2xXXmS01.mjs.map} +1 -1
  18. package/dist/{contract-free-D1JEZVpQ.d.mts → contract-free-DCPNGs2e.d.mts} +2 -2
  19. package/dist/{contract-free-D1JEZVpQ.d.mts.map → contract-free-DCPNGs2e.d.mts.map} +1 -1
  20. package/dist/{control-kRer3n4t.d.mts → control-Dqf8WaSU.d.mts} +3 -3
  21. package/dist/{control-kRer3n4t.d.mts.map → control-Dqf8WaSU.d.mts.map} +1 -1
  22. package/dist/{control-policy-NpK0183H-DB8b5bNu.mjs → control-policy-B5xybjfP-BzOX_BG7.mjs} +186 -18
  23. package/dist/control-policy-B5xybjfP-BzOX_BG7.mjs.map +1 -0
  24. package/dist/{ddl-BrIDeRCe-ojLIc02T.mjs → ddl-B7Rqlz6D-BcwCMSB7.mjs} +52 -4
  25. package/dist/ddl-B7Rqlz6D-BcwCMSB7.mjs.map +1 -0
  26. package/dist/ddl-DC1--N63.d.mts +1 -0
  27. package/dist/{descriptor-meta-Cb7RcgEQ-qfcXndlR.mjs → descriptor-meta-BkD3nXF_-CnmmCqRU.mjs} +3 -3
  28. package/dist/{descriptor-meta-Cb7RcgEQ-qfcXndlR.mjs.map → descriptor-meta-BkD3nXF_-CnmmCqRU.mjs.map} +1 -1
  29. package/dist/{diff-database-schema-O45Q-UNo-6YARJ8Qu.mjs → diff-database-schema-CnpMv6hw-Ddjwwt23.mjs} +6 -5
  30. package/dist/{diff-database-schema-O45Q-UNo-6YARJ8Qu.mjs.map → diff-database-schema-CnpMv6hw-Ddjwwt23.mjs.map} +1 -1
  31. package/dist/{diff-database-schema-N-ftS4iF.d.mts → diff-database-schema-DPZdkysF.d.mts} +6 -1
  32. package/dist/{diff-database-schema-N-ftS4iF.d.mts.map → diff-database-schema-DPZdkysF.d.mts.map} +1 -1
  33. package/dist/{indexes-c2U6QZ4P-DgZWG_iu.d.mts → indexes-BYf6nXVv-DznOOzlT.d.mts} +3 -3
  34. package/dist/{indexes-c2U6QZ4P-DgZWG_iu.d.mts.map → indexes-BYf6nXVv-DznOOzlT.d.mts.map} +1 -1
  35. package/dist/{issue-planner-BrOqWTg5.d.mts → issue-planner--zt__-Kk.d.mts} +24 -3
  36. package/dist/issue-planner--zt__-Kk.d.mts.map +1 -0
  37. package/dist/{migration-cxHhDEGa.d.mts → migration-7VvUEoYO.d.mts} +3 -3
  38. package/dist/{migration-cxHhDEGa.d.mts.map → migration-7VvUEoYO.d.mts.map} +1 -1
  39. package/dist/migration-CbOh59ZJ.mjs.map +1 -1
  40. package/dist/{nodes-BYKl6zt_-BoUacQ_3.mjs → nodes-G8VTh4PM-D5t0nLdZ.mjs} +46 -3
  41. package/dist/{nodes-BYKl6zt_-BoUacQ_3.mjs.map → nodes-G8VTh4PM-D5t0nLdZ.mjs.map} +1 -1
  42. package/dist/{nodes-DOXes-fG-BifJqoRd.d.mts → nodes-s0Oe37jT-DY3kMSce.d.mts} +38 -4
  43. package/dist/nodes-s0Oe37jT-DY3kMSce.d.mts.map +1 -0
  44. package/dist/op-factory-call-C2r4PNO_.d.mts +1 -0
  45. package/dist/{op-factory-call-CtHJKITc-BMwiP_p7.mjs → op-factory-call-Dg9wUfmo-OAo-HYAA.mjs} +205 -4
  46. package/dist/op-factory-call-Dg9wUfmo-OAo-HYAA.mjs.map +1 -0
  47. package/dist/{op-factory-call-BAmu21qK-DjHPE4DG.d.mts → op-factory-call-nLHvNx0O-CGQ3bNN5.d.mts} +42 -6
  48. package/dist/{op-factory-call-BAmu21qK-DjHPE4DG.d.mts.map → op-factory-call-nLHvNx0O-CGQ3bNN5.d.mts.map} +1 -1
  49. package/dist/{planner-BQQdHpAs.d.mts → planner-CNG8pGm7.d.mts} +5 -4
  50. package/dist/planner-CNG8pGm7.d.mts.map +1 -0
  51. package/dist/{planner-DD0z05v--ByV38sBF.mjs → planner-D4CwrKzY-ClI8oVZM.mjs} +177 -28
  52. package/dist/planner-D4CwrKzY-ClI8oVZM.mjs.map +1 -0
  53. package/dist/{planner-produced-postgres-migration-CHFWM40q-DEXCOdWT.mjs → planner-produced-postgres-migration-CBA24iBB-CLmwH9md.mjs} +4 -4
  54. package/dist/{planner-produced-postgres-migration-CHFWM40q-DEXCOdWT.mjs.map → planner-produced-postgres-migration-CBA24iBB-CLmwH9md.mjs.map} +1 -1
  55. package/dist/planner-produced-postgres-migration-DEfRhvVl.d.mts +1 -0
  56. package/dist/{planner-produced-postgres-migration-C60Pid87-CFops3Az.d.mts → planner-produced-postgres-migration-DyIXJ3MR-CvH0IEvz.d.mts} +3 -3
  57. package/dist/planner-produced-postgres-migration-DyIXJ3MR-CvH0IEvz.d.mts.map +1 -0
  58. package/dist/{postgres-migration-CliSGXur-BQsla3Y9.mjs → postgres-migration--GsVSHhN-wW4poHE7.mjs} +160 -8
  59. package/dist/postgres-migration--GsVSHhN-wW4poHE7.mjs.map +1 -0
  60. package/dist/{postgres-migration-C3HdYUMt-DPWn_-7n.d.mts → postgres-migration-C5deJ3Ne-BBt4uBYb.d.mts} +29 -3
  61. package/dist/{postgres-migration-C3HdYUMt-DPWn_-7n.d.mts.map → postgres-migration-C5deJ3Ne-BBt4uBYb.d.mts.map} +1 -1
  62. package/dist/{render-ops-CrYiS0XA-Bkqye2yB.mjs → render-ops-BoFTJ9D1-BsFhuMdE.mjs} +3 -3
  63. package/dist/{render-ops-CrYiS0XA-Bkqye2yB.mjs.map → render-ops-BoFTJ9D1-BsFhuMdE.mjs.map} +1 -1
  64. package/dist/target.d.mts +13 -13
  65. package/dist/target.mjs +11 -11
  66. package/dist/target__contract-free.d.mts +1 -1
  67. package/dist/target__contract-free.mjs +2 -2
  68. package/dist/target__control.mjs +60 -17
  69. package/dist/target__control.mjs.map +1 -1
  70. package/dist/target__ddl.d.mts +3 -3
  71. package/dist/target__ddl.mjs +2 -2
  72. package/dist/target__diff-database-schema.d.mts +1 -1
  73. package/dist/target__diff-database-schema.mjs +1 -1
  74. package/dist/target__issue-planner.d.mts +1 -1
  75. package/dist/target__issue-planner.mjs +1 -1
  76. package/dist/target__migration.d.mts +2 -2
  77. package/dist/target__migration.mjs +2 -2
  78. package/dist/target__op-factory-call.d.mts +3 -3
  79. package/dist/target__op-factory-call.mjs +2 -2
  80. package/dist/target__planner-produced-postgres-migration.d.mts +2 -2
  81. package/dist/target__planner-produced-postgres-migration.mjs +1 -1
  82. package/dist/target__planner.d.mts +1 -1
  83. package/dist/target__planner.mjs +2 -2
  84. package/dist/target__render-ops.mjs +1 -1
  85. package/package.json +9 -9
  86. package/dist/control-policy-NpK0183H-DB8b5bNu.mjs.map +0 -1
  87. package/dist/ddl-BrIDeRCe-ojLIc02T.mjs.map +0 -1
  88. package/dist/ddl-D_JWHRzo.d.mts +0 -1
  89. package/dist/issue-planner-BrOqWTg5.d.mts.map +0 -1
  90. package/dist/nodes-DOXes-fG-BifJqoRd.d.mts.map +0 -1
  91. package/dist/op-factory-call-CDxHGgzs.d.mts +0 -1
  92. package/dist/op-factory-call-CtHJKITc-BMwiP_p7.mjs.map +0 -1
  93. package/dist/planner-BQQdHpAs.d.mts.map +0 -1
  94. package/dist/planner-DD0z05v--ByV38sBF.mjs.map +0 -1
  95. package/dist/planner-produced-postgres-migration-C60Pid87-CFops3Az.d.mts.map +0 -1
  96. package/dist/planner-produced-postgres-migration-Ch-pBAnV.d.mts +0 -1
  97. package/dist/postgres-migration-CliSGXur-BQsla3Y9.mjs.map +0 -1
@@ -1,5 +1,5 @@
1
1
  import { DdlNode } from "@prisma/orm-family-sql/relational-core/ast";
2
- //#region ../../../3-targets/3-targets/postgres/dist/nodes-BYKl6zt_.mjs
2
+ //#region ../../../3-targets/3-targets/postgres/dist/nodes-G8VTh4PM.mjs
3
3
  var AlterTableAction = class {};
4
4
  var AddColumnAction = class extends AlterTableAction {
5
5
  kind = "add-column";
@@ -277,7 +277,50 @@ var PostgresDisableRowLevelSecurity = class extends PostgresDdlNode {
277
277
  return visitor.disableRowLevelSecurity(this);
278
278
  }
279
279
  };
280
+ var PostgresAlterTableSetSchema = class extends PostgresDdlNode {
281
+ kind = "alter-table-set-schema";
282
+ /** Absent ⇔ unqualified (the unbound namespace). */
283
+ schema;
284
+ table;
285
+ to;
286
+ constructor(options) {
287
+ super();
288
+ this.schema = options.schema;
289
+ this.table = options.table;
290
+ this.to = options.to;
291
+ this.freeze();
292
+ }
293
+ accept(visitor) {
294
+ return visitor.alterTableSetSchema(this);
295
+ }
296
+ };
297
+ var PostgresAlterSchemaRename = class extends PostgresDdlNode {
298
+ kind = "alter-schema-rename";
299
+ schema;
300
+ to;
301
+ constructor(options) {
302
+ super();
303
+ this.schema = options.schema;
304
+ this.to = options.to;
305
+ this.freeze();
306
+ }
307
+ accept(visitor) {
308
+ return visitor.alterSchemaRename(this);
309
+ }
310
+ };
311
+ var PostgresDropSchema = class extends PostgresDdlNode {
312
+ kind = "drop-schema";
313
+ schema;
314
+ constructor(options) {
315
+ super();
316
+ this.schema = options.schema;
317
+ this.freeze();
318
+ }
319
+ accept(visitor) {
320
+ return visitor.dropSchema(this);
321
+ }
322
+ };
280
323
  //#endregion
281
- export { PostgresDropType as _, PostgresAlterIndexRename as a, PostgresCreateIndex as c, PostgresCreateTable as d, PostgresCreateType as f, PostgresDropPolicy as g, PostgresDropIndex as h, DropDefaultAction as i, PostgresCreatePolicy as l, PostgresDisableRowLevelSecurity as m, AddConstraintAction as n, PostgresAlterPolicyRename as o, PostgresDdlNode as p, AlterColumnTypeAction as r, PostgresAlterTable as s, AddColumnAction as t, PostgresCreateSchema as u };
324
+ export { PostgresDropIndex as _, PostgresAlterIndexRename as a, PostgresDropType as b, PostgresAlterTable as c, PostgresCreatePolicy as d, PostgresCreateSchema as f, PostgresDisableRowLevelSecurity as g, PostgresDdlNode as h, DropDefaultAction as i, PostgresAlterTableSetSchema as l, PostgresCreateType as m, AddConstraintAction as n, PostgresAlterPolicyRename as o, PostgresCreateTable as p, AlterColumnTypeAction as r, PostgresAlterSchemaRename as s, AddColumnAction as t, PostgresCreateIndex as u, PostgresDropPolicy as v, PostgresDropSchema as y };
282
325
 
283
- //# sourceMappingURL=nodes-BYKl6zt_-BoUacQ_3.mjs.map
326
+ //# sourceMappingURL=nodes-G8VTh4PM-D5t0nLdZ.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"nodes-BYKl6zt_-BoUacQ_3.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/nodes-BYKl6zt_.mjs"],"sourcesContent":["import { DdlNode } from \"@internal/sql-relational-core/ast\";\n//#region src/core/ddl/nodes.ts\nvar AlterTableAction = class {};\nvar AddColumnAction = class extends AlterTableAction {\n\tkind = \"add-column\";\n\tcolumn;\n\tconstructor(column) {\n\t\tsuper();\n\t\tthis.column = column;\n\t\tObject.freeze(this);\n\t}\n\taccept(visitor) {\n\t\treturn visitor.addColumn(this);\n\t}\n};\nvar DropDefaultAction = class extends AlterTableAction {\n\tkind = \"drop-default\";\n\tcolumnName;\n\tconstructor(columnName) {\n\t\tsuper();\n\t\tthis.columnName = columnName;\n\t\tObject.freeze(this);\n\t}\n\taccept(visitor) {\n\t\treturn visitor.dropDefault(this);\n\t}\n};\nvar AddConstraintAction = class extends AlterTableAction {\n\tkind = \"add-constraint\";\n\tconstraint;\n\tconstructor(constraint) {\n\t\tsuper();\n\t\tthis.constraint = constraint;\n\t\tObject.freeze(this);\n\t}\n\taccept(visitor) {\n\t\treturn visitor.addConstraint(this);\n\t}\n};\n/**\n* `ALTER COLUMN \"<columnName>\" TYPE <type> USING <using>`. `type` is written as given. Without `using`, the conversion is `\"<columnName>\"::<type>`.\n*/\nvar AlterColumnTypeAction = class extends AlterTableAction {\n\tkind = \"alter-column-type\";\n\tcolumnName;\n\ttype;\n\tusing;\n\tconstructor(options) {\n\t\tsuper();\n\t\tthis.columnName = options.columnName;\n\t\tthis.type = options.type;\n\t\tthis.using = options.using;\n\t\tObject.freeze(this);\n\t}\n\taccept(visitor) {\n\t\treturn visitor.alterColumnType(this);\n\t}\n};\nvar PostgresDdlNode = class extends DdlNode {};\nfunction freezeDdlColumns(columns) {\n\treturn Object.freeze([...columns]);\n}\nfunction freezeConstraints(constraints) {\n\treturn constraints ? Object.freeze([...constraints]) : void 0;\n}\nvar PostgresCreateTable = class extends PostgresDdlNode {\n\tkind = \"create-table\";\n\ttable;\n\tschema;\n\tifNotExists;\n\tcolumns;\n\tconstraints;\n\tconstructor(options) {\n\t\tsuper();\n\t\tthis.table = options.table;\n\t\tthis.schema = options.schema;\n\t\tthis.ifNotExists = options.ifNotExists;\n\t\tthis.columns = freezeDdlColumns(options.columns);\n\t\tthis.constraints = freezeConstraints(options.constraints);\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.createTable(this);\n\t}\n};\nvar PostgresCreateSchema = class extends PostgresDdlNode {\n\tkind = \"create-schema\";\n\tschema;\n\tifNotExists;\n\tconstructor(options) {\n\t\tsuper();\n\t\tthis.schema = options.schema;\n\t\tthis.ifNotExists = options.ifNotExists;\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.createSchema(this);\n\t}\n};\nvar PostgresCreateType = class extends PostgresDdlNode {\n\tkind = \"create-type\";\n\tschema;\n\tname;\n\tvalues;\n\tconstructor(options) {\n\t\tsuper();\n\t\tthis.schema = options.schema;\n\t\tthis.name = options.name;\n\t\tthis.values = Object.freeze([...options.values]);\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.createType(this);\n\t}\n};\nvar PostgresDropType = class extends PostgresDdlNode {\n\tkind = \"drop-type\";\n\tschema;\n\tname;\n\tconstructor(options) {\n\t\tsuper();\n\t\tthis.schema = options.schema;\n\t\tthis.name = options.name;\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.dropType(this);\n\t}\n};\nvar PostgresAlterTable = class extends PostgresDdlNode {\n\tkind = \"alter-table\";\n\ttable;\n\tschema;\n\tactions;\n\tconstructor(options) {\n\t\tsuper();\n\t\tthis.table = options.table;\n\t\tthis.schema = options.schema;\n\t\tthis.actions = Object.freeze([...options.actions]);\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.alterTable(this);\n\t}\n};\nvar PostgresCreatePolicy = class extends PostgresDdlNode {\n\tkind = \"create-policy\";\n\tschema;\n\ttable;\n\tname;\n\tpermissive;\n\toperation;\n\troles;\n\tusing;\n\twithCheck;\n\tconstructor(options) {\n\t\tsuper();\n\t\tthis.schema = options.schema;\n\t\tthis.table = options.table;\n\t\tthis.name = options.name;\n\t\tthis.permissive = options.permissive;\n\t\tthis.operation = options.operation;\n\t\tthis.roles = Object.freeze([...options.roles]);\n\t\tthis.using = options.using;\n\t\tthis.withCheck = options.withCheck;\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.createPolicy(this);\n\t}\n};\nvar PostgresDropPolicy = class extends PostgresDdlNode {\n\tkind = \"drop-policy\";\n\tschema;\n\ttable;\n\tname;\n\tconstructor(options) {\n\t\tsuper();\n\t\tthis.schema = options.schema;\n\t\tthis.table = options.table;\n\t\tthis.name = options.name;\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.dropPolicy(this);\n\t}\n};\nvar PostgresAlterPolicyRename = class extends PostgresDdlNode {\n\tkind = \"alter-policy-rename\";\n\tschema;\n\ttable;\n\tname;\n\tnewName;\n\tconstructor(options) {\n\t\tsuper();\n\t\tthis.schema = options.schema;\n\t\tthis.table = options.table;\n\t\tthis.name = options.name;\n\t\tthis.newName = options.newName;\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.alterPolicyRename(this);\n\t}\n};\nvar PostgresCreateIndex = class extends PostgresDdlNode {\n\tkind = \"create-index\";\n\t/** Absent ⇔ unqualified (the unbound namespace — `search_path` decides). */\n\tschema;\n\ttable;\n\tname;\n\tunique;\n\telements;\n\ttype;\n\toptions;\n\t/** Partial-index predicate (WHERE body, without the keyword). Never quoted or escaped. */\n\twhere;\n\tconstructor(options) {\n\t\tsuper();\n\t\tthis.schema = options.schema;\n\t\tthis.table = options.table;\n\t\tthis.name = options.name;\n\t\tthis.unique = options.unique;\n\t\tthis.elements = \"columns\" in options.elements ? { columns: Object.freeze([...options.elements.columns]) } : { expression: options.elements.expression };\n\t\tthis.type = options.type;\n\t\tthis.options = options.options;\n\t\tthis.where = options.where;\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.createIndex(this);\n\t}\n};\nvar PostgresDropIndex = class extends PostgresDdlNode {\n\tkind = \"drop-index\";\n\t/** Absent ⇔ unqualified (the unbound namespace). */\n\tschema;\n\tname;\n\tconstructor(options) {\n\t\tsuper();\n\t\tthis.schema = options.schema;\n\t\tthis.name = options.name;\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.dropIndex(this);\n\t}\n};\nvar PostgresAlterIndexRename = class extends PostgresDdlNode {\n\tkind = \"alter-index-rename\";\n\t/** Absent ⇔ unqualified (the unbound namespace). */\n\tschema;\n\tfrom;\n\tto;\n\tconstructor(options) {\n\t\tsuper();\n\t\tthis.schema = options.schema;\n\t\tthis.from = options.from;\n\t\tthis.to = options.to;\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.alterIndexRename(this);\n\t}\n};\nvar PostgresDisableRowLevelSecurity = class extends PostgresDdlNode {\n\tkind = \"disable-row-level-security\";\n\tschema;\n\ttable;\n\tconstructor(options) {\n\t\tsuper();\n\t\tthis.schema = options.schema;\n\t\tthis.table = options.table;\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.disableRowLevelSecurity(this);\n\t}\n};\n//#endregion\nexport { PostgresDropType as _, PostgresAlterIndexRename as a, PostgresCreateIndex as c, PostgresCreateTable as d, PostgresCreateType as f, PostgresDropPolicy as g, PostgresDropIndex as h, DropDefaultAction as i, PostgresCreatePolicy as l, PostgresDisableRowLevelSecurity as m, AddConstraintAction as n, PostgresAlterPolicyRename as o, PostgresDdlNode as p, AlterColumnTypeAction as r, PostgresAlterTable as s, AddColumnAction as t, PostgresCreateSchema as u };\n\n//# sourceMappingURL=nodes-BYKl6zt_.mjs.map"],"mappings":";;AAEA,IAAI,mBAAmB,MAAM,CAAC;AAC9B,IAAI,kBAAkB,cAAc,iBAAiB;CACpD,OAAO;CACP;CACA,YAAY,QAAQ;EACnB,MAAM;EACN,KAAK,SAAS;EACd,OAAO,OAAO,IAAI;CACnB;CACA,OAAO,SAAS;EACf,OAAO,QAAQ,UAAU,IAAI;CAC9B;AACD;AAC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CACrD,OAAO;;CAEP;CACA;CACA,YAAY,SAAS;EACpB,MAAM;EACN,KAAK,SAAS,QAAQ;EACtB,KAAK,OAAO,QAAQ;EACpB,KAAK,OAAO;CACb;CACA,OAAO,SAAS;EACf,OAAO,QAAQ,UAAU,IAAI;CAC9B;AACD;AACA,IAAI,2BAA2B,cAAc,gBAAgB;CAC5D,OAAO;;CAEP;CACA;CACA;CACA,YAAY,SAAS;EACpB,MAAM;EACN,KAAK,SAAS,QAAQ;EACtB,KAAK,OAAO,QAAQ;EACpB,KAAK,KAAK,QAAQ;EAClB,KAAK,OAAO;CACb;CACA,OAAO,SAAS;EACf,OAAO,QAAQ,iBAAiB,IAAI;CACrC;AACD;AACA,IAAI,kCAAkC,cAAc,gBAAgB;CACnE,OAAO;CACP;CACA;CACA,YAAY,SAAS;EACpB,MAAM;EACN,KAAK,SAAS,QAAQ;EACtB,KAAK,QAAQ,QAAQ;EACrB,KAAK,OAAO;CACb;CACA,OAAO,SAAS;EACf,OAAO,QAAQ,wBAAwB,IAAI;CAC5C;AACD"}
1
+ {"version":3,"file":"nodes-G8VTh4PM-D5t0nLdZ.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/nodes-G8VTh4PM.mjs"],"sourcesContent":["import { DdlNode } from \"@internal/sql-relational-core/ast\";\n//#region src/core/ddl/nodes.ts\nvar AlterTableAction = class {};\nvar AddColumnAction = class extends AlterTableAction {\n\tkind = \"add-column\";\n\tcolumn;\n\tconstructor(column) {\n\t\tsuper();\n\t\tthis.column = column;\n\t\tObject.freeze(this);\n\t}\n\taccept(visitor) {\n\t\treturn visitor.addColumn(this);\n\t}\n};\nvar DropDefaultAction = class extends AlterTableAction {\n\tkind = \"drop-default\";\n\tcolumnName;\n\tconstructor(columnName) {\n\t\tsuper();\n\t\tthis.columnName = columnName;\n\t\tObject.freeze(this);\n\t}\n\taccept(visitor) {\n\t\treturn visitor.dropDefault(this);\n\t}\n};\nvar AddConstraintAction = class extends AlterTableAction {\n\tkind = \"add-constraint\";\n\tconstraint;\n\tconstructor(constraint) {\n\t\tsuper();\n\t\tthis.constraint = constraint;\n\t\tObject.freeze(this);\n\t}\n\taccept(visitor) {\n\t\treturn visitor.addConstraint(this);\n\t}\n};\n/**\n* `ALTER COLUMN \"<columnName>\" TYPE <type> USING <using>`. `type` is written as given. Without `using`, the conversion is `\"<columnName>\"::<type>`.\n*/\nvar AlterColumnTypeAction = class extends AlterTableAction {\n\tkind = \"alter-column-type\";\n\tcolumnName;\n\ttype;\n\tusing;\n\tconstructor(options) {\n\t\tsuper();\n\t\tthis.columnName = options.columnName;\n\t\tthis.type = options.type;\n\t\tthis.using = options.using;\n\t\tObject.freeze(this);\n\t}\n\taccept(visitor) {\n\t\treturn visitor.alterColumnType(this);\n\t}\n};\nvar PostgresDdlNode = class extends DdlNode {};\nfunction freezeDdlColumns(columns) {\n\treturn Object.freeze([...columns]);\n}\nfunction freezeConstraints(constraints) {\n\treturn constraints ? Object.freeze([...constraints]) : void 0;\n}\nvar PostgresCreateTable = class extends PostgresDdlNode {\n\tkind = \"create-table\";\n\ttable;\n\tschema;\n\tifNotExists;\n\tcolumns;\n\tconstraints;\n\tconstructor(options) {\n\t\tsuper();\n\t\tthis.table = options.table;\n\t\tthis.schema = options.schema;\n\t\tthis.ifNotExists = options.ifNotExists;\n\t\tthis.columns = freezeDdlColumns(options.columns);\n\t\tthis.constraints = freezeConstraints(options.constraints);\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.createTable(this);\n\t}\n};\nvar PostgresCreateSchema = class extends PostgresDdlNode {\n\tkind = \"create-schema\";\n\tschema;\n\tifNotExists;\n\tconstructor(options) {\n\t\tsuper();\n\t\tthis.schema = options.schema;\n\t\tthis.ifNotExists = options.ifNotExists;\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.createSchema(this);\n\t}\n};\nvar PostgresCreateType = class extends PostgresDdlNode {\n\tkind = \"create-type\";\n\tschema;\n\tname;\n\tvalues;\n\tconstructor(options) {\n\t\tsuper();\n\t\tthis.schema = options.schema;\n\t\tthis.name = options.name;\n\t\tthis.values = Object.freeze([...options.values]);\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.createType(this);\n\t}\n};\nvar PostgresDropType = class extends PostgresDdlNode {\n\tkind = \"drop-type\";\n\tschema;\n\tname;\n\tconstructor(options) {\n\t\tsuper();\n\t\tthis.schema = options.schema;\n\t\tthis.name = options.name;\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.dropType(this);\n\t}\n};\nvar PostgresAlterTable = class extends PostgresDdlNode {\n\tkind = \"alter-table\";\n\ttable;\n\tschema;\n\tactions;\n\tconstructor(options) {\n\t\tsuper();\n\t\tthis.table = options.table;\n\t\tthis.schema = options.schema;\n\t\tthis.actions = Object.freeze([...options.actions]);\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.alterTable(this);\n\t}\n};\nvar PostgresCreatePolicy = class extends PostgresDdlNode {\n\tkind = \"create-policy\";\n\tschema;\n\ttable;\n\tname;\n\tpermissive;\n\toperation;\n\troles;\n\tusing;\n\twithCheck;\n\tconstructor(options) {\n\t\tsuper();\n\t\tthis.schema = options.schema;\n\t\tthis.table = options.table;\n\t\tthis.name = options.name;\n\t\tthis.permissive = options.permissive;\n\t\tthis.operation = options.operation;\n\t\tthis.roles = Object.freeze([...options.roles]);\n\t\tthis.using = options.using;\n\t\tthis.withCheck = options.withCheck;\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.createPolicy(this);\n\t}\n};\nvar PostgresDropPolicy = class extends PostgresDdlNode {\n\tkind = \"drop-policy\";\n\tschema;\n\ttable;\n\tname;\n\tconstructor(options) {\n\t\tsuper();\n\t\tthis.schema = options.schema;\n\t\tthis.table = options.table;\n\t\tthis.name = options.name;\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.dropPolicy(this);\n\t}\n};\nvar PostgresAlterPolicyRename = class extends PostgresDdlNode {\n\tkind = \"alter-policy-rename\";\n\tschema;\n\ttable;\n\tname;\n\tnewName;\n\tconstructor(options) {\n\t\tsuper();\n\t\tthis.schema = options.schema;\n\t\tthis.table = options.table;\n\t\tthis.name = options.name;\n\t\tthis.newName = options.newName;\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.alterPolicyRename(this);\n\t}\n};\nvar PostgresCreateIndex = class extends PostgresDdlNode {\n\tkind = \"create-index\";\n\t/** Absent ⇔ unqualified (the unbound namespace — `search_path` decides). */\n\tschema;\n\ttable;\n\tname;\n\tunique;\n\telements;\n\ttype;\n\toptions;\n\t/** Partial-index predicate (WHERE body, without the keyword). Never quoted or escaped. */\n\twhere;\n\tconstructor(options) {\n\t\tsuper();\n\t\tthis.schema = options.schema;\n\t\tthis.table = options.table;\n\t\tthis.name = options.name;\n\t\tthis.unique = options.unique;\n\t\tthis.elements = \"columns\" in options.elements ? { columns: Object.freeze([...options.elements.columns]) } : { expression: options.elements.expression };\n\t\tthis.type = options.type;\n\t\tthis.options = options.options;\n\t\tthis.where = options.where;\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.createIndex(this);\n\t}\n};\nvar PostgresDropIndex = class extends PostgresDdlNode {\n\tkind = \"drop-index\";\n\t/** Absent ⇔ unqualified (the unbound namespace). */\n\tschema;\n\tname;\n\tconstructor(options) {\n\t\tsuper();\n\t\tthis.schema = options.schema;\n\t\tthis.name = options.name;\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.dropIndex(this);\n\t}\n};\nvar PostgresAlterIndexRename = class extends PostgresDdlNode {\n\tkind = \"alter-index-rename\";\n\t/** Absent ⇔ unqualified (the unbound namespace). */\n\tschema;\n\tfrom;\n\tto;\n\tconstructor(options) {\n\t\tsuper();\n\t\tthis.schema = options.schema;\n\t\tthis.from = options.from;\n\t\tthis.to = options.to;\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.alterIndexRename(this);\n\t}\n};\nvar PostgresDisableRowLevelSecurity = class extends PostgresDdlNode {\n\tkind = \"disable-row-level-security\";\n\tschema;\n\ttable;\n\tconstructor(options) {\n\t\tsuper();\n\t\tthis.schema = options.schema;\n\t\tthis.table = options.table;\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.disableRowLevelSecurity(this);\n\t}\n};\nvar PostgresAlterTableSetSchema = class extends PostgresDdlNode {\n\tkind = \"alter-table-set-schema\";\n\t/** Absent ⇔ unqualified (the unbound namespace). */\n\tschema;\n\ttable;\n\tto;\n\tconstructor(options) {\n\t\tsuper();\n\t\tthis.schema = options.schema;\n\t\tthis.table = options.table;\n\t\tthis.to = options.to;\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.alterTableSetSchema(this);\n\t}\n};\nvar PostgresAlterSchemaRename = class extends PostgresDdlNode {\n\tkind = \"alter-schema-rename\";\n\tschema;\n\tto;\n\tconstructor(options) {\n\t\tsuper();\n\t\tthis.schema = options.schema;\n\t\tthis.to = options.to;\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.alterSchemaRename(this);\n\t}\n};\nvar PostgresDropSchema = class extends PostgresDdlNode {\n\tkind = \"drop-schema\";\n\tschema;\n\tconstructor(options) {\n\t\tsuper();\n\t\tthis.schema = options.schema;\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.dropSchema(this);\n\t}\n};\n//#endregion\nexport { PostgresDropIndex as _, PostgresAlterIndexRename as a, PostgresDropType as b, PostgresAlterTable as c, PostgresCreatePolicy as d, PostgresCreateSchema as f, PostgresDisableRowLevelSecurity as g, PostgresDdlNode as h, DropDefaultAction as i, PostgresAlterTableSetSchema as l, PostgresCreateType as m, AddConstraintAction as n, PostgresAlterPolicyRename as o, PostgresCreateTable as p, AlterColumnTypeAction as r, PostgresAlterSchemaRename as s, AddColumnAction as t, PostgresCreateIndex as u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c,gBAAgB;CAC7D,OAAO;CACP;CACA;CACA,YAAY,SAAS;EACpB,MAAM;EACN,KAAK,SAAS,QAAQ;EACtB,KAAK,KAAK,QAAQ;EAClB,KAAK,OAAO;CACb;CACA,OAAO,SAAS;EACf,OAAO,QAAQ,kBAAkB,IAAI;CACtC;AACD;AACA,IAAI,qBAAqB,cAAc,gBAAgB;CACtD,OAAO;CACP;CACA,YAAY,SAAS;EACpB,MAAM;EACN,KAAK,SAAS,QAAQ;EACtB,KAAK,OAAO;CACb;CACA,OAAO,SAAS;EACf,OAAO,QAAQ,WAAW,IAAI;CAC/B;AACD"}
@@ -1,6 +1,6 @@
1
1
  import { i as RlsPolicyOperation } from "./canonicalize-B-xvDOdd-Cnht2N4h.mjs";
2
2
  import { DdlColumn, DdlNode, DdlTableConstraint, OpaqueSql } from "@prisma/orm-family-sql/relational-core/ast";
3
- //#region ../../../3-targets/3-targets/postgres/dist/nodes-DOXes-fG.d.mts
3
+ //#region ../../../3-targets/3-targets/postgres/dist/nodes-s0Oe37jT.d.mts
4
4
  //#region src/core/ddl/nodes.d.ts
5
5
  interface AlterTableActionVisitor<R> {
6
6
  addColumn(action: AddColumnAction): R;
@@ -62,6 +62,9 @@ interface PostgresDdlVisitor<R> {
62
62
  dropIndex(node: PostgresDropIndex): R;
63
63
  alterIndexRename(node: PostgresAlterIndexRename): R;
64
64
  disableRowLevelSecurity(node: PostgresDisableRowLevelSecurity): R;
65
+ alterTableSetSchema(node: PostgresAlterTableSetSchema): R;
66
+ alterSchemaRename(node: PostgresAlterSchemaRename): R;
67
+ dropSchema(node: PostgresDropSchema): R;
65
68
  }
66
69
  declare abstract class PostgresDdlNode extends DdlNode {
67
70
  abstract accept<R>(visitor: PostgresDdlVisitor<R>): R;
@@ -248,7 +251,38 @@ declare class PostgresDisableRowLevelSecurity extends PostgresDdlNode {
248
251
  });
249
252
  accept<R>(visitor: PostgresDdlVisitor<R>): R;
250
253
  }
251
- type AnyPostgresDdlNode = PostgresCreateTable | PostgresCreateSchema | PostgresCreateType | PostgresDropType | PostgresAlterTable | PostgresCreatePolicy | PostgresDropPolicy | PostgresAlterPolicyRename | PostgresCreateIndex | PostgresDropIndex | PostgresAlterIndexRename | PostgresDisableRowLevelSecurity;
254
+ declare class PostgresAlterTableSetSchema extends PostgresDdlNode {
255
+ readonly kind: "alter-table-set-schema";
256
+ /** Absent ⇔ unqualified (the unbound namespace). */
257
+ readonly schema: string | undefined;
258
+ readonly table: string;
259
+ readonly to: string;
260
+ constructor(options: {
261
+ readonly schema: string | undefined;
262
+ readonly table: string;
263
+ readonly to: string;
264
+ });
265
+ accept<R>(visitor: PostgresDdlVisitor<R>): R;
266
+ }
267
+ declare class PostgresAlterSchemaRename extends PostgresDdlNode {
268
+ readonly kind: "alter-schema-rename";
269
+ readonly schema: string;
270
+ readonly to: string;
271
+ constructor(options: {
272
+ readonly schema: string;
273
+ readonly to: string;
274
+ });
275
+ accept<R>(visitor: PostgresDdlVisitor<R>): R;
276
+ }
277
+ declare class PostgresDropSchema extends PostgresDdlNode {
278
+ readonly kind: "drop-schema";
279
+ readonly schema: string;
280
+ constructor(options: {
281
+ readonly schema: string;
282
+ });
283
+ accept<R>(visitor: PostgresDdlVisitor<R>): R;
284
+ }
285
+ type AnyPostgresDdlNode = PostgresCreateTable | PostgresCreateSchema | PostgresCreateType | PostgresDropType | PostgresAlterTable | PostgresCreatePolicy | PostgresDropPolicy | PostgresAlterPolicyRename | PostgresCreateIndex | PostgresDropIndex | PostgresAlterIndexRename | PostgresDisableRowLevelSecurity | PostgresAlterTableSetSchema | PostgresAlterSchemaRename | PostgresDropSchema;
252
286
  //#endregion
253
- export { PostgresDropType as C, PostgresDropPolicy as S, PostgresCreateType as _, AnyAlterTableAction as a, PostgresDisableRowLevelSecurity as b, DdlIndexElements as c, PostgresAlterPolicyRename as d, PostgresAlterTable as f, PostgresCreateTable as g, PostgresCreateSchema as h, AlterTableActionVisitor as i, DropDefaultAction as l, PostgresCreatePolicy as m, AddConstraintAction as n, AnyPostgresDdlNode as o, PostgresCreateIndex as p, AlterColumnTypeAction as r, CreateIndexElements as s, AddColumnAction as t, PostgresAlterIndexRename as u, PostgresDdlNode as v, PostgresDropIndex as x, PostgresDdlVisitor as y };
254
- //# sourceMappingURL=nodes-DOXes-fG-BifJqoRd.d.mts.map
287
+ export { PostgresDropIndex as C, PostgresDropType as E, PostgresDisableRowLevelSecurity as S, PostgresDropSchema as T, PostgresCreateSchema as _, AnyAlterTableAction as a, PostgresDdlNode as b, DdlIndexElements as c, PostgresAlterPolicyRename as d, PostgresAlterSchemaRename as f, PostgresCreatePolicy as g, PostgresCreateIndex as h, AlterTableActionVisitor as i, DropDefaultAction as l, PostgresAlterTableSetSchema as m, AddConstraintAction as n, AnyPostgresDdlNode as o, PostgresAlterTable as p, AlterColumnTypeAction as r, CreateIndexElements as s, AddColumnAction as t, PostgresAlterIndexRename as u, PostgresCreateTable as v, PostgresDropPolicy as w, PostgresDdlVisitor as x, PostgresCreateType as y };
288
+ //# sourceMappingURL=nodes-s0Oe37jT-DY3kMSce.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nodes-s0Oe37jT-DY3kMSce.d.mts","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/nodes-s0Oe37jT.d.mts"],"mappings":";;;;UAGU,wBAAwB;EAChC,UAAU,QAAQ,kBAAkB;EACpC,YAAY,QAAQ,oBAAoB;EACxC,cAAc,QAAQ,sBAAsB;EAC5C,gBAAgB,QAAQ,wBAAwB;;uBAE3B;oBACH;WACT,OAAO,GAAG,SAAS,wBAAwB,KAAK;;cAE7C,wBAAwB;WAC3B;WACA,QAAQ;EACjB,YAAY,QAAQ;EACpB,OAAO,GAAG,SAAS,wBAAwB,KAAK;;cAEpC,0BAA0B;WAC7B;WACA;EACT,YAAY;EACZ,OAAO,GAAG,SAAS,wBAAwB,KAAK;;cAEpC,4BAA4B;WAC/B;WACA,YAAY;EACrB,YAAY,YAAY;EACxB,OAAO,GAAG,SAAS,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,SAAS,mBAAmB,KAAK;;KAExC,qBAAqB,sBAAsB,uBAAuB,qBAAqB,mBAAmB,qBAAqB,uBAAuB,qBAAqB,4BAA4B,sBAAsB,oBAAoB,2BAA2B,kCAAkC,8BAA8B,4BAA4B"}
@@ -0,0 +1 @@
1
+ import "./op-factory-call-nLHvNx0O-CGQ3bNN5.mjs";
@@ -1,7 +1,7 @@
1
1
  import { c as postgresError } from "./errors-BrhQYgdL-D_lIrddD.mjs";
2
2
  import { a as quoteQualifiedName, i as quoteIdentifier, n as escapeLiteral, o as validateEnumValueLength, t as POSTGRES_QUOTING } from "./sql-utils-Bnw3JbWf-zvWDkyrr.mjs";
3
3
  import { t as DEFAULT_NAMESPACE_ID } from "./namespace-ids-xtp_ZY86-Cpp8PTxD.mjs";
4
- import { A as nativeEnumValueExistsAst, C as dropIndex$1, D as indexDefinitionAst, E as extensionExistsAst, F as rlsPolicyExistsAst, I as sequenceNameAvailableAst, L as sequenceValuesFitAst, M as relationKindAst, N as rlsEnabledAst, O as indexExistsAst, P as rlsPolicyDefinitionAst, R as tableExistsAst, S as dropDefaultAction, T as dropType, _ as createPolicy, a as alterPolicyRename, b as createType, c as columnDefaultSequenceAst, d as columnOwnsSequenceAst, f as columnTypeAst, g as createIndex$1, h as constraintExistsAst, i as alterIndexRename, j as noNullValuesAst, k as nativeEnumTypeExistsAst, l as columnExistsAst, m as constraintDefinitionAst, n as addConstraintAction, o as alterTable, p as columnTypeOidAst, r as alterColumnTypeAction, s as columnDefaultAst, t as addColumnAction, u as columnNullabilityAst, v as createSchema, w as dropPolicy, x as disableRowLevelSecurity$1, y as createTable, z as tableIsEmptyAst } from "./ddl-BrIDeRCe-ojLIc02T.mjs";
4
+ import { A as indexDefinitionAst, B as schemaHoldsNoObjectsAst, C as disableRowLevelSecurity$1, D as dropSchema$1, E as dropPolicy, F as relationKindAst, H as sequenceValuesFitAst, I as rlsEnabledAst, L as rlsPolicyDefinitionAst, M as nativeEnumTypeExistsAst, N as nativeEnumValueExistsAst, O as dropType, P as noNullValuesAst, R as rlsPolicyExistsAst, S as createType, T as dropIndex$1, U as tableExistsAst, V as sequenceNameAvailableAst, W as tableIsEmptyAst, _ as constraintExistsAst, a as alterPolicyRename, b as createSchema, c as alterTableSetSchema, d as columnExistsAst, f as columnNullabilityAst, g as constraintDefinitionAst, h as columnTypeOidAst, i as alterIndexRename, j as indexExistsAst, k as extensionExistsAst, l as columnDefaultAst, m as columnTypeAst, n as addConstraintAction, o as alterSchemaRename, p as columnOwnsSequenceAst, q as unboundTableMovedAst, r as alterColumnTypeAction, s as alterTable, t as addColumnAction, u as columnDefaultSequenceAst, v as createIndex$1, w as dropDefaultAction, x as createTable, y as createPolicy, z as schemaExistsAst } from "./ddl-B7Rqlz6D-BcwCMSB7.mjs";
5
5
  import { i as policyRoleList, t as POLICY_COMMAND_SQL } from "./canonicalize-RdxoUHao-DK_M6HU-.mjs";
6
6
  import { r as autoincrementWidthOfPseudoType, t as autoincrementWidth } from "./autoincrement-widths-O1bL_G0T-B7F3b4oU.mjs";
7
7
  import { t as postgresObjectName } from "./postgres-object-name-FPikIvOw-BNs44hTu.mjs";
@@ -10,6 +10,7 @@ import { t as buildTargetDetails } from "./planner-target-details-CUEF0s90-COTks
10
10
  import { DdlColumn, FunctionColumnDefault, LiteralColumnDefault, opaqueSql } from "@prisma/orm-family-sql/relational-core/ast";
11
11
  import { blindCast } from "@prisma/orm-framework/utils/casts";
12
12
  import { InternalError, assertNever } from "@prisma/orm-framework/utils/internal-error";
13
+ import { type } from "arktype";
13
14
  import { UNBOUND_NAMESPACE_ID } from "@prisma/orm-framework/components/ir";
14
15
  import { expectAbsent, expectPresent } from "@prisma/orm-framework/components/control";
15
16
  import { namingOf } from "@prisma/orm-family-sql/schema-ir/naming";
@@ -19,7 +20,7 @@ import { checkSqlDefaultText, checkSqlExpressionText, convertedColumnMeta, creat
19
20
  import { unfilledPlaceholderOperation } from "@prisma/orm-framework/errors/migration";
20
21
  import { TsExpression, jsonToTsSource, tsObjectSource } from "@prisma/orm-framework/ts-render";
21
22
  import { REFERENTIAL_ACTION_SQL } from "@prisma/orm-family-sql/contract/referential-action-sql";
22
- //#region ../../../3-targets/3-targets/postgres/dist/op-factory-call-CtHJKITc.mjs
23
+ //#region ../../../3-targets/3-targets/postgres/dist/op-factory-call-Dg9wUfmo.mjs
23
24
  /**
24
25
  * Maps a planner schema name to the contract-free DDL builder's optional
25
26
  * `schema` field: the unbound sentinel becomes `undefined` (the builder omits
@@ -970,6 +971,126 @@ async function renameRlsPolicy(schemaName, tableName, oldPolicyName, newPolicyNa
970
971
  postcheck: [step(`verify RLS policy "${newPolicyName}" exists`, newPresent.sql, newPresent.params, expectPresent(`RLS policy "${newPolicyName}" on "${tableName}"`)), step(`verify RLS policy "${oldPolicyName}" no longer exists`, oldAbsent.sql, oldAbsent.params, expectAbsent(`RLS policy "${oldPolicyName}" on "${tableName}"`))]
971
972
  };
972
973
  }
974
+ const SchemaContentsMeta = type({ schemaContents: { schema: "string" } });
975
+ /** The meta of a step that fails while a schema still holds objects; the runner then names them. */
976
+ function schemaContentsMeta(schema) {
977
+ return { schemaContents: { schema } };
978
+ }
979
+ function schemaContentsOf(step) {
980
+ const meta = SchemaContentsMeta(step.meta ?? {});
981
+ return meta instanceof type.errors ? void 0 : meta.schemaContents.schema;
982
+ }
983
+ const SCHEMA_OBJECTS_SQL = `SELECT kind, name FROM (
984
+ SELECT CASE c.relkind
985
+ WHEN 'v' THEN 'view'
986
+ WHEN 'm' THEN 'materialized view'
987
+ WHEN 'S' THEN 'sequence'
988
+ WHEN 'f' THEN 'foreign table'
989
+ WHEN 'c' THEN 'type'
990
+ ELSE 'table'
991
+ END AS kind, c.relname::text AS name
992
+ FROM pg_catalog.pg_class c JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
993
+ WHERE n.nspname = $1 AND c.relkind IN ('r', 'p', 'v', 'm', 'S', 'f', 'c')
994
+ UNION ALL
995
+ SELECT 'type', t.typname::text
996
+ FROM pg_catalog.pg_type t JOIN pg_catalog.pg_namespace n ON n.oid = t.typnamespace
997
+ WHERE n.nspname = $1 AND t.typrelid = 0 AND t.typelem = 0
998
+ UNION ALL
999
+ SELECT 'function', p.proname::text
1000
+ FROM pg_catalog.pg_proc p JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace
1001
+ WHERE n.nspname = $1
1002
+ ) AS objects ORDER BY name, kind`;
1003
+ const NAMED_OBJECTS = 10;
1004
+ function listed(items) {
1005
+ if (items.length === 1) return items[0] ?? "";
1006
+ return `${items.slice(0, -1).join(", ")} and ${items.at(-1)}`;
1007
+ }
1008
+ const UNQUOTED_IDENTIFIER = /^[a-z_][a-z0-9_$]*$/;
1009
+ /** An identifier as Postgres writes it in its messages: quoted only where it must be. */
1010
+ function identifierText(identifier) {
1011
+ return UNQUOTED_IDENTIFIER.test(identifier) ? identifier : `"${identifier.replaceAll("\"", "\"\"")}"`;
1012
+ }
1013
+ /**
1014
+ * The objects a schema query found, each named with its schema as Postgres names objects in its
1015
+ * messages, such as a view that depends on a table: the form a blocked drop reports everywhere.
1016
+ */
1017
+ function schemaBlockingObjects(schema, objects) {
1018
+ return objects.map(({ kind, name }) => ({
1019
+ kind,
1020
+ name: `${identifierText(schema)}.${identifierText(name)}`
1021
+ }));
1022
+ }
1023
+ /** What a runner failure says of the objects that keep a schema from being dropped. */
1024
+ function schemaObjectsSummary(schema, objects) {
1025
+ const named = objects.slice(0, NAMED_OBJECTS).map(({ kind, name }) => `${kind} ${name}`);
1026
+ const more = objects.length - named.length;
1027
+ return `Schema "${schema}" still holds ${listed(more > 0 ? [...named, `${more} more`] : named)}, so it cannot be dropped.`;
1028
+ }
1029
+ async function setTableSchema(schemaName, tableName, toSchemaName, lowerer) {
1030
+ const from = tableExistsAst(schemaName, tableName);
1031
+ const to = tableExistsAst(toSchemaName, tableName);
1032
+ const fromPresent = await lowerer.lowerToExecuteRequest(from.tablePresent());
1033
+ const toSchemaPresent = await lowerer.lowerToExecuteRequest(schemaExistsAst(toSchemaName).schemaPresent());
1034
+ const toAbsent = await lowerer.lowerToExecuteRequest(to.tableAbsent());
1035
+ const statement = await lowerer.lowerToExecuteRequest(alterTableSetSchema({
1036
+ schema: boundSchema(schemaName),
1037
+ table: tableName,
1038
+ to: toSchemaName
1039
+ }));
1040
+ const toPresent = await lowerer.lowerToExecuteRequest(to.tablePresent());
1041
+ const fromAbsent = await lowerer.lowerToExecuteRequest(schemaName === UNBOUND_NAMESPACE_ID ? unboundTableMovedAst(tableName, toSchemaName) : from.tableAbsent());
1042
+ return {
1043
+ id: `setTableSchema.${tableName}`,
1044
+ label: `Move table "${tableName}" to schema "${toSchemaName}"`,
1045
+ operationClass: "widening",
1046
+ target: targetDetails("table", tableName, toSchemaName),
1047
+ precheck: [
1048
+ step(`ensure table "${tableName}" exists`, fromPresent.sql, fromPresent.params),
1049
+ step(`ensure schema "${toSchemaName}" exists`, toSchemaPresent.sql, toSchemaPresent.params),
1050
+ step(`ensure schema "${toSchemaName}" has no table "${tableName}"`, toAbsent.sql, toAbsent.params)
1051
+ ],
1052
+ execute: [step(`move table "${tableName}" to schema "${toSchemaName}"`, statement.sql, statement.params)],
1053
+ postcheck: [step(`verify table "${tableName}" exists in schema "${toSchemaName}"`, toPresent.sql, toPresent.params), step(`verify table "${tableName}" no longer exists where it was`, fromAbsent.sql, fromAbsent.params)]
1054
+ };
1055
+ }
1056
+ async function renameSchema(schemaName, toSchemaName, lowerer) {
1057
+ const from = schemaExistsAst(schemaName);
1058
+ const to = schemaExistsAst(toSchemaName);
1059
+ const fromPresent = await lowerer.lowerToExecuteRequest(from.schemaPresent());
1060
+ const toAbsent = await lowerer.lowerToExecuteRequest(to.schemaAbsent());
1061
+ const statement = await lowerer.lowerToExecuteRequest(alterSchemaRename({
1062
+ schema: schemaName,
1063
+ to: toSchemaName
1064
+ }));
1065
+ const toPresent = await lowerer.lowerToExecuteRequest(to.schemaPresent());
1066
+ const fromAbsent = await lowerer.lowerToExecuteRequest(from.schemaAbsent());
1067
+ return {
1068
+ id: `renameSchema.${schemaName}`,
1069
+ label: `Rename schema "${schemaName}" to "${toSchemaName}"`,
1070
+ operationClass: "widening",
1071
+ target: { id: "postgres" },
1072
+ precheck: [step(`ensure schema "${schemaName}" exists`, fromPresent.sql, fromPresent.params), step(`ensure schema "${toSchemaName}" does not exist`, toAbsent.sql, toAbsent.params)],
1073
+ execute: [step(`rename schema "${schemaName}" to "${toSchemaName}"`, statement.sql, statement.params)],
1074
+ postcheck: [step(`verify schema "${toSchemaName}" exists`, toPresent.sql, toPresent.params), step(`verify schema "${schemaName}" no longer exists`, fromAbsent.sql, fromAbsent.params)]
1075
+ };
1076
+ }
1077
+ async function dropSchema(schemaName, lowerer) {
1078
+ const empty = await lowerer.lowerToExecuteRequest(schemaHoldsNoObjectsAst(schemaName));
1079
+ const statement = await lowerer.lowerToExecuteRequest(dropSchema$1({ schema: schemaName }));
1080
+ const absent = await lowerer.lowerToExecuteRequest(schemaExistsAst(schemaName).schemaAbsent());
1081
+ return {
1082
+ id: `dropSchema.${schemaName}`,
1083
+ label: `Drop schema "${schemaName}"`,
1084
+ operationClass: "widening",
1085
+ target: { id: "postgres" },
1086
+ precheck: [{
1087
+ ...step(`ensure schema "${schemaName}" holds no tables, views, sequences, types or functions`, empty.sql, empty.params),
1088
+ meta: schemaContentsMeta(schemaName)
1089
+ }],
1090
+ execute: [step(`drop schema "${schemaName}"`, statement.sql, statement.params)],
1091
+ postcheck: [step(`verify schema "${schemaName}" does not exist`, absent.sql, absent.params)]
1092
+ };
1093
+ }
973
1094
  async function dropTable(schemaName, tableName, lowerer) {
974
1095
  const qualified = qualifyTableName(schemaName, tableName);
975
1096
  const checks = tableExistsAst(schemaName, tableName);
@@ -2249,6 +2370,7 @@ var CreateSchemaCall = class extends PostgresOpFactoryCallNode {
2249
2370
  operationClass = "additive";
2250
2371
  schemaName;
2251
2372
  label;
2373
+ companions = [];
2252
2374
  constructor(schemaName) {
2253
2375
  super();
2254
2376
  this.schemaName = schemaName;
@@ -2284,6 +2406,85 @@ var CreateSchemaCall = class extends PostgresOpFactoryCallNode {
2284
2406
  return [];
2285
2407
  }
2286
2408
  };
2409
+ function requireLowerer(lowerer, factory, subject) {
2410
+ if (lowerer === void 0) throw postgresError("MIGRATION.POSTGRES_CONTROL_STACK_MISSING", `${factory}.toOp: a lowerer is required on the Postgres planner path (${subject}). Pass the control adapter to createPostgresMigrationPlanner.`, { meta: { factory } });
2411
+ return lowerer;
2412
+ }
2413
+ var SetTableSchemaCall = class extends PostgresOpFactoryCallNode {
2414
+ factoryName = "setTableSchema";
2415
+ operationClass = "widening";
2416
+ schemaName;
2417
+ tableName;
2418
+ toSchemaName;
2419
+ label;
2420
+ companions = [];
2421
+ constructor(schemaName, tableName, toSchemaName) {
2422
+ super();
2423
+ this.schemaName = schemaName;
2424
+ this.tableName = tableName;
2425
+ this.toSchemaName = toSchemaName;
2426
+ this.label = `Move table "${tableName}" to schema "${toSchemaName}"`;
2427
+ this.freeze();
2428
+ }
2429
+ async toOp(lowerer) {
2430
+ return setTableSchema(this.schemaName, this.tableName, this.toSchemaName, requireLowerer(lowerer, "SetTableSchemaCall", `table "${this.tableName}"`));
2431
+ }
2432
+ renderTypeScript() {
2433
+ const opts = [];
2434
+ if (this.schemaName !== UNBOUND_NAMESPACE_ID) opts.push(`schema: ${jsonToTsSource(this.schemaName)}`);
2435
+ opts.push(`table: ${jsonToTsSource(this.tableName)}`);
2436
+ opts.push(`to: ${jsonToTsSource(this.toSchemaName)}`);
2437
+ return `this.setTableSchema({ ${opts.join(", ")} })`;
2438
+ }
2439
+ importRequirements() {
2440
+ return [];
2441
+ }
2442
+ };
2443
+ var RenameSchemaCall = class extends PostgresOpFactoryCallNode {
2444
+ factoryName = "renameSchema";
2445
+ operationClass = "widening";
2446
+ schemaName;
2447
+ toSchemaName;
2448
+ label;
2449
+ companions = [];
2450
+ constructor(schemaName, toSchemaName) {
2451
+ super();
2452
+ this.schemaName = schemaName;
2453
+ this.toSchemaName = toSchemaName;
2454
+ this.label = `Rename schema "${schemaName}" to "${toSchemaName}"`;
2455
+ this.freeze();
2456
+ }
2457
+ async toOp(lowerer) {
2458
+ return renameSchema(this.schemaName, this.toSchemaName, requireLowerer(lowerer, "RenameSchemaCall", `schema "${this.schemaName}"`));
2459
+ }
2460
+ renderTypeScript() {
2461
+ return `this.renameSchema({ schema: ${jsonToTsSource(this.schemaName)}, to: ${jsonToTsSource(this.toSchemaName)} })`;
2462
+ }
2463
+ importRequirements() {
2464
+ return [];
2465
+ }
2466
+ };
2467
+ var DropSchemaCall = class extends PostgresOpFactoryCallNode {
2468
+ factoryName = "dropSchema";
2469
+ operationClass = "widening";
2470
+ schemaName;
2471
+ label;
2472
+ constructor(schemaName) {
2473
+ super();
2474
+ this.schemaName = schemaName;
2475
+ this.label = `Drop schema "${schemaName}"`;
2476
+ this.freeze();
2477
+ }
2478
+ async toOp(lowerer) {
2479
+ return dropSchema(this.schemaName, requireLowerer(lowerer, "DropSchemaCall", `schema "${this.schemaName}"`));
2480
+ }
2481
+ renderTypeScript() {
2482
+ return `this.dropSchema({ schema: ${jsonToTsSource(this.schemaName)} })`;
2483
+ }
2484
+ importRequirements() {
2485
+ return [];
2486
+ }
2487
+ };
2287
2488
  var CreateNativeEnumTypeCall = class extends PostgresOpFactoryCallNode {
2288
2489
  factoryName = "createNativeEnumType";
2289
2490
  operationClass = "additive";
@@ -2612,6 +2813,6 @@ function columnNameOfCall(call) {
2612
2813
  if ("column" in call && call.column instanceof DdlColumn) return call.column.name;
2613
2814
  }
2614
2815
  //#endregion
2615
- export { RenameConstraintCall as A, isPostgresOpFactoryCall as B, DropNativeEnumTypeCall as C, EnableRowLevelSecurityCall as D, DropTableCall as E, SetNotNullCall as F, renameTableStatement as H, alterColumnTypeCallText as I, columnNameOfCall as L, RenamePostgresRlsPolicyCall as M, RenameTableCall as N, RawSqlCall as O, SetDefaultCall as P, createExtension as R, DropIndexCall as S, DropPostgresRlsPolicyCall as T, postgresDefaultToDdlColumnDefault as V, DisableRowLevelSecurityCall as _, AddNativeEnumValueCall as a, DropConstraintCall as b, AddUniqueCall as c, CreateIndexCall as d, CreateNativeEnumTypeCall as f, DataTransformCall as g, CreateTableCall as h, AddForeignKeyCall as i, RenameIndexCall as j, RenameColumnCall as k, AlterColumnTypeCall as l, CreateSchemaCall as m, AddColumnCall as n, AddPrimaryKeyCall as o, CreatePostgresRlsPolicyCall as p, AddColumnWithTemporaryDefaultCall as r, AddRequiredColumnToEmptyTableCall as s, AddCheckConstraintCall as t, CreateExtensionCall as u, DropCheckConstraintCall as v, DropNotNullCall as w, DropDefaultCall as x, DropColumnCall as y, installExtension as z };
2816
+ export { RenameColumnCall as A, alterColumnTypeCallText as B, DropNativeEnumTypeCall as C, DropTableCall as D, DropSchemaCall as E, RenameTableCall as F, postgresDefaultToDdlColumnDefault as G, createExtension as H, SCHEMA_OBJECTS_SQL as I, schemaContentsOf as J, renameTableStatement as K, SetDefaultCall as L, RenameIndexCall as M, RenamePostgresRlsPolicyCall as N, EnableRowLevelSecurityCall as O, RenameSchemaCall as P, SetNotNullCall as R, DropIndexCall as S, DropPostgresRlsPolicyCall as T, installExtension as U, columnNameOfCall as V, isPostgresOpFactoryCall as W, schemaObjectsSummary as Y, DisableRowLevelSecurityCall as _, AddNativeEnumValueCall as a, DropConstraintCall as b, AddUniqueCall as c, CreateIndexCall as d, CreateNativeEnumTypeCall as f, DataTransformCall as g, CreateTableCall as h, AddForeignKeyCall as i, RenameConstraintCall as j, RawSqlCall as k, AlterColumnTypeCall as l, CreateSchemaCall as m, AddColumnCall as n, AddPrimaryKeyCall as o, CreatePostgresRlsPolicyCall as p, schemaBlockingObjects as q, AddColumnWithTemporaryDefaultCall as r, AddRequiredColumnToEmptyTableCall as s, AddCheckConstraintCall as t, CreateExtensionCall as u, DropCheckConstraintCall as v, DropNotNullCall as w, DropDefaultCall as x, DropColumnCall as y, SetTableSchemaCall as z };
2616
2817
 
2617
- //# sourceMappingURL=op-factory-call-CtHJKITc-BMwiP_p7.mjs.map
2818
+ //# sourceMappingURL=op-factory-call-Dg9wUfmo-OAo-HYAA.mjs.map