@prisma-next/target-postgres 0.16.0-dev.2 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/dist/{control-policy-CZKdMztu.mjs → control-policy-42vVVpTL.mjs} +2 -2
  2. package/dist/{control-policy-CZKdMztu.mjs.map → control-policy-42vVVpTL.mjs.map} +1 -1
  3. package/dist/control.mjs +13 -13
  4. package/dist/control.mjs.map +1 -1
  5. package/dist/data-transform-BOWpliq8.mjs.map +1 -1
  6. package/dist/{diff-database-schema-C-hnJ5mr.mjs → diff-database-schema-CrYO0j4_.mjs} +2 -2
  7. package/dist/{diff-database-schema-C-hnJ5mr.mjs.map → diff-database-schema-CrYO0j4_.mjs.map} +1 -1
  8. package/dist/diff-database-schema.mjs +1 -1
  9. package/dist/{errors-ByDS0xJL.mjs → errors-DO-w0EUS.mjs} +6 -6
  10. package/dist/errors-DO-w0EUS.mjs.map +1 -0
  11. package/dist/errors.d.mts +3 -4
  12. package/dist/errors.d.mts.map +1 -1
  13. package/dist/errors.mjs +1 -1
  14. package/dist/issue-planner.d.mts +1 -1
  15. package/dist/issue-planner.mjs +1 -1
  16. package/dist/migration.d.mts +2 -2
  17. package/dist/migration.mjs +2 -2
  18. package/dist/{op-factory-call-DT7kdjVP.d.mts → op-factory-call-MOWnyFor.d.mts} +2 -2
  19. package/dist/{op-factory-call-DT7kdjVP.d.mts.map → op-factory-call-MOWnyFor.d.mts.map} +1 -1
  20. package/dist/{op-factory-call-DuRj7WXX.mjs → op-factory-call-rCP7TXTh.mjs} +3 -3
  21. package/dist/op-factory-call-rCP7TXTh.mjs.map +1 -0
  22. package/dist/op-factory-call.d.mts +1 -1
  23. package/dist/op-factory-call.mjs +1 -1
  24. package/dist/{planner-DPGxFcXo.mjs → planner-Bj7MTEeR.mjs} +5 -5
  25. package/dist/{planner-DPGxFcXo.mjs.map → planner-Bj7MTEeR.mjs.map} +1 -1
  26. package/dist/{planner-produced-postgres-migration-C-dwGdb2.d.mts → planner-produced-postgres-migration-DnMRtO7t.d.mts} +2 -2
  27. package/dist/planner-produced-postgres-migration-DnMRtO7t.d.mts.map +1 -0
  28. package/dist/{planner-produced-postgres-migration-CFDpqWWE.mjs → planner-produced-postgres-migration-iHdZVN5i.mjs} +2 -2
  29. package/dist/planner-produced-postgres-migration-iHdZVN5i.mjs.map +1 -0
  30. package/dist/planner-produced-postgres-migration.d.mts +1 -1
  31. package/dist/planner-produced-postgres-migration.mjs +1 -1
  32. package/dist/planner.d.mts +1 -1
  33. package/dist/planner.mjs +2 -2
  34. package/dist/{postgres-migration-DLIvzHjX.d.mts → postgres-migration-CjnEdWxh.d.mts} +4 -4
  35. package/dist/{postgres-migration-DLIvzHjX.d.mts.map → postgres-migration-CjnEdWxh.d.mts.map} +1 -1
  36. package/dist/{postgres-migration-C_OPFhIF.mjs → postgres-migration-fxgsblW1.mjs} +5 -5
  37. package/dist/postgres-migration-fxgsblW1.mjs.map +1 -0
  38. package/package.json +20 -20
  39. package/src/core/errors.ts +5 -5
  40. package/src/core/migrations/op-factory-call.ts +2 -2
  41. package/src/core/migrations/operations/data-transform.ts +1 -1
  42. package/src/core/migrations/planner-produced-postgres-migration.ts +1 -1
  43. package/src/core/migrations/postgres-migration.ts +2 -2
  44. package/src/core/migrations/runner.ts +11 -12
  45. package/dist/errors-ByDS0xJL.mjs.map +0 -1
  46. package/dist/op-factory-call-DuRj7WXX.mjs.map +0 -1
  47. package/dist/planner-produced-postgres-migration-C-dwGdb2.d.mts.map +0 -1
  48. package/dist/planner-produced-postgres-migration-CFDpqWWE.mjs.map +0 -1
  49. package/dist/postgres-migration-C_OPFhIF.mjs.map +0 -1
@@ -137,7 +137,7 @@ class PostgresMigrationRunner implements SqlMigrationRunner<PostgresPlanTargetDe
137
137
  frameworkComponents: options.frameworkComponents,
138
138
  });
139
139
  if (!schemaVerifyResult.ok) {
140
- return runnerFailure('MIGRATION.SCHEMA_VERIFY_FAILED', schemaVerifyResult.summary, {
140
+ return runnerFailure('SCHEMA_VERIFY_FAILED', schemaVerifyResult.summary, {
141
141
  why: 'The resulting database schema does not satisfy the destination contract.',
142
142
  meta: {
143
143
  issues: schemaVerifyResult.schema.issues,
@@ -313,7 +313,7 @@ class PostgresMigrationRunner implements SqlMigrationRunner<PostgresPlanTargetDe
313
313
  return okVoid();
314
314
  }
315
315
  return runnerFailure(
316
- 'MIGRATION.LEGACY_MARKER_SHAPE',
316
+ 'LEGACY_MARKER_SHAPE',
317
317
  'Legacy marker-table shape detected on prisma_contract.marker (no `space` column). ' +
318
318
  'Prisma Next is in pre-1.0; the previous transitional auto-migration to the per-space-row schema has been removed. ' +
319
319
  'Drop `prisma_contract.marker` and re-run `dbInit` to reinitialise from a clean baseline.',
@@ -335,8 +335,7 @@ class PostgresMigrationRunner implements SqlMigrationRunner<PostgresPlanTargetDe
335
335
  for (const step of steps) {
336
336
  const result = await driver.query(step.sql, step.params ?? []);
337
337
  if (!this.stepResultIsTrue(result.rows)) {
338
- const code =
339
- phase === 'precheck' ? 'MIGRATION.PRECHECK_FAILED' : 'MIGRATION.POSTCHECK_FAILED';
338
+ const code = phase === 'precheck' ? 'PRECHECK_FAILED' : 'POSTCHECK_FAILED';
340
339
  return runnerFailure(
341
340
  code,
342
341
  `Operation ${operation.id} failed during ${phase}: ${step.description}`,
@@ -364,7 +363,7 @@ class PostgresMigrationRunner implements SqlMigrationRunner<PostgresPlanTargetDe
364
363
  } catch (error: unknown) {
365
364
  if (SqlQueryError.is(error)) {
366
365
  return runnerFailure(
367
- 'MIGRATION.EXECUTION_FAILED',
366
+ 'EXECUTION_FAILED',
368
367
  `Operation ${operation.id} failed during execution: ${step.description}`,
369
368
  {
370
369
  why: error.message,
@@ -488,7 +487,7 @@ class PostgresMigrationRunner implements SqlMigrationRunner<PostgresPlanTargetDe
488
487
  for (const operation of operations) {
489
488
  if (!allowedClasses.has(operation.operationClass)) {
490
489
  return runnerFailure(
491
- 'MIGRATION.POLICY_VIOLATION',
490
+ 'POLICY_VIOLATION',
492
491
  `Operation ${operation.id} has class "${operation.operationClass}" which is not allowed by policy.`,
493
492
  {
494
493
  why: `Policy only allows: ${policy.allowedOperationClasses.join(', ')}.`,
@@ -518,7 +517,7 @@ class PostgresMigrationRunner implements SqlMigrationRunner<PostgresPlanTargetDe
518
517
 
519
518
  if (!marker) {
520
519
  return runnerFailure(
521
- 'MIGRATION.MARKER_ORIGIN_MISMATCH',
520
+ 'MARKER_ORIGIN_MISMATCH',
522
521
  `Missing contract marker: expected origin storage hash ${origin.storageHash}.`,
523
522
  {
524
523
  meta: {
@@ -529,7 +528,7 @@ class PostgresMigrationRunner implements SqlMigrationRunner<PostgresPlanTargetDe
529
528
  }
530
529
  if (marker.storageHash !== origin.storageHash) {
531
530
  return runnerFailure(
532
- 'MIGRATION.MARKER_ORIGIN_MISMATCH',
531
+ 'MARKER_ORIGIN_MISMATCH',
533
532
  `Existing contract marker (${marker.storageHash}) does not match plan origin (${origin.storageHash}).`,
534
533
  {
535
534
  meta: {
@@ -541,7 +540,7 @@ class PostgresMigrationRunner implements SqlMigrationRunner<PostgresPlanTargetDe
541
540
  }
542
541
  if (origin.profileHash && marker.profileHash !== origin.profileHash) {
543
542
  return runnerFailure(
544
- 'MIGRATION.MARKER_ORIGIN_MISMATCH',
543
+ 'MARKER_ORIGIN_MISMATCH',
545
544
  `Existing contract marker profile hash (${marker.profileHash}) does not match plan origin profile hash (${origin.profileHash}).`,
546
545
  {
547
546
  meta: {
@@ -560,7 +559,7 @@ class PostgresMigrationRunner implements SqlMigrationRunner<PostgresPlanTargetDe
560
559
  ): Result<void, SqlMigrationRunnerFailure> {
561
560
  if (destination.storageHash !== contract.storage.storageHash) {
562
561
  return runnerFailure(
563
- 'MIGRATION.DESTINATION_CONTRACT_MISMATCH',
562
+ 'DESTINATION_CONTRACT_MISMATCH',
564
563
  `Plan destination storage hash (${destination.storageHash}) does not match provided contract storage hash (${contract.storage.storageHash}).`,
565
564
  {
566
565
  meta: {
@@ -576,7 +575,7 @@ class PostgresMigrationRunner implements SqlMigrationRunner<PostgresPlanTargetDe
576
575
  destination.profileHash !== contract.profileHash
577
576
  ) {
578
577
  return runnerFailure(
579
- 'MIGRATION.DESTINATION_CONTRACT_MISMATCH',
578
+ 'DESTINATION_CONTRACT_MISMATCH',
580
579
  `Plan destination profile hash (${destination.profileHash}) does not match provided contract profile hash (${contract.profileHash}).`,
581
580
  {
582
581
  meta: {
@@ -615,7 +614,7 @@ class PostgresMigrationRunner implements SqlMigrationRunner<PostgresPlanTargetDe
615
614
  });
616
615
  if (!updated) {
617
616
  return runnerFailure(
618
- 'MIGRATION.MARKER_CAS_FAILURE',
617
+ 'MARKER_CAS_FAILURE',
619
618
  'Marker was modified by another process during migration execution.',
620
619
  {
621
620
  meta: {
@@ -1 +0,0 @@
1
- {"version":3,"file":"errors-ByDS0xJL.mjs","names":[],"sources":["../src/core/errors.ts"],"sourcesContent":["import { CliStructuredError } from '@prisma-next/errors/control';\n\n/**\n * A `PostgresMigration` operation that needs the materialized control adapter\n * — named by `operation` (e.g. `createTable`, `dropColumn`, `dataTransform`) —\n * was invoked, but the migration was constructed without a `ControlStack`.\n * Concrete authoring usage always goes through the migration CLI entrypoint,\n * which assembles a stack from the loaded `prisma-next.config.ts`; reaching this\n * error means a test fixture or ad-hoc consumer instantiated `PostgresMigration`\n * with the no-arg form (legal for `operations` / `describe` introspection only).\n *\n * The `operation` argument is required so every throw site names the operation\n * that actually failed; a new operation cannot inherit a misattributed message.\n *\n * Distinct from `MIGRATION.UNFILLED_PLACEHOLDER` (placeholder not filled)\n * and `MIGRATION.DATA_TRANSFORM_CONTRACT_MISMATCH` (data-transform query\n * plan against wrong contract) because the missing input is the stack\n * itself, not the per-operation contract.\n *\n * Lives in `@prisma-next/target-postgres/errors` rather than the shared\n * framework migration errors module because the failure is target-specific:\n * the contract it talks about (`PostgresMigration`, the Postgres control\n * adapter, the Postgres-target stack) only exists in this package.\n */\nexport function errorPostgresMigrationStackMissing(operation: string): CliStructuredError {\n return new CliStructuredError(\n 'MIGRATION.POSTGRES_CONTROL_STACK_MISSING',\n `PostgresMigration.${operation} requires a control adapter`,\n {\n why: `PostgresMigration.${operation} was invoked on an instance constructed without a ControlStack, so the stored controlAdapter is undefined and the operation cannot lower its plan.`,\n fix: 'Construct the migration via the migration CLI entrypoint (which assembles a ControlStack from the loaded prisma-next.config.ts), or pass a ControlStack containing a Postgres adapter to the migration constructor in test fixtures.',\n meta: { operation },\n },\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAwBA,SAAgB,mCAAmC,WAAuC;CACxF,OAAO,IAAI,mBACT,4CACA,qBAAqB,UAAU,8BAC/B;EACE,KAAK,qBAAqB,UAAU;EACpC,KAAK;EACL,MAAM,EAAE,UAAU;CACpB,CACF;AACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"op-factory-call-DuRj7WXX.mjs","names":["contractFreeDdl.alterTable","contractFreeDdl.dropDefaultAction","contractFreeDdl.addColumnAction","disableRowLevelSecurityDdl","contractFreeDdl.alterTable","contractFreeDdl.addColumnAction","contractFreeDdl.dropDefaultAction","exhaustive","contractFreeDdl.createTable","contractFreeDdl.alterTable","contractFreeDdl.addColumnAction","contractFreeDdl.createSchema"],"sources":["../src/core/migrations/bound-schema.ts","../src/core/migrations/operations/shared.ts","../src/core/migrations/operations/columns.ts","../src/core/migrations/operations/constraints.ts","../src/core/migrations/operations/dependencies.ts","../src/core/migrations/operations/indexes.ts","../src/core/migrations/operations/native-enum-types.ts","../src/core/migrations/operations/rls.ts","../src/core/migrations/operations/tables.ts","../src/core/migrations/planner-target-details.ts","../src/core/migrations/planner-recipes.ts","../src/core/migrations/op-factory-call.ts"],"sourcesContent":["import { UNBOUND_NAMESPACE_ID } from '@prisma-next/framework-components/ir';\n\n/**\n * Maps a planner schema name to the contract-free DDL builder's optional\n * `schema` field: the unbound sentinel becomes `undefined` (the builder omits\n * the schema qualifier), every other name passes through.\n */\nexport function boundSchema(schemaName: string): string | undefined {\n return schemaName === UNBOUND_NAMESPACE_ID ? undefined : schemaName;\n}\n","import type { SqlMigrationPlanOperation } from '@prisma-next/family-sql/control';\nimport type { ReferentialAction } from '@prisma-next/sql-contract/types';\nimport { ifDefined } from '@prisma-next/utils/defined';\nimport type { OperationClass, PostgresPlanTargetDetails } from '../planner-target-details';\n\nexport type Op = SqlMigrationPlanOperation<PostgresPlanTargetDetails>;\n\n/**\n * Literal-args shape for a foreign key definition. `references.schema`\n * carries the target table's namespace (schema) coordinate so the rendered\n * DDL qualifies the REFERENCES clause correctly for cross-schema FKs.\n */\nexport interface ForeignKeySpec {\n readonly name: string;\n readonly columns: readonly string[];\n readonly references: {\n readonly schema: string;\n readonly table: string;\n readonly columns: readonly string[];\n };\n readonly onDelete?: ReferentialAction;\n readonly onUpdate?: ReferentialAction;\n}\n\nexport function step(description: string, sql: string, params?: readonly unknown[]) {\n return { description, sql, ...ifDefined('params', params) };\n}\n\nexport function targetDetails(\n objectType: OperationClass,\n name: string,\n schema: string,\n table?: string,\n): { readonly id: 'postgres'; readonly details: PostgresPlanTargetDetails } {\n return {\n id: 'postgres',\n details: { schema, objectType, name, ...ifDefined('table', table) },\n };\n}\n","import type { ExecuteRequestLowerer } from '@prisma-next/family-sql/control-adapter';\nimport type { DdlColumn } from '@prisma-next/sql-relational-core/ast';\nimport { ifDefined } from '@prisma-next/utils/defined';\nimport {\n columnDefaultAst,\n columnExistsAst,\n columnNullabilityAst,\n columnTypeAst,\n noNullValuesAst,\n tableIsEmptyAst,\n} from '../../../contract-free/checks';\nimport * as contractFreeDdl from '../../../contract-free/ddl';\nimport { quoteIdentifier } from '../../sql-utils';\nimport { boundSchema } from '../bound-schema';\nimport { qualifyTableName } from '../planner-sql-checks';\nimport { type Op, step, targetDetails } from './shared';\n\ntype CheckStep = { sql: string; params?: readonly unknown[] };\n\nasync function columnExistsSteps(\n lowerer: ExecuteRequestLowerer,\n options: { schema: string; table: string; column: string },\n): Promise<{ present: CheckStep; absent: CheckStep }> {\n const checks = columnExistsAst(options);\n const present = await lowerer.lowerToExecuteRequest(checks.columnPresent());\n const absent = await lowerer.lowerToExecuteRequest(checks.columnAbsent());\n return { present, absent };\n}\n\nexport async function dropColumn(\n schemaName: string,\n tableName: string,\n columnName: string,\n lowerer: ExecuteRequestLowerer,\n): Promise<Op> {\n const qualified = qualifyTableName(schemaName, tableName);\n const { present, absent } = await columnExistsSteps(lowerer, {\n schema: schemaName,\n table: tableName,\n column: columnName,\n });\n return {\n id: `dropColumn.${tableName}.${columnName}`,\n label: `Drop column \"${columnName}\" from \"${tableName}\"`,\n operationClass: 'destructive',\n target: targetDetails('column', columnName, schemaName, tableName),\n precheck: [step(`ensure column \"${columnName}\" exists`, present.sql, present.params)],\n execute: [\n step(\n `drop column \"${columnName}\"`,\n `ALTER TABLE ${qualified} DROP COLUMN ${quoteIdentifier(columnName)}`,\n ),\n ],\n postcheck: [step(`verify column \"${columnName}\" does not exist`, absent.sql, absent.params)],\n };\n}\n\n/**\n * `qualifiedTargetType` is the new column type as it appears in the\n * `ALTER COLUMN TYPE` clause (schema-qualified for user-defined types, raw\n * native name for built-ins). `formatTypeExpected` is the unqualified\n * `format_type` form used in the postcheck. `rawTargetTypeForLabel` is the\n * string appearing in the human-readable label (typically `toType` when\n * explicit, else the column's native type).\n */\nexport async function alterColumnType(\n schemaName: string,\n tableName: string,\n columnName: string,\n options: {\n readonly qualifiedTargetType: string;\n readonly formatTypeExpected: string;\n readonly rawTargetTypeForLabel: string;\n readonly using?: string;\n },\n lowerer: ExecuteRequestLowerer,\n): Promise<Op> {\n const qualified = qualifyTableName(schemaName, tableName);\n const usingClause = options.using\n ? ` USING ${options.using}`\n : ` USING ${quoteIdentifier(columnName)}::${options.qualifiedTargetType}`;\n const { present } = await columnExistsSteps(lowerer, {\n schema: schemaName,\n table: tableName,\n column: columnName,\n });\n const typeCheck = await lowerer.lowerToExecuteRequest(\n columnTypeAst({\n schema: schemaName,\n table: tableName,\n column: columnName,\n expectedType: options.formatTypeExpected,\n }),\n );\n return {\n id: `alterType.${tableName}.${columnName}`,\n label: `Alter type of \"${tableName}\".\"${columnName}\" to ${options.rawTargetTypeForLabel}`,\n operationClass: 'destructive',\n target: targetDetails('column', columnName, schemaName, tableName),\n precheck: [step(`ensure column \"${columnName}\" exists`, present.sql, present.params)],\n execute: [\n step(\n `alter type of \"${columnName}\"`,\n `ALTER TABLE ${qualified} ALTER COLUMN ${quoteIdentifier(columnName)} TYPE ${options.qualifiedTargetType}${usingClause}`,\n ),\n ],\n postcheck: [\n step(\n `verify column \"${columnName}\" has type \"${options.formatTypeExpected}\"`,\n typeCheck.sql,\n typeCheck.params,\n ),\n ],\n meta: { warning: 'TABLE_REWRITE' },\n };\n}\n\nexport async function setNotNull(\n schemaName: string,\n tableName: string,\n columnName: string,\n lowerer: ExecuteRequestLowerer,\n): Promise<Op> {\n const qualified = qualifyTableName(schemaName, tableName);\n const { present } = await columnExistsSteps(lowerer, {\n schema: schemaName,\n table: tableName,\n column: columnName,\n });\n const noNulls = await lowerer.lowerToExecuteRequest(\n noNullValuesAst({ schema: schemaName, table: tableName, column: columnName }),\n );\n const notNullable = await lowerer.lowerToExecuteRequest(\n columnNullabilityAst({\n schema: schemaName,\n table: tableName,\n column: columnName,\n nullable: false,\n }),\n );\n return {\n id: `alterNullability.setNotNull.${tableName}.${columnName}`,\n label: `Set NOT NULL on \"${tableName}\".\"${columnName}\"`,\n operationClass: 'destructive',\n target: targetDetails('column', columnName, schemaName, tableName),\n precheck: [\n step(`ensure column \"${columnName}\" exists`, present.sql, present.params),\n step(`ensure no NULL values in \"${columnName}\"`, noNulls.sql, noNulls.params),\n ],\n execute: [\n step(\n `set NOT NULL on \"${columnName}\"`,\n `ALTER TABLE ${qualified} ALTER COLUMN ${quoteIdentifier(columnName)} SET NOT NULL`,\n ),\n ],\n postcheck: [\n step(`verify column \"${columnName}\" is NOT NULL`, notNullable.sql, notNullable.params),\n ],\n };\n}\n\nexport async function dropNotNull(\n schemaName: string,\n tableName: string,\n columnName: string,\n lowerer: ExecuteRequestLowerer,\n): Promise<Op> {\n const qualified = qualifyTableName(schemaName, tableName);\n const { present } = await columnExistsSteps(lowerer, {\n schema: schemaName,\n table: tableName,\n column: columnName,\n });\n const nullable = await lowerer.lowerToExecuteRequest(\n columnNullabilityAst({\n schema: schemaName,\n table: tableName,\n column: columnName,\n nullable: true,\n }),\n );\n return {\n id: `alterNullability.dropNotNull.${tableName}.${columnName}`,\n label: `Drop NOT NULL on \"${tableName}\".\"${columnName}\"`,\n operationClass: 'widening',\n target: targetDetails('column', columnName, schemaName, tableName),\n precheck: [step(`ensure column \"${columnName}\" exists`, present.sql, present.params)],\n execute: [\n step(\n `drop NOT NULL on \"${columnName}\"`,\n `ALTER TABLE ${qualified} ALTER COLUMN ${quoteIdentifier(columnName)} DROP NOT NULL`,\n ),\n ],\n postcheck: [step(`verify column \"${columnName}\" is nullable`, nullable.sql, nullable.params)],\n };\n}\n\n/**\n * `defaultSql` is the full `DEFAULT …` clause as produced by\n * `buildColumnDefaultSql` — e.g. `\"DEFAULT 42\"`,\n * `\"DEFAULT (CURRENT_TIMESTAMP)\"`, or `\"DEFAULT nextval('seq'::regclass)\"`.\n *\n * `operationClass` defaults to `'additive'` (setting a default on a column\n * that currently has none). The reconciliation planner passes `'widening'`\n * when the column already has a different default — policy enforcement\n * treats that as a widening change rather than an additive one.\n */\nexport async function setDefault(\n schemaName: string,\n tableName: string,\n columnName: string,\n defaultSql: string,\n lowerer: ExecuteRequestLowerer,\n operationClass: 'additive' | 'widening' = 'additive',\n): Promise<Op> {\n const qualified = qualifyTableName(schemaName, tableName);\n const { present } = await columnExistsSteps(lowerer, {\n schema: schemaName,\n table: tableName,\n column: columnName,\n });\n const hasDefault = await lowerer.lowerToExecuteRequest(\n columnDefaultAst({ schema: schemaName, table: tableName, column: columnName }).defaultPresent(),\n );\n return {\n id: `setDefault.${tableName}.${columnName}`,\n label: `Set default on \"${tableName}\".\"${columnName}\"`,\n operationClass,\n target: targetDetails('column', columnName, schemaName, tableName),\n precheck: [step(`ensure column \"${columnName}\" exists`, present.sql, present.params)],\n execute: [\n step(\n `set default on \"${columnName}\"`,\n `ALTER TABLE ${qualified} ALTER COLUMN ${quoteIdentifier(columnName)} SET ${defaultSql}`,\n ),\n ],\n postcheck: [\n step(`verify column \"${columnName}\" has a default`, hasDefault.sql, hasDefault.params),\n ],\n };\n}\n\nexport async function dropDefault(\n schemaName: string,\n tableName: string,\n columnName: string,\n lowerer: ExecuteRequestLowerer,\n): Promise<Op> {\n const { present } = await columnExistsSteps(lowerer, {\n schema: schemaName,\n table: tableName,\n column: columnName,\n });\n const dropDefaultExec = await lowerer.lowerToExecuteRequest(\n contractFreeDdl.alterTable({\n ...ifDefined('schema', boundSchema(schemaName)),\n table: tableName,\n actions: [contractFreeDdl.dropDefaultAction(columnName)],\n }),\n );\n const noDefault = await lowerer.lowerToExecuteRequest(\n columnDefaultAst({ schema: schemaName, table: tableName, column: columnName }).defaultAbsent(),\n );\n return {\n id: `dropDefault.${tableName}.${columnName}`,\n label: `Drop default on \"${tableName}\".\"${columnName}\"`,\n operationClass: 'destructive',\n target: targetDetails('column', columnName, schemaName, tableName),\n precheck: [step(`ensure column \"${columnName}\" exists`, present.sql, present.params)],\n execute: [step(`drop default on \"${columnName}\"`, dropDefaultExec.sql)],\n postcheck: [\n step(`verify column \"${columnName}\" has no default`, noDefault.sql, noDefault.params),\n ],\n };\n}\n\n/**\n * Builds the op for adding a NOT NULL column (no contract default) to a\n * non-empty table. Prechecks assert the column is absent and the table is\n * empty; the execute step lowers the typed `AddColumn` DDL node through the\n * adapter; postchecks assert the column exists and is NOT NULL.\n */\nexport async function addNotNullColumnDirect(\n schemaName: string,\n tableName: string,\n column: DdlColumn,\n lowerer: ExecuteRequestLowerer,\n): Promise<Op> {\n const columnName = column.name;\n const addColumn = await lowerer.lowerToExecuteRequest(\n contractFreeDdl.alterTable({\n ...ifDefined('schema', boundSchema(schemaName)),\n table: tableName,\n actions: [contractFreeDdl.addColumnAction(column)],\n }),\n );\n const absent = await lowerer.lowerToExecuteRequest(\n columnExistsAst({ schema: schemaName, table: tableName, column: columnName }).columnAbsent(),\n );\n const tableEmpty = await lowerer.lowerToExecuteRequest(tableIsEmptyAst(schemaName, tableName));\n const present = await lowerer.lowerToExecuteRequest(\n columnExistsAst({ schema: schemaName, table: tableName, column: columnName }).columnPresent(),\n );\n const notNullable = await lowerer.lowerToExecuteRequest(\n columnNullabilityAst({\n schema: schemaName,\n table: tableName,\n column: columnName,\n nullable: false,\n }),\n );\n return {\n id: `column.${tableName}.${columnName}`,\n label: `Add column ${columnName} to ${tableName}`,\n summary: `Adds column ${columnName} to table ${tableName}`,\n operationClass: 'additive',\n target: targetDetails('column', columnName, schemaName, tableName),\n precheck: [\n step(`ensure column \"${columnName}\" is missing`, absent.sql, absent.params),\n step(\n `ensure table \"${tableName}\" is empty before adding NOT NULL column without default`,\n tableEmpty.sql,\n tableEmpty.params,\n ),\n ],\n execute: [step(`add column \"${columnName}\"`, addColumn.sql)],\n postcheck: [\n step(`verify column \"${columnName}\" exists`, present.sql, present.params),\n step(`verify column \"${columnName}\" is NOT NULL`, notNullable.sql, notNullable.params),\n ],\n };\n}\n","import type { ExecuteRequestLowerer } from '@prisma-next/family-sql/control-adapter';\nimport { REFERENTIAL_ACTION_SQL } from '@prisma-next/sql-contract/referential-action-sql';\nimport { constraintExistsAst } from '../../../contract-free/checks';\nimport { escapeLiteral, quoteIdentifier } from '../../sql-utils';\nimport { qualifyTableName } from '../planner-sql-checks';\nimport { type ForeignKeySpec, type Op, step, targetDetails } from './shared';\n\nasync function constraintCheckSteps(\n lowerer: ExecuteRequestLowerer,\n options: { constraintName: string; schema: string; table: string },\n): Promise<{\n absent: { sql: string; params?: readonly unknown[] };\n present: { sql: string; params?: readonly unknown[] };\n}> {\n const checks = constraintExistsAst(options);\n const absent = await lowerer.lowerToExecuteRequest(checks.constraintAbsent());\n const present = await lowerer.lowerToExecuteRequest(checks.constraintPresent());\n return { absent, present };\n}\n\nfunction renderForeignKeySql(schemaName: string, tableName: string, fk: ForeignKeySpec): string {\n let sql = `ALTER TABLE ${qualifyTableName(schemaName, tableName)}\nADD CONSTRAINT ${quoteIdentifier(fk.name)}\nFOREIGN KEY (${fk.columns.map(quoteIdentifier).join(', ')})\nREFERENCES ${qualifyTableName(fk.references.schema, fk.references.table)} (${fk.references.columns\n .map(quoteIdentifier)\n .join(', ')})`;\n\n if (fk.onDelete !== undefined) {\n const action = REFERENTIAL_ACTION_SQL[fk.onDelete];\n if (!action) {\n throw new Error(`Unknown referential action for onDelete: ${String(fk.onDelete)}`);\n }\n sql += `\\nON DELETE ${action}`;\n }\n if (fk.onUpdate !== undefined) {\n const action = REFERENTIAL_ACTION_SQL[fk.onUpdate];\n if (!action) {\n throw new Error(`Unknown referential action for onUpdate: ${String(fk.onUpdate)}`);\n }\n sql += `\\nON UPDATE ${action}`;\n }\n return sql;\n}\n\nexport async function addPrimaryKey(\n schemaName: string,\n tableName: string,\n constraintName: string,\n columns: readonly string[],\n lowerer: ExecuteRequestLowerer,\n): Promise<Op> {\n const qualified = qualifyTableName(schemaName, tableName);\n const columnList = columns.map(quoteIdentifier).join(', ');\n const { absent, present } = await constraintCheckSteps(lowerer, {\n constraintName,\n schema: schemaName,\n table: tableName,\n });\n return {\n id: `primaryKey.${tableName}.${constraintName}`,\n label: `Add primary key on \"${tableName}\"`,\n operationClass: 'additive',\n target: targetDetails('primaryKey', constraintName, schemaName, tableName),\n precheck: [\n step(`ensure primary key \"${constraintName}\" does not exist`, absent.sql, absent.params),\n ],\n execute: [\n step(\n `add primary key \"${constraintName}\"`,\n `ALTER TABLE ${qualified} ADD CONSTRAINT ${quoteIdentifier(constraintName)} PRIMARY KEY (${columnList})`,\n ),\n ],\n postcheck: [step(`verify primary key \"${constraintName}\" exists`, present.sql, present.params)],\n };\n}\n\nexport async function addUnique(\n schemaName: string,\n tableName: string,\n constraintName: string,\n columns: readonly string[],\n lowerer: ExecuteRequestLowerer,\n): Promise<Op> {\n const qualified = qualifyTableName(schemaName, tableName);\n const columnList = columns.map(quoteIdentifier).join(', ');\n const { absent, present } = await constraintCheckSteps(lowerer, {\n constraintName,\n schema: schemaName,\n table: tableName,\n });\n return {\n id: `unique.${tableName}.${constraintName}`,\n label: `Add unique constraint on \"${tableName}\" (${columns.join(', ')})`,\n operationClass: 'additive',\n target: targetDetails('unique', constraintName, schemaName, tableName),\n precheck: [\n step(`ensure constraint \"${constraintName}\" does not exist`, absent.sql, absent.params),\n ],\n execute: [\n step(\n `add unique constraint \"${constraintName}\"`,\n `ALTER TABLE ${qualified} ADD CONSTRAINT ${quoteIdentifier(constraintName)} UNIQUE (${columnList})`,\n ),\n ],\n postcheck: [step(`verify constraint \"${constraintName}\" exists`, present.sql, present.params)],\n };\n}\n\nexport async function addForeignKey(\n schemaName: string,\n tableName: string,\n fk: ForeignKeySpec,\n lowerer: ExecuteRequestLowerer,\n): Promise<Op> {\n const { absent, present } = await constraintCheckSteps(lowerer, {\n constraintName: fk.name,\n schema: schemaName,\n table: tableName,\n });\n return {\n id: `foreignKey.${tableName}.${fk.name}`,\n label: `Add foreign key \"${fk.name}\" on \"${tableName}\"`,\n operationClass: 'additive',\n target: targetDetails('foreignKey', fk.name, schemaName, tableName),\n precheck: [step(`ensure FK \"${fk.name}\" does not exist`, absent.sql, absent.params)],\n execute: [step(`add FK \"${fk.name}\"`, renderForeignKeySql(schemaName, tableName, fk))],\n postcheck: [step(`verify FK \"${fk.name}\" exists`, present.sql, present.params)],\n };\n}\n\nexport async function addCheckConstraint(\n schemaName: string,\n tableName: string,\n constraintName: string,\n column: string,\n values: readonly string[],\n lowerer: ExecuteRequestLowerer,\n): Promise<Op> {\n const qualified = qualifyTableName(schemaName, tableName);\n const valueList = values.map((v) => `'${escapeLiteral(v)}'`).join(', ');\n const { absent, present } = await constraintCheckSteps(lowerer, {\n constraintName,\n schema: schemaName,\n table: tableName,\n });\n return {\n id: `checkConstraint.${tableName}.${constraintName}`,\n label: `Add check constraint \"${constraintName}\" on \"${tableName}\".\"${column}\"`,\n operationClass: 'additive',\n target: targetDetails('checkConstraint', constraintName, schemaName, tableName),\n precheck: [\n step(`ensure constraint \"${constraintName}\" does not exist`, absent.sql, absent.params),\n ],\n execute: [\n step(\n `add check constraint \"${constraintName}\"`,\n `ALTER TABLE ${qualified} ADD CONSTRAINT ${quoteIdentifier(constraintName)} CHECK (${quoteIdentifier(column)} IN (${valueList}))`,\n ),\n ],\n postcheck: [step(`verify constraint \"${constraintName}\" exists`, present.sql, present.params)],\n };\n}\n\nexport async function dropCheckConstraint(\n schemaName: string,\n tableName: string,\n constraintName: string,\n lowerer: ExecuteRequestLowerer,\n): Promise<Op> {\n const qualified = qualifyTableName(schemaName, tableName);\n const { absent, present } = await constraintCheckSteps(lowerer, {\n constraintName,\n schema: schemaName,\n table: tableName,\n });\n return {\n id: `dropCheckConstraint.${tableName}.${constraintName}`,\n label: `Drop check constraint \"${constraintName}\" on \"${tableName}\"`,\n operationClass: 'destructive',\n target: targetDetails('checkConstraint', constraintName, schemaName, tableName),\n precheck: [step(`ensure constraint \"${constraintName}\" exists`, present.sql, present.params)],\n execute: [\n step(\n `drop check constraint \"${constraintName}\"`,\n `ALTER TABLE ${qualified} DROP CONSTRAINT ${quoteIdentifier(constraintName)}`,\n ),\n ],\n postcheck: [\n step(`verify constraint \"${constraintName}\" does not exist`, absent.sql, absent.params),\n ],\n };\n}\n\n/**\n * `kind` feeds the operation's `target.details.objectType`. Descriptor-flow\n * does not carry kind information in its drop-constraint descriptor, so the\n * default is `'unique'`. The reconciliation planner passes the correct kind\n * (`'foreignKey'`, `'primaryKey'`, or `'unique'`) based on the diff issue\n * that produced the drop.\n */\nexport async function dropConstraint(\n schemaName: string,\n tableName: string,\n constraintName: string,\n lowerer: ExecuteRequestLowerer,\n kind: 'foreignKey' | 'unique' | 'primaryKey' = 'unique',\n): Promise<Op> {\n const qualified = qualifyTableName(schemaName, tableName);\n const { absent, present } = await constraintCheckSteps(lowerer, {\n constraintName,\n schema: schemaName,\n table: tableName,\n });\n return {\n id: `dropConstraint.${tableName}.${constraintName}`,\n label: `Drop constraint \"${constraintName}\" on \"${tableName}\"`,\n operationClass: 'destructive',\n target: targetDetails(kind, constraintName, schemaName, tableName),\n precheck: [step(`ensure constraint \"${constraintName}\" exists`, present.sql, present.params)],\n execute: [\n step(\n `drop constraint \"${constraintName}\"`,\n `ALTER TABLE ${qualified} DROP CONSTRAINT ${quoteIdentifier(constraintName)}`,\n ),\n ],\n postcheck: [\n step(`verify constraint \"${constraintName}\" does not exist`, absent.sql, absent.params),\n ],\n };\n}\n","import type { ExecuteRequestLowerer } from '@prisma-next/family-sql/control-adapter';\nimport { extensionExistsAst } from '../../../contract-free/checks';\nimport { DEFAULT_NAMESPACE_ID } from '../../namespace-ids';\nimport { quoteIdentifier } from '../../sql-utils';\nimport { type Op, step } from './shared';\n\nexport function createExtension(extensionName: string): Op {\n return {\n id: `extension.${extensionName}`,\n label: `Create extension \"${extensionName}\"`,\n operationClass: 'additive',\n target: { id: 'postgres' },\n precheck: [],\n execute: [\n step(\n `Create extension \"${extensionName}\"`,\n `CREATE EXTENSION IF NOT EXISTS ${quoteIdentifier(extensionName)}`,\n ),\n ],\n postcheck: [],\n };\n}\n\n/**\n * Install a Postgres extension as the baseline op for an extension-pack\n * contract space. Layered on top of {@link createExtension}: stamps an\n * `invariantId` (required so the per-space marker records the install),\n * scopes the op `id` under a caller-chosen namespace (e.g. `pgvector.`),\n * and emits pre- and postcheck SQL probing `pg_extension`. The richer\n * shape lets the runner's idempotency probe skip the install on re-run\n * (postcheck-pre-satisfied) without firing the precheck.\n *\n * Use this for hand-rolled baseline migrations in contract-space\n * extension packages (e.g. `extension-pgvector`, `extension-paradedb`);\n * use the bare {@link createExtension} for planner-emitted ops where the\n * caller already controls idempotency through the surrounding plan.\n */\nexport async function installExtension(\n options: {\n readonly extensionName: string;\n readonly invariantId: string;\n readonly id: string;\n readonly label?: string;\n },\n lowerer: ExecuteRequestLowerer,\n): Promise<Op> {\n const { extensionName, invariantId, id } = options;\n const label = options.label ?? `Enable extension \"${extensionName}\"`;\n const checks = extensionExistsAst(extensionName);\n const absent = await lowerer.lowerToExecuteRequest(checks.extensionAbsent());\n const present = await lowerer.lowerToExecuteRequest(checks.extensionPresent());\n return {\n id,\n label,\n operationClass: 'additive',\n invariantId,\n target: {\n id: 'postgres',\n details: { schema: DEFAULT_NAMESPACE_ID, objectType: 'dependency', name: extensionName },\n },\n precheck: [\n step(`verify extension \"${extensionName}\" is not already enabled`, absent.sql, absent.params),\n ],\n execute: [\n step(\n `create extension \"${extensionName}\"`,\n `CREATE EXTENSION IF NOT EXISTS ${extensionName}`,\n ),\n ],\n postcheck: [\n step(`confirm extension \"${extensionName}\" is enabled`, present.sql, present.params),\n ],\n };\n}\n","import type { ExecuteRequestLowerer } from '@prisma-next/family-sql/control-adapter';\nimport { indexExistsAst } from '../../../contract-free/checks';\nimport { escapeLiteral, quoteIdentifier } from '../../sql-utils';\nimport { qualifyTableName } from '../planner-sql-checks';\nimport { type Op, step, targetDetails } from './shared';\n\ntype CheckStep = { sql: string; params?: readonly unknown[] };\n\nasync function indexExistsSteps(\n lowerer: ExecuteRequestLowerer,\n schemaName: string,\n indexName: string,\n): Promise<{ present: CheckStep; absent: CheckStep }> {\n const checks = indexExistsAst(schemaName, indexName);\n const present = await lowerer.lowerToExecuteRequest(checks.indexPresent());\n const absent = await lowerer.lowerToExecuteRequest(checks.indexAbsent());\n return { present, absent };\n}\n\nexport interface CreateIndexExtras {\n readonly type?: string;\n readonly options?: Record<string, unknown>;\n}\n\nfunction renderIndexOptionValue(key: string, value: unknown): string {\n if (typeof value === 'string') return `'${escapeLiteral(value)}'`;\n if (typeof value === 'number' && Number.isFinite(value)) return String(value);\n if (typeof value === 'boolean') return value ? 'true' : 'false';\n throw new Error(\n `Index option \"${key}\" must be a string, finite number, or boolean; got ${typeof value}`,\n );\n}\n\nfunction renderIndexOptions(options: Record<string, unknown>): string {\n return Object.entries(options)\n .map(([key, value]) => `${quoteIdentifier(key)} = ${renderIndexOptionValue(key, value)}`)\n .join(', ');\n}\n\nexport async function createIndex(\n schemaName: string,\n tableName: string,\n indexName: string,\n columns: readonly string[],\n lowerer: ExecuteRequestLowerer,\n extras?: CreateIndexExtras,\n): Promise<Op> {\n const qualified = qualifyTableName(schemaName, tableName);\n const columnList = columns.map(quoteIdentifier).join(', ');\n const using = extras?.type ? ` USING ${quoteIdentifier(extras.type)}` : '';\n const options = extras?.options;\n const withClause =\n options && Object.keys(options).length > 0 ? ` WITH (${renderIndexOptions(options)})` : '';\n const { present, absent } = await indexExistsSteps(lowerer, schemaName, indexName);\n return {\n id: `index.${tableName}.${indexName}`,\n label: `Create index \"${indexName}\" on \"${tableName}\"`,\n operationClass: 'additive',\n target: targetDetails('index', indexName, schemaName, tableName),\n precheck: [step(`ensure index \"${indexName}\" does not exist`, absent.sql, absent.params)],\n execute: [\n step(\n `create index \"${indexName}\"`,\n `CREATE INDEX ${quoteIdentifier(indexName)} ON ${qualified}${using} (${columnList})${withClause}`,\n ),\n ],\n postcheck: [step(`verify index \"${indexName}\" exists`, present.sql, present.params)],\n };\n}\n\nexport async function dropIndex(\n schemaName: string,\n tableName: string,\n indexName: string,\n lowerer: ExecuteRequestLowerer,\n): Promise<Op> {\n const { present, absent } = await indexExistsSteps(lowerer, schemaName, indexName);\n return {\n id: `dropIndex.${tableName}.${indexName}`,\n label: `Drop index \"${indexName}\"`,\n operationClass: 'destructive',\n target: targetDetails('index', indexName, schemaName, tableName),\n precheck: [step(`ensure index \"${indexName}\" exists`, present.sql, present.params)],\n execute: [\n step(`drop index \"${indexName}\"`, `DROP INDEX ${qualifyTableName(schemaName, indexName)}`),\n ],\n postcheck: [step(`verify index \"${indexName}\" does not exist`, absent.sql, absent.params)],\n };\n}\n","import type { ExecuteRequestLowerer } from '@prisma-next/family-sql/control-adapter';\nimport { ifDefined } from '@prisma-next/utils/defined';\nimport { createType, dropType } from '../../../contract-free/ddl';\nimport { validateEnumValueLength } from '../../sql-utils';\nimport { boundSchema } from '../bound-schema';\nimport { type Op, step, targetDetails } from './shared';\n\n/**\n * `CREATE TYPE <qualified> AS ENUM (…)` for a managed native enum, built as a\n * typed DDL node and lowered by the control adapter (the type name is quoted,\n * member values render as escaped string literals in declaration order —\n * Postgres enum sort order is semantic). `boundSchema` maps the unbound sentinel\n * to an absent schema so the type name renders unqualified and the connection's\n * `search_path` resolves the schema at runtime.\n */\nexport async function createNativeEnumType(\n schemaName: string,\n typeName: string,\n members: readonly string[],\n lowerer: ExecuteRequestLowerer,\n): Promise<Op> {\n for (const member of members) {\n validateEnumValueLength(member, typeName);\n }\n const ddlNode = createType({\n ...ifDefined('schema', boundSchema(schemaName)),\n name: typeName,\n values: members,\n });\n const statement = await lowerer.lowerToExecuteRequest(ddlNode);\n return {\n id: `createNativeEnumType.${typeName}`,\n label: `Create enum type \"${typeName}\"`,\n operationClass: 'additive',\n target: targetDetails('type', typeName, schemaName),\n precheck: [],\n execute: [step(`create enum type \"${typeName}\"`, statement.sql, statement.params)],\n postcheck: [],\n };\n}\n\n/** `DROP TYPE <qualified>` for an unclaimed managed native enum, via typed DDL. */\nexport async function dropNativeEnumType(\n schemaName: string,\n typeName: string,\n lowerer: ExecuteRequestLowerer,\n): Promise<Op> {\n const ddlNode = dropType({\n ...ifDefined('schema', boundSchema(schemaName)),\n name: typeName,\n });\n const statement = await lowerer.lowerToExecuteRequest(ddlNode);\n return {\n id: `dropNativeEnumType.${typeName}`,\n label: `Drop enum type \"${typeName}\"`,\n operationClass: 'destructive',\n target: targetDetails('type', typeName, schemaName),\n precheck: [],\n execute: [step(`drop enum type \"${typeName}\"`, statement.sql, statement.params)],\n postcheck: [],\n };\n}\n","import type { ExecuteRequestLowerer } from '@prisma-next/family-sql/control-adapter';\nimport { ifDefined } from '@prisma-next/utils/defined';\nimport { rlsEnabledAst, rlsPolicyExistsAst } from '../../../contract-free/checks';\nimport {\n alterPolicyRename,\n createPolicy,\n disableRowLevelSecurity as disableRowLevelSecurityDdl,\n dropPolicy,\n} from '../../../contract-free/ddl';\nimport type { PostgresRlsPolicy } from '../../postgres-rls-policy';\nimport { qualifyTableName } from '../planner-sql-checks';\nimport { type Op, step, targetDetails } from './shared';\n\nconst PLAIN_IDENTIFIER = /^[A-Za-z_][A-Za-z0-9_$]*$/;\n\nfunction validateRoleName(role: string): string {\n if (!PLAIN_IDENTIFIER.test(role)) {\n throw new Error(\n `Invalid role name ${JSON.stringify(role)}: role names must be plain SQL identifiers matching ^[A-Za-z_][A-Za-z0-9_$]*$`,\n );\n }\n return role;\n}\n\nexport async function createRlsPolicy(\n schemaName: string,\n tableName: string,\n policy: PostgresRlsPolicy,\n lowerer: ExecuteRequestLowerer,\n): Promise<Op> {\n const validatedRoles = policy.roles.map(validateRoleName);\n const ddlNode = createPolicy({\n schema: schemaName,\n table: tableName,\n name: policy.name,\n permissive: policy.permissive,\n operation: policy.operation,\n roles: validatedRoles,\n ...ifDefined('using', policy.using),\n ...ifDefined('withCheck', policy.withCheck),\n });\n const checks = rlsPolicyExistsAst({\n schema: schemaName,\n table: tableName,\n policyName: policy.name,\n });\n const absent = await lowerer.lowerToExecuteRequest(checks.policyAbsent());\n const execute = await lowerer.lowerToExecuteRequest(ddlNode);\n const present = await lowerer.lowerToExecuteRequest(checks.policyPresent());\n return {\n id: `rlsPolicy.${schemaName}.${tableName}.${policy.name}`,\n label: `Create RLS policy \"${policy.name}\" on \"${tableName}\"`,\n operationClass: 'additive',\n target: targetDetails('rlsPolicy', policy.name, schemaName, tableName),\n precheck: [\n step(`ensure RLS policy \"${policy.name}\" does not exist`, absent.sql, absent.params),\n ],\n execute: [step(`create RLS policy \"${policy.name}\"`, execute.sql, execute.params)],\n postcheck: [step(`verify RLS policy \"${policy.name}\" exists`, present.sql, present.params)],\n };\n}\n\nexport async function dropRlsPolicy(\n schemaName: string,\n tableName: string,\n policyName: string,\n lowerer: ExecuteRequestLowerer,\n): Promise<Op> {\n const ddlNode = dropPolicy({ schema: schemaName, table: tableName, name: policyName });\n const checks = rlsPolicyExistsAst({ schema: schemaName, table: tableName, policyName });\n const present = await lowerer.lowerToExecuteRequest(checks.policyPresent());\n const execute = await lowerer.lowerToExecuteRequest(ddlNode);\n const absent = await lowerer.lowerToExecuteRequest(checks.policyAbsent());\n return {\n id: `rlsPolicy.${schemaName}.${tableName}.${policyName}.drop`,\n label: `Drop RLS policy \"${policyName}\" on \"${tableName}\"`,\n operationClass: 'destructive',\n target: targetDetails('rlsPolicy', policyName, schemaName, tableName),\n precheck: [step(`ensure RLS policy \"${policyName}\" exists`, present.sql, present.params)],\n execute: [step(`drop RLS policy \"${policyName}\"`, execute.sql, execute.params)],\n postcheck: [step(`verify RLS policy \"${policyName}\" is absent`, absent.sql, absent.params)],\n };\n}\n\nexport async function enableRowLevelSecurity(\n schemaName: string,\n tableName: string,\n lowerer: ExecuteRequestLowerer,\n): Promise<Op> {\n const checks = rlsEnabledAst(schemaName, tableName);\n const disabled = await lowerer.lowerToExecuteRequest(checks.rlsDisabled());\n const enabled = await lowerer.lowerToExecuteRequest(checks.rlsEnabled());\n return {\n id: `rowLevelSecurity.${schemaName}.${tableName}`,\n label: `Enable row-level security on \"${tableName}\"`,\n operationClass: 'additive',\n target: targetDetails('rowLevelSecurity', tableName, schemaName),\n precheck: [\n step(`check RLS is not already enabled on \"${tableName}\"`, disabled.sql, disabled.params),\n ],\n execute: [\n step(\n `enable row-level security on \"${tableName}\"`,\n `ALTER TABLE ${qualifyTableName(schemaName, tableName)} ENABLE ROW LEVEL SECURITY`,\n ),\n ],\n postcheck: [\n step(`verify row-level security is enabled on \"${tableName}\"`, enabled.sql, enabled.params),\n ],\n };\n}\n\nexport async function disableRowLevelSecurity(\n schemaName: string,\n tableName: string,\n lowerer: ExecuteRequestLowerer,\n): Promise<Op> {\n const ddlNode = disableRowLevelSecurityDdl({ schema: schemaName, table: tableName });\n const checks = rlsEnabledAst(schemaName, tableName);\n const enabled = await lowerer.lowerToExecuteRequest(checks.rlsEnabled());\n const execute = await lowerer.lowerToExecuteRequest(ddlNode);\n const disabled = await lowerer.lowerToExecuteRequest(checks.rlsDisabled());\n return {\n id: `rowLevelSecurity.${schemaName}.${tableName}.disable`,\n label: `Disable row-level security on \"${tableName}\"`,\n operationClass: 'destructive',\n target: targetDetails('rowLevelSecurity', tableName, schemaName),\n precheck: [\n step(`check RLS is currently enabled on \"${tableName}\"`, enabled.sql, enabled.params),\n ],\n execute: [step(`disable row-level security on \"${tableName}\"`, execute.sql, execute.params)],\n postcheck: [\n step(\n `verify row-level security is disabled on \"${tableName}\"`,\n disabled.sql,\n disabled.params,\n ),\n ],\n };\n}\n\nexport async function renameRlsPolicy(\n schemaName: string,\n tableName: string,\n oldPolicyName: string,\n newPolicyName: string,\n lowerer: ExecuteRequestLowerer,\n): Promise<Op> {\n const ddlNode = alterPolicyRename({\n schema: schemaName,\n table: tableName,\n name: oldPolicyName,\n newName: newPolicyName,\n });\n const oldChecks = rlsPolicyExistsAst({\n schema: schemaName,\n table: tableName,\n policyName: oldPolicyName,\n });\n const newChecks = rlsPolicyExistsAst({\n schema: schemaName,\n table: tableName,\n policyName: newPolicyName,\n });\n const oldPresent = await lowerer.lowerToExecuteRequest(oldChecks.policyPresent());\n const execute = await lowerer.lowerToExecuteRequest(ddlNode);\n const newPresent = await lowerer.lowerToExecuteRequest(newChecks.policyPresent());\n return {\n id: `rlsPolicy.${schemaName}.${tableName}.${oldPolicyName}.rename`,\n label: `Rename RLS policy \"${oldPolicyName}\" to \"${newPolicyName}\" on \"${tableName}\"`,\n operationClass: 'widening',\n target: targetDetails('rlsPolicy', newPolicyName, schemaName, tableName),\n precheck: [\n step(`ensure RLS policy \"${oldPolicyName}\" exists`, oldPresent.sql, oldPresent.params),\n ],\n execute: [\n step(\n `rename RLS policy \"${oldPolicyName}\" to \"${newPolicyName}\"`,\n execute.sql,\n execute.params,\n ),\n ],\n postcheck: [\n step(`verify RLS policy \"${newPolicyName}\" exists`, newPresent.sql, newPresent.params),\n ],\n };\n}\n","import type { ExecuteRequestLowerer } from '@prisma-next/family-sql/control-adapter';\nimport { tableExistsAst } from '../../../contract-free/checks';\nimport { qualifyTableName } from '../planner-sql-checks';\nimport { type Op, step, targetDetails } from './shared';\n\nexport async function dropTable(\n schemaName: string,\n tableName: string,\n lowerer: ExecuteRequestLowerer,\n): Promise<Op> {\n const qualified = qualifyTableName(schemaName, tableName);\n const checks = tableExistsAst(schemaName, tableName);\n const present = await lowerer.lowerToExecuteRequest(checks.tablePresent());\n const absent = await lowerer.lowerToExecuteRequest(checks.tableAbsent());\n return {\n id: `dropTable.${tableName}`,\n label: `Drop table \"${tableName}\"`,\n operationClass: 'destructive',\n target: targetDetails('table', tableName, schemaName),\n precheck: [step(`ensure table \"${tableName}\" exists`, present.sql, present.params)],\n execute: [step(`drop table \"${tableName}\"`, `DROP TABLE ${qualified}`)],\n postcheck: [step(`verify table \"${tableName}\" does not exist`, absent.sql, absent.params)],\n };\n}\n","import { ifDefined } from '@prisma-next/utils/defined';\n\nexport type OperationClass =\n | 'dependency'\n | 'type'\n | 'table'\n | 'column'\n | 'primaryKey'\n | 'unique'\n | 'index'\n | 'foreignKey'\n | 'checkConstraint'\n | 'rlsPolicy'\n | 'rowLevelSecurity';\n\nexport interface PostgresPlanTargetDetails {\n readonly schema: string;\n readonly objectType: OperationClass;\n readonly name: string;\n readonly table?: string;\n}\n\nexport function buildTargetDetails(\n objectType: OperationClass,\n name: string,\n schema: string,\n table?: string,\n): PostgresPlanTargetDetails {\n return {\n schema,\n objectType,\n name,\n ...ifDefined('table', table),\n };\n}\n","import type { CodecControlHooks, SqlMigrationPlanOperation } from '@prisma-next/family-sql/control';\nimport type { ExecuteRequestLowerer } from '@prisma-next/family-sql/control-adapter';\nimport type { StorageColumn, StorageTypeInstance } from '@prisma-next/sql-contract/types';\nimport { FunctionColumnDefault } from '@prisma-next/sql-relational-core/ast';\nimport { col } from '@prisma-next/sql-relational-core/contract-free';\nimport { ifDefined } from '@prisma-next/utils/defined';\nimport {\n columnDefaultAst,\n columnExistsAst,\n columnNullabilityAst,\n} from '../../contract-free/checks';\nimport * as contractFreeDdl from '../../contract-free/ddl';\nimport { boundSchema } from './bound-schema';\nimport { step } from './operations/shared';\nimport { buildColumnTypeSql } from './planner-ddl-builders';\nimport { buildTargetDetails, type PostgresPlanTargetDetails } from './planner-target-details';\n\nexport function buildAddColumnOperationIdentity(\n schema: string,\n tableName: string,\n columnName: string,\n): Pick<\n SqlMigrationPlanOperation<PostgresPlanTargetDetails>,\n 'id' | 'label' | 'summary' | 'target'\n> {\n return {\n id: `column.${tableName}.${columnName}`,\n label: `Add column ${columnName} to ${tableName}`,\n summary: `Adds column ${columnName} to table ${tableName}`,\n target: {\n id: 'postgres',\n details: buildTargetDetails('table', tableName, schema),\n },\n };\n}\n\nexport async function buildAddNotNullColumnWithTemporaryDefaultOperation(options: {\n readonly schema: string;\n readonly tableName: string;\n readonly columnName: string;\n readonly column: StorageColumn;\n readonly codecHooks: Map<string, CodecControlHooks>;\n readonly storageTypes: Record<string, StorageTypeInstance>;\n readonly temporaryDefault: string;\n readonly lowerer: ExecuteRequestLowerer;\n}): Promise<SqlMigrationPlanOperation<PostgresPlanTargetDetails>> {\n const {\n schema,\n tableName,\n columnName,\n column,\n codecHooks,\n storageTypes,\n temporaryDefault,\n lowerer,\n } = options;\n\n // The recipe handles NOT NULL columns that carry no contract default, so the\n // temporary backfill value is the only default. It is a pre-rendered SQL\n // fragment (e.g. `''`, `0`, `'{}'::jsonb`), carried verbatim as a\n // `FunctionColumnDefault` so the adapter emits it as a `DEFAULT (...)` clause.\n const ddlColumn = col(columnName, buildColumnTypeSql(column, codecHooks, storageTypes), {\n notNull: true,\n default: new FunctionColumnDefault(temporaryDefault),\n });\n const addColumn = await lowerer.lowerToExecuteRequest(\n contractFreeDdl.alterTable({\n ...ifDefined('schema', boundSchema(schema)),\n table: tableName,\n actions: [contractFreeDdl.addColumnAction(ddlColumn)],\n }),\n );\n const dropTempDefault = await lowerer.lowerToExecuteRequest(\n contractFreeDdl.alterTable({\n ...ifDefined('schema', boundSchema(schema)),\n table: tableName,\n actions: [contractFreeDdl.dropDefaultAction(columnName)],\n }),\n );\n\n const absent = await lowerer.lowerToExecuteRequest(\n columnExistsAst({ schema, table: tableName, column: columnName }).columnAbsent(),\n );\n const present = await lowerer.lowerToExecuteRequest(\n columnExistsAst({ schema, table: tableName, column: columnName }).columnPresent(),\n );\n const notNullable = await lowerer.lowerToExecuteRequest(\n columnNullabilityAst({ schema, table: tableName, column: columnName, nullable: false }),\n );\n const noDefault = await lowerer.lowerToExecuteRequest(\n columnDefaultAst({ schema, table: tableName, column: columnName }).noDefault(),\n );\n\n return {\n ...buildAddColumnOperationIdentity(schema, tableName, columnName),\n operationClass: 'additive',\n precheck: [step(`ensure column \"${columnName}\" is missing`, absent.sql, absent.params)],\n execute: [\n {\n description: `add column \"${columnName}\"`,\n sql: addColumn.sql,\n },\n {\n description: `drop temporary default from column \"${columnName}\"`,\n sql: dropTempDefault.sql,\n },\n ],\n postcheck: [\n step(`verify column \"${columnName}\" exists`, present.sql, present.params),\n step(`verify column \"${columnName}\" is NOT NULL`, notNullable.sql, notNullable.params),\n step(\n `verify column \"${columnName}\" has no default after temporary default removal`,\n noDefault.sql,\n noDefault.params,\n ),\n ],\n };\n}\n","/**\n * Postgres migration IR: one concrete `*Call` class per pure factory under\n * `operations/`, plus a shared `PostgresOpFactoryCallNode` abstract base.\n *\n * Every call class carries the literal arguments its backing factory would\n * receive, computes a human-readable `label` in its constructor, and\n * implements two polymorphic hooks:\n *\n * - `toOp()` — converts the IR node to a runtime\n * `SqlMigrationPlanOperation` by delegating to the matching pure factory\n * under `operations/`. `DataTransformCall.toOp()` always throws\n * `MIGRATION.UNFILLED_PLACEHOLDER` because a planner-generated data transform is an\n * unfilled authoring stub by construction.\n * - `renderTypeScript()` / `importRequirements()` — inherited from\n * `TsExpression`. Used by `renderCallsToTypeScript` to emit the call as\n * a TypeScript expression inside the scaffolded `migration.ts`.\n *\n * The abstract base and all concrete classes are package-private. External\n * consumers see only the framework-level `OpFactoryCall` interface and the\n * `PostgresOpFactoryCall` union.\n */\n\nimport { errorUnfilledPlaceholder } from '@prisma-next/errors/migration';\nimport type { CodecControlHooks, SqlMigrationPlanOperation } from '@prisma-next/family-sql/control';\nimport type { ExecuteRequestLowerer, Lowerer } from '@prisma-next/family-sql/control-adapter';\nimport type {\n OpFactoryCall as FrameworkOpFactoryCall,\n MigrationOperationClass,\n} from '@prisma-next/framework-components/control';\nimport { UNBOUND_NAMESPACE_ID } from '@prisma-next/framework-components/ir';\nimport type { StorageColumn, StorageTypeInstance } from '@prisma-next/sql-contract/types';\nimport type {\n AnyDdlColumnDefault,\n DdlColumn,\n DdlTableConstraint,\n} from '@prisma-next/sql-relational-core/ast';\nimport { FunctionColumnDefault, LiteralColumnDefault } from '@prisma-next/sql-relational-core/ast';\nimport { type ImportRequirement, jsonToTsSource, TsExpression } from '@prisma-next/ts-render';\nimport { blindCast } from '@prisma-next/utils/casts';\nimport { ifDefined } from '@prisma-next/utils/defined';\nimport {\n columnExistsAst,\n nativeEnumTypeExistsAst,\n nativeEnumValueExistsAst,\n tableExistsAst,\n} from '../../contract-free/checks';\nimport * as contractFreeDdl from '../../contract-free/ddl';\nimport type { PostgresRlsPolicy, PostgresRlsPolicyInput } from '../postgres-rls-policy';\nimport {\n escapeLiteral,\n quoteIdentifier,\n quoteQualifiedName,\n validateEnumValueLength,\n} from '../sql-utils';\nimport type { PostgresColumnDefault } from '../types';\nimport { boundSchema } from './bound-schema';\nimport {\n addNotNullColumnDirect,\n alterColumnType,\n dropColumn,\n dropDefault,\n dropNotNull,\n setDefault,\n setNotNull,\n} from './operations/columns';\nimport {\n addCheckConstraint,\n addForeignKey,\n addPrimaryKey,\n addUnique,\n dropCheckConstraint,\n dropConstraint,\n} from './operations/constraints';\nimport { createExtension } from './operations/dependencies';\nimport { createIndex, dropIndex } from './operations/indexes';\nimport { createNativeEnumType, dropNativeEnumType } from './operations/native-enum-types';\nimport {\n createRlsPolicy,\n disableRowLevelSecurity,\n dropRlsPolicy,\n enableRowLevelSecurity,\n renameRlsPolicy,\n} from './operations/rls';\nimport type { ForeignKeySpec } from './operations/shared';\nimport { step, targetDetails } from './operations/shared';\nimport { dropTable } from './operations/tables';\nimport { buildAddNotNullColumnWithTemporaryDefaultOperation } from './planner-recipes';\nimport type { PostgresPlanTargetDetails } from './planner-target-details';\n\ntype Op = SqlMigrationPlanOperation<PostgresPlanTargetDetails>;\n\n// Single module specifier emitted in user-edited `migration.ts` imports. The\n// Postgres migration facade re-exports both the `*Call` factory names\n// (createTable / addColumn / …) and the contract-free DDL builders\n// (col / lit / fn / primaryKey / foreignKey / unique) from\n// sql-relational-core/contract-free. We emit imports against the facade,\n// not against the underlying sql-relational-core subpath, because user\n// projects depend on `@prisma-next/postgres` (a runtime dep of every\n// init-scaffolded project) — they do not depend on the internal\n// `@prisma-next/sql-relational-core` package, so an emitted\n// `import … from '@prisma-next/sql-relational-core/contract-free'` fails\n// ESM resolution at runtime in user migrations even though pnpm has the\n// transitive package on disk.\nconst POSTGRES_MIGRATION_FACADE = '@prisma-next/postgres/migration';\n\nabstract class PostgresOpFactoryCallNode extends TsExpression implements FrameworkOpFactoryCall {\n abstract readonly factoryName: string;\n abstract readonly operationClass: MigrationOperationClass;\n abstract readonly label: string;\n abstract toOp(lowerer?: Lowerer): Op | Promise<Op>;\n\n importRequirements(): readonly ImportRequirement[] {\n return [{ moduleSpecifier: POSTGRES_MIGRATION_FACADE, symbol: this.factoryName }];\n }\n\n protected freeze(): void {\n Object.freeze(this);\n }\n}\n\n// ============================================================================\n// Table\n// ============================================================================\n\nexport function postgresDefaultToDdlColumnDefault(\n columnDefault: PostgresColumnDefault | undefined,\n): DdlColumn['default'] {\n if (!columnDefault) return undefined;\n switch (columnDefault.kind) {\n case 'literal':\n return new LiteralColumnDefault(columnDefault.value);\n case 'function':\n if (columnDefault.expression === 'autoincrement()') return undefined;\n return new FunctionColumnDefault(columnDefault.expression);\n case 'sequence':\n return new FunctionColumnDefault(\n `nextval('${escapeLiteral(quoteIdentifier(columnDefault.name))}'::regclass)`,\n );\n default: {\n const exhaustive: never = columnDefault;\n throw new Error(\n `postgresDefaultToDdlColumnDefault: unhandled kind \"${blindCast<{ kind: string }, 'exhaustiveness: surface the unhandled default kind'>(exhaustive).kind}\"`,\n );\n }\n }\n}\n\n// ---------------------------------------------------------------------------\n// TypeScript rendering helpers for DdlColumn / DdlTableConstraint\n// ---------------------------------------------------------------------------\n\nfunction renderDdlColumnDefault(def: AnyDdlColumnDefault | undefined): string {\n if (!def) return '';\n if (def.kind === 'literal') {\n return `lit(${jsonToTsSource(def.value)})`;\n }\n return `fn(${jsonToTsSource(def.expression)})`;\n}\n\nfunction renderDdlColumnAsTsCall(col: DdlColumn): string {\n const opts: string[] = [];\n if (col.notNull) opts.push('notNull: true');\n if (col.primaryKey) opts.push('primaryKey: true');\n if (col.default) opts.push(`default: ${renderDdlColumnDefault(col.default)}`);\n if (col.codecRef) opts.push(`codecRef: ${jsonToTsSource(col.codecRef)}`);\n const optsStr = opts.length > 0 ? `, { ${opts.join(', ')} }` : '';\n return `col(${jsonToTsSource(col.name)}, ${jsonToTsSource(col.type)}${optsStr})`;\n}\n\nfunction renderDdlConstraintAsTsCall(constraint: DdlTableConstraint): string {\n switch (constraint.kind) {\n case 'primary-key': {\n const nameOpt = constraint.name ? `, { name: ${jsonToTsSource(constraint.name)} }` : '';\n return `primaryKey(${jsonToTsSource(constraint.columns)}${nameOpt})`;\n }\n case 'foreign-key': {\n const opts: string[] = [];\n if (constraint.name) opts.push(`name: ${jsonToTsSource(constraint.name)}`);\n if (constraint.onDelete) opts.push(`onDelete: ${jsonToTsSource(constraint.onDelete)}`);\n if (constraint.onUpdate) opts.push(`onUpdate: ${jsonToTsSource(constraint.onUpdate)}`);\n const optsStr = opts.length > 0 ? `, { ${opts.join(', ')} }` : '';\n return `foreignKey(${jsonToTsSource(constraint.columns)}, ${jsonToTsSource(constraint.refTable)}, ${jsonToTsSource(constraint.refColumns)}${optsStr})`;\n }\n case 'unique': {\n const nameOpt = constraint.name ? `, { name: ${jsonToTsSource(constraint.name)} }` : '';\n return `unique(${jsonToTsSource(constraint.columns)}${nameOpt})`;\n }\n case 'check-expression':\n return `checkExpression(${jsonToTsSource(constraint.name)}, ${jsonToTsSource(constraint.expression)})`;\n }\n}\n\nfunction needsColOrConstraintImport(columns: readonly DdlColumn[]): boolean {\n return columns.length > 0;\n}\n\nfunction constraintImportSymbols(constraints: readonly DdlTableConstraint[] | undefined): string[] {\n if (!constraints || constraints.length === 0) return [];\n const symbols = new Set<string>();\n for (const c of constraints) {\n if (c.kind === 'primary-key') symbols.add('primaryKey');\n else if (c.kind === 'foreign-key') symbols.add('foreignKey');\n else if (c.kind === 'unique') symbols.add('unique');\n else if (c.kind === 'check-expression') symbols.add('checkExpression');\n }\n return [...symbols];\n}\n\nfunction defaultImportSymbols(columns: readonly DdlColumn[]): string[] {\n const symbols = new Set<string>();\n for (const col of columns) {\n if (col.default?.kind === 'literal') symbols.add('lit');\n else if (col.default?.kind === 'function') symbols.add('fn');\n }\n return [...symbols];\n}\n\nexport class CreateTableCall extends PostgresOpFactoryCallNode {\n readonly factoryName = 'createTable' as const;\n readonly operationClass = 'additive' as const;\n readonly schemaName: string;\n readonly tableName: string;\n readonly columns: readonly DdlColumn[];\n readonly constraints: readonly DdlTableConstraint[] | undefined;\n readonly label: string;\n\n constructor(\n schemaName: string,\n tableName: string,\n columns: readonly DdlColumn[],\n constraints?: readonly DdlTableConstraint[],\n ) {\n super();\n this.schemaName = schemaName;\n this.tableName = tableName;\n this.columns = Object.freeze([...columns]);\n this.constraints = constraints ? Object.freeze([...constraints]) : undefined;\n this.label = `Create table \"${tableName}\"`;\n this.freeze();\n }\n\n async toOp(lowerer?: ExecuteRequestLowerer): Promise<Op> {\n if (lowerer === undefined) {\n throw new Error(\n `CreateTableCall.toOp: a DDL lowerer is required on the Postgres planner path (table \"${this.tableName}\"). Pass the control adapter to createPostgresMigrationPlanner.`,\n );\n }\n const ddlNode = contractFreeDdl.createTable({\n ...ifDefined('schema', boundSchema(this.schemaName)),\n table: this.tableName,\n columns: this.columns,\n ...ifDefined('constraints', this.constraints),\n });\n const statement = await lowerer.lowerToExecuteRequest(ddlNode);\n const schemaName = this.schemaName;\n const tableName = this.tableName;\n const checks = tableExistsAst(schemaName, tableName);\n const absent = await lowerer.lowerToExecuteRequest(checks.tableAbsent());\n const present = await lowerer.lowerToExecuteRequest(checks.tablePresent());\n return {\n id: `table.${tableName}`,\n label: `Create table \"${tableName}\"`,\n summary: `Creates table \"${tableName}\"`,\n operationClass: 'additive',\n target: targetDetails('table', tableName, schemaName),\n precheck: [step(`ensure table \"${tableName}\" does not exist`, absent.sql, absent.params)],\n execute: [\n {\n description: `create table \"${tableName}\"`,\n sql: statement.sql,\n params: statement.params ?? [],\n },\n ],\n postcheck: [step(`verify table \"${tableName}\" exists`, present.sql, present.params)],\n };\n }\n\n renderTypeScript(): string {\n const columnsList = this.columns.map(renderDdlColumnAsTsCall).join(', ');\n const constraintsList = this.constraints\n ? this.constraints.map(renderDdlConstraintAsTsCall).join(', ')\n : undefined;\n\n const opts: string[] = [];\n if (this.schemaName !== UNBOUND_NAMESPACE_ID) {\n opts.push(`schema: ${jsonToTsSource(this.schemaName)}`);\n }\n opts.push(`table: ${jsonToTsSource(this.tableName)}`);\n opts.push(`columns: [${columnsList}]`);\n if (constraintsList) opts.push(`constraints: [${constraintsList}]`);\n\n return `this.createTable({ ${opts.join(', ')} })`;\n }\n\n override importRequirements(): readonly ImportRequirement[] {\n const req: ImportRequirement[] = [];\n if (needsColOrConstraintImport(this.columns)) {\n req.push({ moduleSpecifier: POSTGRES_MIGRATION_FACADE, symbol: 'col' });\n for (const sym of defaultImportSymbols(this.columns)) {\n req.push({ moduleSpecifier: POSTGRES_MIGRATION_FACADE, symbol: sym });\n }\n }\n for (const sym of constraintImportSymbols(this.constraints)) {\n req.push({ moduleSpecifier: POSTGRES_MIGRATION_FACADE, symbol: sym });\n }\n return req;\n }\n}\n\nexport class DropTableCall extends PostgresOpFactoryCallNode {\n readonly factoryName = 'dropTable' as const;\n readonly operationClass = 'destructive' as const;\n readonly schemaName: string;\n readonly tableName: string;\n readonly label: string;\n\n constructor(schemaName: string, tableName: string) {\n super();\n this.schemaName = schemaName;\n this.tableName = tableName;\n this.label = `Drop table \"${tableName}\"`;\n this.freeze();\n }\n\n async toOp(lowerer?: ExecuteRequestLowerer): Promise<Op> {\n if (lowerer === undefined) {\n throw new Error(\n `DropTableCall.toOp: a lowerer is required on the Postgres planner path (table \"${this.tableName}\"). Pass the control adapter to createPostgresMigrationPlanner.`,\n );\n }\n return dropTable(this.schemaName, this.tableName, lowerer);\n }\n\n renderTypeScript(): string {\n const opts: string[] = [];\n if (this.schemaName !== UNBOUND_NAMESPACE_ID) {\n opts.push(`schema: ${jsonToTsSource(this.schemaName)}`);\n }\n opts.push(`table: ${jsonToTsSource(this.tableName)}`);\n return `this.dropTable({ ${opts.join(', ')} })`;\n }\n\n override importRequirements(): readonly ImportRequirement[] {\n return [];\n }\n}\n\n// ============================================================================\n// Column\n// ============================================================================\n\nexport class AddColumnCall extends PostgresOpFactoryCallNode {\n readonly factoryName = 'addColumn' as const;\n readonly operationClass = 'additive' as const;\n readonly schemaName: string;\n readonly tableName: string;\n readonly column: DdlColumn;\n readonly label: string;\n\n constructor(schemaName: string, tableName: string, column: DdlColumn) {\n super();\n this.schemaName = schemaName;\n this.tableName = tableName;\n this.column = column;\n this.label = `Add column \"${column.name}\" to \"${tableName}\"`;\n this.freeze();\n }\n\n async toOp(lowerer?: ExecuteRequestLowerer): Promise<Op> {\n if (lowerer === undefined) {\n throw new Error(\n `AddColumnCall.toOp: a DDL lowerer is required on the Postgres planner path (column \"${this.column.name}\" on table \"${this.tableName}\"). Pass the control adapter to createPostgresMigrationPlanner.`,\n );\n }\n const ddlNode = contractFreeDdl.alterTable({\n ...ifDefined('schema', boundSchema(this.schemaName)),\n table: this.tableName,\n actions: [contractFreeDdl.addColumnAction(this.column)],\n });\n const statement = await lowerer.lowerToExecuteRequest(ddlNode);\n const schemaName = this.schemaName;\n const tableName = this.tableName;\n const columnName = this.column.name;\n const colChecks = columnExistsAst({ schema: schemaName, table: tableName, column: columnName });\n const absent = await lowerer.lowerToExecuteRequest(colChecks.columnAbsent());\n const present = await lowerer.lowerToExecuteRequest(colChecks.columnPresent());\n return {\n id: `column.${schemaName}.${tableName}.${columnName}`,\n label: `Add column \"${columnName}\" to \"${tableName}\"`,\n operationClass: 'additive',\n target: targetDetails('column', columnName, schemaName, tableName),\n precheck: [step(`ensure column \"${columnName}\" is missing`, absent.sql, absent.params)],\n execute: [step(`add column \"${columnName}\"`, statement.sql)],\n postcheck: [step(`verify column \"${columnName}\" exists`, present.sql, present.params)],\n };\n }\n\n renderTypeScript(): string {\n const opts: string[] = [];\n if (this.schemaName !== UNBOUND_NAMESPACE_ID) {\n opts.push(`schema: ${jsonToTsSource(this.schemaName)}`);\n }\n opts.push(`table: ${jsonToTsSource(this.tableName)}`);\n opts.push(`column: ${renderDdlColumnAsTsCall(this.column)}`);\n return `this.addColumn({ ${opts.join(', ')} })`;\n }\n\n override importRequirements(): readonly ImportRequirement[] {\n const req: ImportRequirement[] = [\n { moduleSpecifier: POSTGRES_MIGRATION_FACADE, symbol: 'col' },\n ];\n for (const sym of defaultImportSymbols([this.column])) {\n req.push({ moduleSpecifier: POSTGRES_MIGRATION_FACADE, symbol: sym });\n }\n return req;\n }\n}\n\nexport class DropColumnCall extends PostgresOpFactoryCallNode {\n readonly factoryName = 'dropColumn' as const;\n readonly operationClass = 'destructive' as const;\n readonly schemaName: string;\n readonly tableName: string;\n readonly columnName: string;\n readonly label: string;\n\n constructor(schemaName: string, tableName: string, columnName: string) {\n super();\n this.schemaName = schemaName;\n this.tableName = tableName;\n this.columnName = columnName;\n this.label = `Drop column \"${columnName}\" from \"${tableName}\"`;\n this.freeze();\n }\n\n async toOp(lowerer?: ExecuteRequestLowerer): Promise<Op> {\n if (lowerer === undefined) {\n throw new Error(\n `DropColumnCall.toOp: a lowerer is required on the Postgres planner path (column \"${this.columnName}\" on table \"${this.tableName}\"). Pass the control adapter to createPostgresMigrationPlanner.`,\n );\n }\n return dropColumn(this.schemaName, this.tableName, this.columnName, lowerer);\n }\n\n renderTypeScript(): string {\n const opts: string[] = [];\n if (this.schemaName !== UNBOUND_NAMESPACE_ID) {\n opts.push(`schema: ${jsonToTsSource(this.schemaName)}`);\n }\n opts.push(`table: ${jsonToTsSource(this.tableName)}`);\n opts.push(`column: ${jsonToTsSource(this.columnName)}`);\n return `this.dropColumn({ ${opts.join(', ')} })`;\n }\n\n override importRequirements(): readonly ImportRequirement[] {\n return [];\n }\n}\n\nexport interface AlterColumnTypeOptions {\n readonly qualifiedTargetType: string;\n readonly formatTypeExpected: string;\n readonly rawTargetTypeForLabel: string;\n readonly using?: string;\n}\n\nexport class AlterColumnTypeCall extends PostgresOpFactoryCallNode {\n readonly factoryName = 'alterColumnType' as const;\n readonly operationClass = 'destructive' as const;\n readonly schemaName: string;\n readonly tableName: string;\n readonly columnName: string;\n readonly options: AlterColumnTypeOptions;\n readonly label: string;\n\n constructor(\n schemaName: string,\n tableName: string,\n columnName: string,\n options: AlterColumnTypeOptions,\n ) {\n super();\n this.schemaName = schemaName;\n this.tableName = tableName;\n this.columnName = columnName;\n this.options = options;\n this.label = `Alter type of \"${tableName}\".\"${columnName}\" to ${options.rawTargetTypeForLabel}`;\n this.freeze();\n }\n\n async toOp(lowerer?: ExecuteRequestLowerer): Promise<Op> {\n if (lowerer === undefined) {\n throw new Error(\n `AlterColumnTypeCall.toOp: a lowerer is required on the Postgres planner path (column \"${this.columnName}\" on table \"${this.tableName}\"). Pass the control adapter to createPostgresMigrationPlanner.`,\n );\n }\n return alterColumnType(this.schemaName, this.tableName, this.columnName, this.options, lowerer);\n }\n\n renderTypeScript(): string {\n const opts: string[] = [];\n if (this.schemaName !== UNBOUND_NAMESPACE_ID) {\n opts.push(`schema: ${jsonToTsSource(this.schemaName)}`);\n }\n opts.push(`table: ${jsonToTsSource(this.tableName)}`);\n opts.push(`column: ${jsonToTsSource(this.columnName)}`);\n opts.push(`options: ${jsonToTsSource(this.options)}`);\n return `this.alterColumnType({ ${opts.join(', ')} })`;\n }\n\n override importRequirements(): readonly ImportRequirement[] {\n return [];\n }\n}\n\nexport class SetNotNullCall extends PostgresOpFactoryCallNode {\n readonly factoryName = 'setNotNull' as const;\n readonly operationClass = 'destructive' as const;\n readonly schemaName: string;\n readonly tableName: string;\n readonly columnName: string;\n readonly label: string;\n\n constructor(schemaName: string, tableName: string, columnName: string) {\n super();\n this.schemaName = schemaName;\n this.tableName = tableName;\n this.columnName = columnName;\n this.label = `Set NOT NULL on \"${tableName}\".\"${columnName}\"`;\n this.freeze();\n }\n\n async toOp(lowerer?: ExecuteRequestLowerer): Promise<Op> {\n if (lowerer === undefined) {\n throw new Error(\n `SetNotNullCall.toOp: a lowerer is required on the Postgres planner path (column \"${this.columnName}\" on table \"${this.tableName}\"). Pass the control adapter to createPostgresMigrationPlanner.`,\n );\n }\n return setNotNull(this.schemaName, this.tableName, this.columnName, lowerer);\n }\n\n renderTypeScript(): string {\n const opts: string[] = [];\n if (this.schemaName !== UNBOUND_NAMESPACE_ID) {\n opts.push(`schema: ${jsonToTsSource(this.schemaName)}`);\n }\n opts.push(`table: ${jsonToTsSource(this.tableName)}`);\n opts.push(`column: ${jsonToTsSource(this.columnName)}`);\n return `this.setNotNull({ ${opts.join(', ')} })`;\n }\n\n override importRequirements(): readonly ImportRequirement[] {\n return [];\n }\n}\n\nexport class DropNotNullCall extends PostgresOpFactoryCallNode {\n readonly factoryName = 'dropNotNull' as const;\n readonly operationClass = 'widening' as const;\n readonly schemaName: string;\n readonly tableName: string;\n readonly columnName: string;\n readonly label: string;\n\n constructor(schemaName: string, tableName: string, columnName: string) {\n super();\n this.schemaName = schemaName;\n this.tableName = tableName;\n this.columnName = columnName;\n this.label = `Drop NOT NULL on \"${tableName}\".\"${columnName}\"`;\n this.freeze();\n }\n\n async toOp(lowerer?: ExecuteRequestLowerer): Promise<Op> {\n if (lowerer === undefined) {\n throw new Error(\n `DropNotNullCall.toOp: a lowerer is required on the Postgres planner path (column \"${this.columnName}\" on table \"${this.tableName}\"). Pass the control adapter to createPostgresMigrationPlanner.`,\n );\n }\n return dropNotNull(this.schemaName, this.tableName, this.columnName, lowerer);\n }\n\n renderTypeScript(): string {\n const opts: string[] = [];\n if (this.schemaName !== UNBOUND_NAMESPACE_ID) {\n opts.push(`schema: ${jsonToTsSource(this.schemaName)}`);\n }\n opts.push(`table: ${jsonToTsSource(this.tableName)}`);\n opts.push(`column: ${jsonToTsSource(this.columnName)}`);\n return `this.dropNotNull({ ${opts.join(', ')} })`;\n }\n\n override importRequirements(): readonly ImportRequirement[] {\n return [];\n }\n}\n\nexport class SetDefaultCall extends PostgresOpFactoryCallNode {\n readonly factoryName = 'setDefault' as const;\n readonly operationClass: 'additive' | 'widening';\n readonly schemaName: string;\n readonly tableName: string;\n readonly columnName: string;\n readonly defaultSql: string;\n readonly label: string;\n\n constructor(\n schemaName: string,\n tableName: string,\n columnName: string,\n defaultSql: string,\n operationClass: 'additive' | 'widening' = 'additive',\n ) {\n super();\n this.schemaName = schemaName;\n this.tableName = tableName;\n this.columnName = columnName;\n this.defaultSql = defaultSql;\n this.operationClass = operationClass;\n this.label = `Set default on \"${tableName}\".\"${columnName}\"`;\n this.freeze();\n }\n\n async toOp(lowerer?: ExecuteRequestLowerer): Promise<Op> {\n if (lowerer === undefined) {\n throw new Error(\n `SetDefaultCall.toOp: a lowerer is required on the Postgres planner path (column \"${this.columnName}\" on table \"${this.tableName}\"). Pass the control adapter to createPostgresMigrationPlanner.`,\n );\n }\n return setDefault(\n this.schemaName,\n this.tableName,\n this.columnName,\n this.defaultSql,\n lowerer,\n this.operationClass,\n );\n }\n\n renderTypeScript(): string {\n const opts: string[] = [];\n if (this.schemaName !== UNBOUND_NAMESPACE_ID) {\n opts.push(`schema: ${jsonToTsSource(this.schemaName)}`);\n }\n opts.push(`table: ${jsonToTsSource(this.tableName)}`);\n opts.push(`column: ${jsonToTsSource(this.columnName)}`);\n opts.push(`defaultSql: ${jsonToTsSource(this.defaultSql)}`);\n if (this.operationClass !== 'additive') {\n opts.push(`operationClass: ${jsonToTsSource(this.operationClass)}`);\n }\n return `this.setDefault({ ${opts.join(', ')} })`;\n }\n\n override importRequirements(): readonly ImportRequirement[] {\n return [];\n }\n}\n\nexport class DropDefaultCall extends PostgresOpFactoryCallNode {\n readonly factoryName = 'dropDefault' as const;\n readonly operationClass = 'destructive' as const;\n readonly schemaName: string;\n readonly tableName: string;\n readonly columnName: string;\n readonly label: string;\n\n constructor(schemaName: string, tableName: string, columnName: string) {\n super();\n this.schemaName = schemaName;\n this.tableName = tableName;\n this.columnName = columnName;\n this.label = `Drop default on \"${tableName}\".\"${columnName}\"`;\n this.freeze();\n }\n\n async toOp(lowerer?: ExecuteRequestLowerer): Promise<Op> {\n if (lowerer === undefined) {\n throw new Error(\n `DropDefaultCall.toOp: a lowerer is required on the Postgres planner path (column \"${this.columnName}\" on table \"${this.tableName}\"). Pass the control adapter to createPostgresMigrationPlanner.`,\n );\n }\n return dropDefault(this.schemaName, this.tableName, this.columnName, lowerer);\n }\n\n renderTypeScript(): string {\n const opts: string[] = [];\n if (this.schemaName !== UNBOUND_NAMESPACE_ID) {\n opts.push(`schema: ${jsonToTsSource(this.schemaName)}`);\n }\n opts.push(`table: ${jsonToTsSource(this.tableName)}`);\n opts.push(`column: ${jsonToTsSource(this.columnName)}`);\n return `this.dropDefault({ ${opts.join(', ')} })`;\n }\n\n override importRequirements(): readonly ImportRequirement[] {\n return [];\n }\n}\n\n// ============================================================================\n// NOT NULL column additions (planner-internal; no authored surface)\n// ============================================================================\n\n/**\n * Planner-internal call for adding a NOT NULL column (no contract default) to\n * a table that must be empty at migration time. Carries the typed `DdlColumn`\n * and lowers it to an ADD COLUMN execute step via the adapter at `toOp` time.\n *\n * No authored `PostgresMigration` method: this call is only emitted by the\n * planner, never hand-written by migration authors.\n */\nexport class AddNotNullColumnDirectCall extends PostgresOpFactoryCallNode {\n readonly factoryName = 'rawSql' as const;\n readonly operationClass = 'additive' as const;\n readonly schemaName: string;\n readonly tableName: string;\n readonly columnName: string;\n readonly column: DdlColumn;\n readonly label: string;\n\n constructor(schemaName: string, tableName: string, columnName: string, column: DdlColumn) {\n super();\n this.schemaName = schemaName;\n this.tableName = tableName;\n this.columnName = columnName;\n this.column = column;\n this.label = `Add column ${columnName} to ${tableName}`;\n this.freeze();\n }\n\n async toOp(lowerer?: ExecuteRequestLowerer): Promise<Op> {\n if (lowerer === undefined) {\n throw new Error(\n `AddNotNullColumnDirectCall.toOp: a lowerer is required on the Postgres planner path (column \"${this.columnName}\" on table \"${this.tableName}\"). Pass the control adapter to createPostgresMigrationPlanner.`,\n );\n }\n return addNotNullColumnDirect(this.schemaName, this.tableName, this.column, lowerer);\n }\n\n renderTypeScript(): string {\n return `rawSql(${jsonToTsSource({ id: `column.${this.tableName}.${this.columnName}`, label: this.label, operationClass: 'additive' })})`;\n }\n}\n\n/**\n * Planner-internal call for adding a NOT NULL column (no contract default)\n * using a temporary default value for non-empty tables. Carries all parameters\n * needed for `buildAddNotNullColumnWithTemporaryDefaultOperation`; both the\n * typed ADD COLUMN execute step and the pre/postchecks are lowered via the\n * adapter at `toOp` time.\n *\n * No authored `PostgresMigration` method: this call is only emitted by the\n * planner, never hand-written by migration authors.\n */\nexport class AddNotNullColumnWithTempDefaultCall extends PostgresOpFactoryCallNode {\n readonly factoryName = 'rawSql' as const;\n readonly operationClass = 'additive' as const;\n readonly schemaName: string;\n readonly tableName: string;\n readonly columnName: string;\n readonly column: StorageColumn;\n readonly codecHooks: Map<string, CodecControlHooks>;\n readonly storageTypes: Record<string, StorageTypeInstance>;\n readonly temporaryDefault: string;\n readonly label: string;\n\n constructor(options: {\n readonly schemaName: string;\n readonly tableName: string;\n readonly columnName: string;\n readonly column: StorageColumn;\n readonly codecHooks: Map<string, CodecControlHooks>;\n readonly storageTypes: Record<string, StorageTypeInstance>;\n readonly temporaryDefault: string;\n }) {\n super();\n this.schemaName = options.schemaName;\n this.tableName = options.tableName;\n this.columnName = options.columnName;\n this.column = options.column;\n this.codecHooks = options.codecHooks;\n this.storageTypes = options.storageTypes;\n this.temporaryDefault = options.temporaryDefault;\n this.label = `Add column ${options.columnName} to ${options.tableName}`;\n this.freeze();\n }\n\n async toOp(lowerer?: ExecuteRequestLowerer): Promise<Op> {\n if (lowerer === undefined) {\n throw new Error(\n `AddNotNullColumnWithTempDefaultCall.toOp: a lowerer is required on the Postgres planner path (column \"${this.columnName}\" on table \"${this.tableName}\"). Pass the control adapter to createPostgresMigrationPlanner.`,\n );\n }\n return buildAddNotNullColumnWithTemporaryDefaultOperation({\n schema: this.schemaName,\n tableName: this.tableName,\n columnName: this.columnName,\n column: this.column,\n codecHooks: this.codecHooks,\n storageTypes: this.storageTypes,\n temporaryDefault: this.temporaryDefault,\n lowerer,\n });\n }\n\n renderTypeScript(): string {\n return `rawSql(${jsonToTsSource({ id: `column.${this.tableName}.${this.columnName}`, label: this.label, operationClass: 'additive' })})`;\n }\n}\n\n// ============================================================================\n// Constraints\n// ============================================================================\n\nfunction constraintCallOptions(\n schemaName: string,\n tableName: string,\n constraintName: string,\n): string {\n const opts: string[] = [];\n if (schemaName !== UNBOUND_NAMESPACE_ID) {\n opts.push(`schema: ${jsonToTsSource(schemaName)}`);\n }\n opts.push(`table: ${jsonToTsSource(tableName)}`);\n opts.push(`constraint: ${jsonToTsSource(constraintName)}`);\n return opts.join(', ');\n}\n\nexport class AddPrimaryKeyCall extends PostgresOpFactoryCallNode {\n readonly factoryName = 'addPrimaryKey' as const;\n readonly operationClass = 'additive' as const;\n readonly schemaName: string;\n readonly tableName: string;\n readonly constraintName: string;\n readonly columns: readonly string[];\n readonly label: string;\n\n constructor(\n schemaName: string,\n tableName: string,\n constraintName: string,\n columns: readonly string[],\n ) {\n super();\n this.schemaName = schemaName;\n this.tableName = tableName;\n this.constraintName = constraintName;\n this.columns = columns;\n this.label = `Add primary key on \"${tableName}\"`;\n this.freeze();\n }\n\n async toOp(lowerer?: ExecuteRequestLowerer): Promise<Op> {\n if (lowerer === undefined) {\n throw new Error(\n `AddPrimaryKeyCall.toOp: a lowerer is required on the Postgres planner path (constraint \"${this.constraintName}\" on table \"${this.tableName}\"). Pass the control adapter to createPostgresMigrationPlanner.`,\n );\n }\n return addPrimaryKey(\n this.schemaName,\n this.tableName,\n this.constraintName,\n this.columns,\n lowerer,\n );\n }\n\n renderTypeScript(): string {\n return `this.addPrimaryKey({ ${constraintCallOptions(this.schemaName, this.tableName, this.constraintName)}, columns: ${jsonToTsSource(this.columns)} })`;\n }\n\n override importRequirements(): readonly ImportRequirement[] {\n return [];\n }\n}\n\nexport class AddUniqueCall extends PostgresOpFactoryCallNode {\n readonly factoryName = 'addUnique' as const;\n readonly operationClass = 'additive' as const;\n readonly schemaName: string;\n readonly tableName: string;\n readonly constraintName: string;\n readonly columns: readonly string[];\n readonly label: string;\n\n constructor(\n schemaName: string,\n tableName: string,\n constraintName: string,\n columns: readonly string[],\n ) {\n super();\n this.schemaName = schemaName;\n this.tableName = tableName;\n this.constraintName = constraintName;\n this.columns = columns;\n this.label = `Add unique constraint on \"${tableName}\" (${columns.join(', ')})`;\n this.freeze();\n }\n\n async toOp(lowerer?: ExecuteRequestLowerer): Promise<Op> {\n if (lowerer === undefined) {\n throw new Error(\n `AddUniqueCall.toOp: a lowerer is required on the Postgres planner path (constraint \"${this.constraintName}\" on table \"${this.tableName}\"). Pass the control adapter to createPostgresMigrationPlanner.`,\n );\n }\n return addUnique(this.schemaName, this.tableName, this.constraintName, this.columns, lowerer);\n }\n\n renderTypeScript(): string {\n return `this.addUnique({ ${constraintCallOptions(this.schemaName, this.tableName, this.constraintName)}, columns: ${jsonToTsSource(this.columns)} })`;\n }\n\n override importRequirements(): readonly ImportRequirement[] {\n return [];\n }\n}\n\nexport class AddForeignKeyCall extends PostgresOpFactoryCallNode {\n readonly factoryName = 'addForeignKey' as const;\n readonly operationClass = 'additive' as const;\n readonly schemaName: string;\n readonly tableName: string;\n readonly fk: ForeignKeySpec;\n readonly label: string;\n\n constructor(schemaName: string, tableName: string, fk: ForeignKeySpec) {\n super();\n this.schemaName = schemaName;\n this.tableName = tableName;\n this.fk = fk;\n this.label = `Add foreign key \"${fk.name}\" on \"${tableName}\"`;\n this.freeze();\n }\n\n async toOp(lowerer?: ExecuteRequestLowerer): Promise<Op> {\n if (lowerer === undefined) {\n throw new Error(\n `AddForeignKeyCall.toOp: a lowerer is required on the Postgres planner path (constraint \"${this.fk.name}\" on table \"${this.tableName}\"). Pass the control adapter to createPostgresMigrationPlanner.`,\n );\n }\n return addForeignKey(this.schemaName, this.tableName, this.fk, lowerer);\n }\n\n renderTypeScript(): string {\n const opts: string[] = [];\n if (this.schemaName !== UNBOUND_NAMESPACE_ID) {\n opts.push(`schema: ${jsonToTsSource(this.schemaName)}`);\n }\n opts.push(`table: ${jsonToTsSource(this.tableName)}`);\n opts.push(`foreignKey: ${jsonToTsSource(this.fk)}`);\n return `this.addForeignKey({ ${opts.join(', ')} })`;\n }\n\n override importRequirements(): readonly ImportRequirement[] {\n return [];\n }\n}\n\nexport class DropConstraintCall extends PostgresOpFactoryCallNode {\n readonly factoryName = 'dropConstraint' as const;\n readonly operationClass = 'destructive' as const;\n readonly schemaName: string;\n readonly tableName: string;\n readonly constraintName: string;\n readonly kind: 'foreignKey' | 'unique' | 'primaryKey';\n readonly label: string;\n\n constructor(\n schemaName: string,\n tableName: string,\n constraintName: string,\n kind: 'foreignKey' | 'unique' | 'primaryKey' = 'unique',\n ) {\n super();\n this.schemaName = schemaName;\n this.tableName = tableName;\n this.constraintName = constraintName;\n this.kind = kind;\n this.label = `Drop constraint \"${constraintName}\" on \"${tableName}\"`;\n this.freeze();\n }\n\n async toOp(lowerer?: ExecuteRequestLowerer): Promise<Op> {\n if (lowerer === undefined) {\n throw new Error(\n `DropConstraintCall.toOp: a lowerer is required on the Postgres planner path (constraint \"${this.constraintName}\" on table \"${this.tableName}\"). Pass the control adapter to createPostgresMigrationPlanner.`,\n );\n }\n return dropConstraint(this.schemaName, this.tableName, this.constraintName, lowerer, this.kind);\n }\n\n renderTypeScript(): string {\n const opts = [constraintCallOptions(this.schemaName, this.tableName, this.constraintName)];\n if (this.kind !== 'unique') {\n opts.push(`kind: ${jsonToTsSource(this.kind)}`);\n }\n return `this.dropConstraint({ ${opts.join(', ')} })`;\n }\n\n override importRequirements(): readonly ImportRequirement[] {\n return [];\n }\n}\n\nexport class AddCheckConstraintCall extends PostgresOpFactoryCallNode {\n readonly factoryName = 'addCheckConstraint' as const;\n readonly operationClass = 'additive' as const;\n readonly schemaName: string;\n readonly tableName: string;\n readonly constraintName: string;\n readonly column: string;\n readonly values: readonly string[];\n readonly label: string;\n\n constructor(\n schemaName: string,\n tableName: string,\n constraintName: string,\n column: string,\n values: readonly string[],\n ) {\n super();\n this.schemaName = schemaName;\n this.tableName = tableName;\n this.constraintName = constraintName;\n this.column = column;\n this.values = values;\n this.label = `Add check constraint \"${constraintName}\" on \"${tableName}\".\"${column}\"`;\n this.freeze();\n }\n\n async toOp(lowerer?: ExecuteRequestLowerer): Promise<Op> {\n if (lowerer === undefined) {\n throw new Error(\n `AddCheckConstraintCall.toOp: a lowerer is required on the Postgres planner path (constraint \"${this.constraintName}\" on table \"${this.tableName}\"). Pass the control adapter to createPostgresMigrationPlanner.`,\n );\n }\n return addCheckConstraint(\n this.schemaName,\n this.tableName,\n this.constraintName,\n this.column,\n this.values,\n lowerer,\n );\n }\n\n renderTypeScript(): string {\n return `this.addCheckConstraint({ ${constraintCallOptions(this.schemaName, this.tableName, this.constraintName)}, column: ${jsonToTsSource(this.column)}, values: ${jsonToTsSource(this.values)} })`;\n }\n\n override importRequirements(): readonly ImportRequirement[] {\n return [];\n }\n}\n\nexport class DropCheckConstraintCall extends PostgresOpFactoryCallNode {\n readonly factoryName = 'dropCheckConstraint' as const;\n readonly operationClass = 'destructive' as const;\n readonly schemaName: string;\n readonly tableName: string;\n readonly constraintName: string;\n readonly label: string;\n\n constructor(schemaName: string, tableName: string, constraintName: string) {\n super();\n this.schemaName = schemaName;\n this.tableName = tableName;\n this.constraintName = constraintName;\n this.label = `Drop check constraint \"${constraintName}\" on \"${tableName}\"`;\n this.freeze();\n }\n\n async toOp(lowerer?: ExecuteRequestLowerer): Promise<Op> {\n if (lowerer === undefined) {\n throw new Error(\n `DropCheckConstraintCall.toOp: a lowerer is required on the Postgres planner path (constraint \"${this.constraintName}\" on table \"${this.tableName}\"). Pass the control adapter to createPostgresMigrationPlanner.`,\n );\n }\n return dropCheckConstraint(this.schemaName, this.tableName, this.constraintName, lowerer);\n }\n\n renderTypeScript(): string {\n return `this.dropCheckConstraint({ ${constraintCallOptions(this.schemaName, this.tableName, this.constraintName)} })`;\n }\n\n override importRequirements(): readonly ImportRequirement[] {\n return [];\n }\n}\n\n// ============================================================================\n// Indexes\n// ============================================================================\n\nexport class CreateIndexCall extends PostgresOpFactoryCallNode {\n readonly factoryName = 'createIndex' as const;\n readonly operationClass = 'additive' as const;\n readonly schemaName: string;\n readonly tableName: string;\n readonly indexName: string;\n readonly columns: readonly string[];\n // Named indexType (not typeName): `locationForCall` in issue-planner.ts reads\n // a call's `typeName` as a CREATE TYPE target location, which an index is not.\n readonly indexType: string | undefined;\n readonly options: Record<string, unknown> | undefined;\n readonly label: string;\n\n constructor(\n schemaName: string,\n tableName: string,\n indexName: string,\n columns: readonly string[],\n extras?: { readonly type?: string; readonly options?: Record<string, unknown> },\n ) {\n super();\n this.schemaName = schemaName;\n this.tableName = tableName;\n this.indexName = indexName;\n this.columns = columns;\n this.indexType = extras?.type;\n this.options = extras?.options;\n this.label = `Create index \"${indexName}\" on \"${tableName}\"`;\n this.freeze();\n }\n\n async toOp(lowerer?: ExecuteRequestLowerer): Promise<Op> {\n if (lowerer === undefined) {\n throw new Error(\n `CreateIndexCall.toOp: a lowerer is required on the Postgres planner path (index \"${this.indexName}\" on table \"${this.tableName}\"). Pass the control adapter to createPostgresMigrationPlanner.`,\n );\n }\n const extras: { type?: string; options?: Record<string, unknown> } = {};\n if (this.indexType !== undefined) extras.type = this.indexType;\n if (this.options !== undefined) extras.options = this.options;\n return createIndex(\n this.schemaName,\n this.tableName,\n this.indexName,\n this.columns,\n lowerer,\n extras,\n );\n }\n\n renderTypeScript(): string {\n const opts: string[] = [];\n if (this.schemaName !== UNBOUND_NAMESPACE_ID) {\n opts.push(`schema: ${jsonToTsSource(this.schemaName)}`);\n }\n opts.push(`table: ${jsonToTsSource(this.tableName)}`);\n opts.push(`index: ${jsonToTsSource(this.indexName)}`);\n opts.push(`columns: ${jsonToTsSource(this.columns)}`);\n if (this.indexType !== undefined || this.options !== undefined) {\n const extrasParts: string[] = [];\n if (this.indexType !== undefined) extrasParts.push(`type: ${jsonToTsSource(this.indexType)}`);\n if (this.options !== undefined) extrasParts.push(`options: ${jsonToTsSource(this.options)}`);\n opts.push(`extras: { ${extrasParts.join(', ')} }`);\n }\n return `this.createIndex({ ${opts.join(', ')} })`;\n }\n\n override importRequirements(): readonly ImportRequirement[] {\n return [];\n }\n}\n\nexport class DropIndexCall extends PostgresOpFactoryCallNode {\n readonly factoryName = 'dropIndex' as const;\n readonly operationClass = 'destructive' as const;\n readonly schemaName: string;\n readonly tableName: string;\n readonly indexName: string;\n readonly label: string;\n\n constructor(schemaName: string, tableName: string, indexName: string) {\n super();\n this.schemaName = schemaName;\n this.tableName = tableName;\n this.indexName = indexName;\n this.label = `Drop index \"${indexName}\"`;\n this.freeze();\n }\n\n async toOp(lowerer?: ExecuteRequestLowerer): Promise<Op> {\n if (lowerer === undefined) {\n throw new Error(\n `DropIndexCall.toOp: a lowerer is required on the Postgres planner path (index \"${this.indexName}\" on table \"${this.tableName}\"). Pass the control adapter to createPostgresMigrationPlanner.`,\n );\n }\n return dropIndex(this.schemaName, this.tableName, this.indexName, lowerer);\n }\n\n renderTypeScript(): string {\n const opts: string[] = [];\n if (this.schemaName !== UNBOUND_NAMESPACE_ID) {\n opts.push(`schema: ${jsonToTsSource(this.schemaName)}`);\n }\n opts.push(`table: ${jsonToTsSource(this.tableName)}`);\n opts.push(`index: ${jsonToTsSource(this.indexName)}`);\n return `this.dropIndex({ ${opts.join(', ')} })`;\n }\n\n override importRequirements(): readonly ImportRequirement[] {\n return [];\n }\n}\n\n// ============================================================================\n// Raw SQL\n// ============================================================================\n\n/**\n * Laundered pre-built operation.\n *\n * Wraps an already-materialized `SqlMigrationPlanOperation` — typically one\n * produced by a SQL-family method or a codec control hook — so the planner\n * can carry it alongside IR nodes without reverse-engineering it into a\n * structured call class. Doubles as the user-facing escape hatch for raw\n * migrations: authors can pass a full op shape to `rawSql({...})`.\n *\n * `toOp()` returns the stored op unchanged. `renderTypeScript()` emits\n * `rawSql({...})` with the op serialized as a JSON literal — round-tripping\n * requires every field on the op to be JSON-serializable (no closures).\n */\nexport class RawSqlCall extends PostgresOpFactoryCallNode {\n readonly factoryName = 'rawSql' as const;\n readonly operationClass: MigrationOperationClass;\n readonly label: string;\n readonly op: Op;\n\n constructor(op: Op) {\n super();\n this.op = op;\n this.label = op.label;\n this.operationClass = op.operationClass;\n this.freeze();\n }\n\n toOp(): Op {\n return this.op;\n }\n\n renderTypeScript(): string {\n return `rawSql(${jsonToTsSource(this.op)})`;\n }\n}\n\n// ============================================================================\n// Database dependencies (structured DDL)\n// ============================================================================\n\nexport class CreateExtensionCall extends PostgresOpFactoryCallNode {\n readonly factoryName = 'createExtension' as const;\n readonly operationClass = 'additive' as const;\n readonly extensionName: string;\n readonly label: string;\n\n constructor(extensionName: string) {\n super();\n this.extensionName = extensionName;\n this.label = `Create extension \"${extensionName}\"`;\n this.freeze();\n }\n\n toOp(): Op {\n return createExtension(this.extensionName);\n }\n\n renderTypeScript(): string {\n return `createExtension(${jsonToTsSource(this.extensionName)})`;\n }\n}\n\nexport class CreateSchemaCall extends PostgresOpFactoryCallNode {\n readonly factoryName = 'createSchema' as const;\n readonly operationClass = 'additive' as const;\n readonly schemaName: string;\n readonly label: string;\n\n constructor(schemaName: string) {\n super();\n this.schemaName = schemaName;\n this.label = `Create schema \"${schemaName}\"`;\n this.freeze();\n }\n\n async toOp(lowerer?: ExecuteRequestLowerer): Promise<Op> {\n if (lowerer === undefined) {\n throw new Error(\n `CreateSchemaCall.toOp: a DDL lowerer is required on the Postgres planner path (schema \"${this.schemaName}\"). Pass the control adapter to createPostgresMigrationPlanner.`,\n );\n }\n const ddlNode = contractFreeDdl.createSchema({ schema: this.schemaName, ifNotExists: true });\n const statement = await lowerer.lowerToExecuteRequest(ddlNode);\n const schemaName = this.schemaName;\n return {\n id: `schema.${schemaName}`,\n label: `Create schema \"${schemaName}\"`,\n operationClass: 'additive',\n target: { id: 'postgres' },\n precheck: [],\n execute: [\n {\n description: `Create schema \"${schemaName}\"`,\n sql: statement.sql,\n params: statement.params ?? [],\n },\n ],\n postcheck: [],\n };\n }\n\n renderTypeScript(): string {\n return `this.createSchema({ schema: ${jsonToTsSource(this.schemaName)} })`;\n }\n\n override importRequirements(): readonly ImportRequirement[] {\n return [];\n }\n}\n\n// ============================================================================\n// Native enum types\n// ============================================================================\n\nexport class CreateNativeEnumTypeCall extends PostgresOpFactoryCallNode {\n readonly factoryName = 'createNativeEnumType' as const;\n readonly operationClass = 'additive' as const;\n readonly schemaName: string;\n readonly typeName: string;\n readonly members: readonly string[];\n readonly label: string;\n\n constructor(schemaName: string, typeName: string, members: readonly string[]) {\n super();\n this.schemaName = schemaName;\n this.typeName = typeName;\n this.members = Object.freeze([...members]);\n this.label = `Create enum type \"${typeName}\"`;\n this.freeze();\n }\n\n async toOp(lowerer?: ExecuteRequestLowerer): Promise<Op> {\n if (lowerer === undefined) {\n throw new Error(\n `CreateNativeEnumTypeCall.toOp: a DDL lowerer is required on the Postgres planner path (type \"${this.typeName}\"). Pass the control adapter to createPostgresMigrationPlanner.`,\n );\n }\n return createNativeEnumType(this.schemaName, this.typeName, this.members, lowerer);\n }\n\n renderTypeScript(): string {\n const opts = [\n `schema: ${jsonToTsSource(this.schemaName)}`,\n `typeName: ${jsonToTsSource(this.typeName)}`,\n `members: ${jsonToTsSource(this.members)}`,\n ];\n return `this.createNativeEnumType({ ${opts.join(', ')} })`;\n }\n\n override importRequirements(): readonly ImportRequirement[] {\n return [];\n }\n}\n\nexport class DropNativeEnumTypeCall extends PostgresOpFactoryCallNode {\n readonly factoryName = 'dropNativeEnumType' as const;\n readonly operationClass = 'destructive' as const;\n readonly schemaName: string;\n readonly typeName: string;\n readonly label: string;\n\n constructor(schemaName: string, typeName: string) {\n super();\n this.schemaName = schemaName;\n this.typeName = typeName;\n this.label = `Drop enum type \"${typeName}\"`;\n this.freeze();\n }\n\n async toOp(lowerer?: ExecuteRequestLowerer): Promise<Op> {\n if (lowerer === undefined) {\n throw new Error(\n `DropNativeEnumTypeCall.toOp: a DDL lowerer is required on the Postgres planner path (type \"${this.typeName}\"). Pass the control adapter to createPostgresMigrationPlanner.`,\n );\n }\n return dropNativeEnumType(this.schemaName, this.typeName, lowerer);\n }\n\n renderTypeScript(): string {\n const opts = [\n `schema: ${jsonToTsSource(this.schemaName)}`,\n `typeName: ${jsonToTsSource(this.typeName)}`,\n ];\n return `this.dropNativeEnumType({ ${opts.join(', ')} })`;\n }\n\n override importRequirements(): readonly ImportRequirement[] {\n return [];\n }\n}\n\n/** Schema-qualified, quoted enum type name — unqualified when `schemaName` is the unbound sentinel, matching `boundSchema`'s DDL-node convention. */\nfunction qualifiedNativeEnumTypeName(schemaName: string, typeName: string): string {\n const bound = boundSchema(schemaName);\n return quoteQualifiedName(bound === undefined ? typeName : `${bound}.${typeName}`);\n}\n\nconst ADD_VALUE_TRANSACTION_CAVEAT =\n 'A newly added enum value cannot be used until the transaction that adds it commits, so a ' +\n 'migration that both appends a value and uses it in the same step will fail at apply.';\n\n/**\n * `ALTER TYPE <qualified> ADD VALUE '<value>'` for a suffix-appended member on\n * a managed native enum. Built directly as SQL text (qualified via\n * `quoteQualifiedName`, the value escaped via `escapeLiteral`) rather than a\n * typed DDL node — mirrors how `enableRowLevelSecurity` renders its execute\n * step, since no DDL-AST node exists for this statement. Prechecks/postchecks\n * are still typed catalog queries lowered through the control adapter.\n * `validateEnumValueLength` runs at construction, so an over-length value\n * fails before planning produces a call.\n */\nexport class AddNativeEnumValueCall extends PostgresOpFactoryCallNode {\n readonly factoryName = 'addNativeEnumValue' as const;\n readonly operationClass = 'additive' as const;\n readonly schemaName: string;\n readonly typeName: string;\n readonly value: string;\n readonly label: string;\n readonly summary: string;\n\n constructor(schemaName: string, typeName: string, value: string) {\n super();\n validateEnumValueLength(value, typeName);\n this.schemaName = schemaName;\n this.typeName = typeName;\n this.value = value;\n this.label = `Add value \"${value}\" to enum type \"${typeName}\"`;\n this.summary = `Adds value \"${value}\" to enum type \"${typeName}\". ${ADD_VALUE_TRANSACTION_CAVEAT}`;\n this.freeze();\n }\n\n async toOp(lowerer?: ExecuteRequestLowerer): Promise<Op> {\n if (lowerer === undefined) {\n throw new Error(\n `AddNativeEnumValueCall.toOp: a lowerer is required on the Postgres planner path (type \"${this.typeName}\"). Pass the control adapter to createPostgresMigrationPlanner.`,\n );\n }\n const { schemaName, typeName, value } = this;\n const typeChecks = nativeEnumTypeExistsAst(schemaName, typeName);\n const valueChecks = nativeEnumValueExistsAst({ schema: schemaName, typeName, value });\n const typePresent = await lowerer.lowerToExecuteRequest(typeChecks.typePresent());\n const valueAbsent = await lowerer.lowerToExecuteRequest(valueChecks.valueAbsent());\n const valuePresent = await lowerer.lowerToExecuteRequest(valueChecks.valuePresent());\n const qualifiedType = qualifiedNativeEnumTypeName(schemaName, typeName);\n return {\n id: `addNativeEnumValue.${typeName}.${value}`,\n label: this.label,\n summary: this.summary,\n operationClass: 'additive',\n target: targetDetails('type', typeName, schemaName),\n precheck: [\n step(`ensure enum type \"${typeName}\" exists`, typePresent.sql, typePresent.params),\n step(\n `ensure value \"${value}\" is absent from enum type \"${typeName}\"`,\n valueAbsent.sql,\n valueAbsent.params,\n ),\n ],\n execute: [\n step(\n `add value \"${value}\" to enum type \"${typeName}\"`,\n `ALTER TYPE ${qualifiedType} ADD VALUE '${escapeLiteral(value)}'`,\n ),\n ],\n postcheck: [\n step(\n `verify value \"${value}\" exists on enum type \"${typeName}\"`,\n valuePresent.sql,\n valuePresent.params,\n ),\n ],\n };\n }\n\n renderTypeScript(): string {\n const opts = [\n `schema: ${jsonToTsSource(this.schemaName)}`,\n `typeName: ${jsonToTsSource(this.typeName)}`,\n `value: ${jsonToTsSource(this.value)}`,\n ];\n return `this.addNativeEnumValue({ ${opts.join(', ')} })`;\n }\n\n override importRequirements(): readonly ImportRequirement[] {\n return [];\n }\n}\n\n// ============================================================================\n// Data transform\n// ============================================================================\n\n/**\n * A planner-generated data-transform stub. `checkSlot` and `runSlot` name\n * the unfilled authoring slots that the rendered `migration.ts` will expose\n * to the user via `placeholder(\"…\")` calls. `toOp()` always throws\n * `MIGRATION.UNFILLED_PLACEHOLDER`: the planner cannot lower a stubbed transform to a runtime\n * op — the user must fill the rendered `migration.ts` and re-emit.\n */\nexport class DataTransformCall extends PostgresOpFactoryCallNode {\n readonly factoryName = 'dataTransform' as const;\n readonly operationClass: MigrationOperationClass;\n readonly label: string;\n readonly checkSlot: string;\n readonly runSlot: string;\n\n constructor(\n label: string,\n checkSlot: string,\n runSlot: string,\n operationClass: MigrationOperationClass = 'data',\n ) {\n super();\n this.label = label;\n this.checkSlot = checkSlot;\n this.runSlot = runSlot;\n this.operationClass = operationClass;\n this.freeze();\n }\n\n toOp(): Op {\n throw errorUnfilledPlaceholder(this.label);\n }\n\n renderTypeScript(): string {\n return [\n `this.dataTransform(endContract, ${jsonToTsSource(this.label)}, {`,\n ` check: () => placeholder(${jsonToTsSource(this.checkSlot)}),`,\n ` run: () => placeholder(${jsonToTsSource(this.runSlot)}),`,\n '})',\n ].join('\\n');\n }\n\n override importRequirements(): readonly ImportRequirement[] {\n return [\n { moduleSpecifier: POSTGRES_MIGRATION_FACADE, symbol: 'placeholder' },\n {\n moduleSpecifier: './end-contract.json',\n symbol: 'endContract',\n kind: 'default',\n attributes: { type: 'json' },\n },\n ];\n }\n}\n\nexport class CreatePostgresRlsPolicyCall extends PostgresOpFactoryCallNode {\n readonly factoryName = 'createRlsPolicy' as const;\n readonly operationClass = 'additive' as const;\n readonly schemaName: string;\n readonly tableName: string;\n readonly policy: PostgresRlsPolicy;\n readonly label: string;\n\n constructor(schemaName: string, tableName: string, policy: PostgresRlsPolicy) {\n super();\n this.schemaName = schemaName;\n this.tableName = tableName;\n this.policy = policy;\n this.label = `Create RLS policy \"${policy.name}\" on \"${tableName}\"`;\n this.freeze();\n }\n\n async toOp(lowerer?: ExecuteRequestLowerer): Promise<Op> {\n if (lowerer === undefined) {\n throw new Error(\n `CreatePostgresRlsPolicyCall.toOp: a lowerer is required on the Postgres planner path (policy \"${this.policy.name}\" on table \"${this.tableName}\"). Pass the control adapter to createPostgresMigrationPlanner.`,\n );\n }\n return createRlsPolicy(this.schemaName, this.tableName, this.policy, lowerer);\n }\n\n renderTypeScript(): string {\n const p = this.policy;\n const input: PostgresRlsPolicyInput = {\n name: p.name,\n prefix: p.prefix,\n tableName: p.tableName,\n namespaceId: p.namespaceId,\n operation: p.operation,\n roles: p.roles,\n ...ifDefined('using', p.using),\n ...ifDefined('withCheck', p.withCheck),\n permissive: p.permissive,\n };\n return `this.createRlsPolicy({ schema: ${jsonToTsSource(this.schemaName)}, table: ${jsonToTsSource(this.tableName)}, policy: ${jsonToTsSource(input)} })`;\n }\n\n override importRequirements(): readonly ImportRequirement[] {\n return [];\n }\n}\n\nexport class DropPostgresRlsPolicyCall extends PostgresOpFactoryCallNode {\n readonly factoryName = 'dropRlsPolicy' as const;\n readonly operationClass = 'destructive' as const;\n readonly schemaName: string;\n readonly tableName: string;\n readonly policyName: string;\n readonly label: string;\n\n constructor(schemaName: string, tableName: string, policyName: string) {\n super();\n this.schemaName = schemaName;\n this.tableName = tableName;\n this.policyName = policyName;\n this.label = `Drop RLS policy \"${policyName}\" on \"${tableName}\"`;\n this.freeze();\n }\n\n async toOp(lowerer?: ExecuteRequestLowerer): Promise<Op> {\n if (lowerer === undefined) {\n throw new Error(\n `DropPostgresRlsPolicyCall.toOp: a lowerer is required on the Postgres planner path (policy \"${this.policyName}\" on table \"${this.tableName}\"). Pass the control adapter to createPostgresMigrationPlanner.`,\n );\n }\n return dropRlsPolicy(this.schemaName, this.tableName, this.policyName, lowerer);\n }\n\n renderTypeScript(): string {\n return `this.dropRlsPolicy({ schema: ${jsonToTsSource(this.schemaName)}, table: ${jsonToTsSource(this.tableName)}, policy: ${jsonToTsSource(this.policyName)} })`;\n }\n\n override importRequirements(): readonly ImportRequirement[] {\n return [];\n }\n}\n\nexport class EnableRowLevelSecurityCall extends PostgresOpFactoryCallNode {\n readonly factoryName = 'enableRowLevelSecurity' as const;\n readonly operationClass = 'additive' as const;\n readonly schemaName: string;\n readonly tableName: string;\n readonly label: string;\n\n constructor(schemaName: string, tableName: string) {\n super();\n this.schemaName = schemaName;\n this.tableName = tableName;\n this.label = `Enable row-level security on \"${tableName}\"`;\n this.freeze();\n }\n\n async toOp(lowerer?: ExecuteRequestLowerer): Promise<Op> {\n if (lowerer === undefined) {\n throw new Error(\n `EnableRowLevelSecurityCall.toOp: a lowerer is required on the Postgres planner path (table \"${this.tableName}\"). Pass the control adapter to createPostgresMigrationPlanner.`,\n );\n }\n return enableRowLevelSecurity(this.schemaName, this.tableName, lowerer);\n }\n\n renderTypeScript(): string {\n return `this.enableRowLevelSecurity({ schema: ${jsonToTsSource(this.schemaName)}, table: ${jsonToTsSource(this.tableName)} })`;\n }\n\n override importRequirements(): readonly ImportRequirement[] {\n return [];\n }\n}\n\nexport class DisableRowLevelSecurityCall extends PostgresOpFactoryCallNode {\n readonly factoryName = 'disableRowLevelSecurity' as const;\n readonly operationClass = 'destructive' as const;\n readonly schemaName: string;\n readonly tableName: string;\n readonly label: string;\n\n constructor(schemaName: string, tableName: string) {\n super();\n this.schemaName = schemaName;\n this.tableName = tableName;\n this.label = `Disable row-level security on \"${tableName}\"`;\n this.freeze();\n }\n\n async toOp(lowerer?: ExecuteRequestLowerer): Promise<Op> {\n if (lowerer === undefined) {\n throw new Error(\n `DisableRowLevelSecurityCall.toOp: a lowerer is required on the Postgres planner path (table \"${this.tableName}\"). Pass the control adapter to createPostgresMigrationPlanner.`,\n );\n }\n return disableRowLevelSecurity(this.schemaName, this.tableName, lowerer);\n }\n\n renderTypeScript(): string {\n return `this.disableRowLevelSecurity({ schema: ${jsonToTsSource(this.schemaName)}, table: ${jsonToTsSource(this.tableName)} })`;\n }\n\n override importRequirements(): readonly ImportRequirement[] {\n return [];\n }\n}\n\nexport class RenamePostgresRlsPolicyCall extends PostgresOpFactoryCallNode {\n readonly factoryName = 'renameRlsPolicy' as const;\n // `widening` is chosen so the rename plans under every allowance set except\n // additive-only init — a rename is neither additive-creation nor\n // destructive, and the class vocabulary has no neutral middle class. It is\n // NOT that a rename widens anything; this is the accepted typology tradeoff.\n readonly operationClass = 'widening' as const;\n readonly schemaName: string;\n readonly tableName: string;\n readonly oldPolicyName: string;\n readonly newPolicyName: string;\n readonly label: string;\n\n constructor(schemaName: string, tableName: string, oldPolicyName: string, newPolicyName: string) {\n super();\n this.schemaName = schemaName;\n this.tableName = tableName;\n this.oldPolicyName = oldPolicyName;\n this.newPolicyName = newPolicyName;\n this.label = `Rename RLS policy \"${oldPolicyName}\" to \"${newPolicyName}\" on \"${tableName}\"`;\n this.freeze();\n }\n\n async toOp(lowerer?: ExecuteRequestLowerer): Promise<Op> {\n if (lowerer === undefined) {\n throw new Error(\n `RenamePostgresRlsPolicyCall.toOp: a lowerer is required on the Postgres planner path (policy \"${this.oldPolicyName}\" on table \"${this.tableName}\"). Pass the control adapter to createPostgresMigrationPlanner.`,\n );\n }\n return renameRlsPolicy(\n this.schemaName,\n this.tableName,\n this.oldPolicyName,\n this.newPolicyName,\n lowerer,\n );\n }\n\n renderTypeScript(): string {\n return `this.renameRlsPolicy({ schema: ${jsonToTsSource(this.schemaName)}, table: ${jsonToTsSource(this.tableName)}, from: ${jsonToTsSource(this.oldPolicyName)}, to: ${jsonToTsSource(this.newPolicyName)} })`;\n }\n\n override importRequirements(): readonly ImportRequirement[] {\n return [];\n }\n}\n\nexport type PostgresOpFactoryCall =\n | CreateTableCall\n | DropTableCall\n | AddColumnCall\n | DropColumnCall\n | AlterColumnTypeCall\n | SetNotNullCall\n | DropNotNullCall\n | SetDefaultCall\n | DropDefaultCall\n | AddNotNullColumnDirectCall\n | AddNotNullColumnWithTempDefaultCall\n | AddPrimaryKeyCall\n | AddForeignKeyCall\n | AddUniqueCall\n | AddCheckConstraintCall\n | DropCheckConstraintCall\n | CreateIndexCall\n | DropIndexCall\n | DropConstraintCall\n | RawSqlCall\n | CreateExtensionCall\n | CreateSchemaCall\n | CreateNativeEnumTypeCall\n | DropNativeEnumTypeCall\n | AddNativeEnumValueCall\n | CreatePostgresRlsPolicyCall\n | DropPostgresRlsPolicyCall\n | EnableRowLevelSecurityCall\n | DisableRowLevelSecurityCall\n | RenamePostgresRlsPolicyCall\n | DataTransformCall;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAOA,SAAgB,YAAY,YAAwC;CAClE,OAAO,eAAe,uBAAuB,KAAA,IAAY;AAC3D;;;ACeA,SAAgB,KAAK,aAAqB,KAAa,QAA6B;CAClF,OAAO;EAAE;EAAa;EAAK,GAAG,UAAU,UAAU,MAAM;CAAE;AAC5D;AAEA,SAAgB,cACd,YACA,MACA,QACA,OAC0E;CAC1E,OAAO;EACL,IAAI;EACJ,SAAS;GAAE;GAAQ;GAAY;GAAM,GAAG,UAAU,SAAS,KAAK;EAAE;CACpE;AACF;;;ACnBA,eAAe,kBACb,SACA,SACoD;CACpD,MAAM,SAAS,gBAAgB,OAAO;CAGtC,OAAO;EAAE,SAAA,M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ration-C-dwGdb2.d.mts","names":[],"sources":["../src/core/migrations/planner-produced-postgres-migration.ts"],"mappings":";;;;;;;cAqCa,8CACH,6BACG;;cAcT,gBAAgB,iBAChB,MAAM,eACN,iBACA,UAAU;MASC,wBACT,0BAA0B,6BAC1B,QAAQ,0BAA0B;EAM7B,YAAY;;;;;;MASjB;EAIJ"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"planner-produced-postgres-migration-CFDpqWWE.mjs","names":["#calls","#meta","#spaceId","#lowerer","#operationsCache"],"sources":["../src/core/migrations/planner-produced-postgres-migration.ts"],"sourcesContent":["/**\n * Planner-produced Postgres migration.\n *\n * Returned by `PostgresMigrationPlanner.plan(...)` and `emptyMigration(...)`.\n * Holds the migration IR (`PostgresOpFactoryCall[]`) alongside\n * `MigrationMeta` and exposes both the runtime-ops view (`get operations`)\n * and the TypeScript authoring view (`renderTypeScript()`). Satisfies\n * `MigrationPlanWithAuthoringSurface` so the CLI can uniformly serialize any\n * planner result back to `migration.ts`.\n *\n * Extends the family-level `SqlMigration` alias rather than the target-local\n * migration base directly — mirrors Mongo's `PlannerProducedMongoMigration`\n * shape and keeps CLI wiring one step removed from target internals.\n *\n * Placeholder-bearing plans: `renderTypeScript()` always succeeds and embeds\n * `() => placeholder(\"slot\")` at each stub. `operations`, in contrast, is\n * _not safe to enumerate_ on a stub-bearing plan — `DataTransformCall.toOp()`\n * throws `MIGRATION.UNFILLED_PLACEHOLDER` because a planner-stubbed closure cannot be lowered\n * to a runtime op. Callers that know a plan may carry stubs must render to\n * `migration.ts`, let the user fill the slots, and re-load the edited\n * migration before enumerating ops. The walk-schema planner does not emit\n * `DataTransformCall`s today, so this asymmetry is invisible until the\n * issue-planner integration lands in Phase 2.\n */\n\nimport type { SqlMigrationPlanOperation } from '@prisma-next/family-sql/control';\nimport type { ExecuteRequestLowerer } from '@prisma-next/family-sql/control-adapter';\nimport type {\n MigrationPlanWithAuthoringSurface,\n OpFactoryCall,\n} from '@prisma-next/framework-components/control';\nimport type { MigrationMeta } from '@prisma-next/migration-tools/migration';\nimport type { PostgresPlanTargetDetails } from './planner-target-details';\nimport { PostgresMigration } from './postgres-migration';\nimport { renderOps } from './render-ops';\nimport { renderCallsToTypeScript } from './render-typescript';\n\nexport class TypeScriptRenderablePostgresMigration\n extends PostgresMigration\n implements MigrationPlanWithAuthoringSurface\n{\n readonly #calls: readonly OpFactoryCall[];\n readonly #meta: MigrationMeta;\n readonly #spaceId: string;\n readonly #lowerer: ExecuteRequestLowerer | undefined;\n #operationsCache:\n | readonly (\n | SqlMigrationPlanOperation<PostgresPlanTargetDetails>\n | Promise<SqlMigrationPlanOperation<PostgresPlanTargetDetails>>\n )[]\n | undefined;\n\n constructor(\n calls: readonly OpFactoryCall[],\n meta: MigrationMeta,\n spaceId: string,\n lowerer?: ExecuteRequestLowerer,\n ) {\n super();\n this.#calls = calls;\n this.#meta = meta;\n this.#spaceId = spaceId;\n this.#lowerer = lowerer;\n }\n\n override get operations(): readonly (\n | SqlMigrationPlanOperation<PostgresPlanTargetDetails>\n | Promise<SqlMigrationPlanOperation<PostgresPlanTargetDetails>>\n )[] {\n this.#operationsCache ??= renderOps(this.#calls, this.#lowerer);\n return this.#operationsCache;\n }\n\n override describe(): MigrationMeta {\n return this.#meta;\n }\n\n /**\n * Contract space this planner-produced plan applies to. Threaded\n * from the planner options so the runner keys the marker row by\n * the right space when executing the plan.\n */\n get spaceId(): string {\n return this.#spaceId;\n }\n\n renderTypeScript(): string {\n return renderCallsToTypeScript(this.#calls, { from: this.#meta.from, to: this.#meta.to });\n }\n}\n"],"mappings":";;;;AAqCA,IAAa,wCAAb,cACU,kBAEV;CACE;CACA;CACA;CACA;CACA;CAOA,YACE,OACA,MACA,SACA,SACA;EACA,MAAM;EACN,KAAKA,SAAS;EACd,KAAKC,QAAQ;EACb,KAAKC,WAAW;EAChB,KAAKC,WAAW;CAClB;CAEA,IAAa,aAGT;EACF,KAAKC,qBAAqB,UAAU,KAAKJ,QAAQ,KAAKG,QAAQ;EAC9D,OAAO,KAAKC;CACd;CAEA,WAAmC;EACjC,OAAO,KAAKH;CACd;;;;;;CAOA,IAAI,UAAkB;EACpB,OAAO,KAAKC;CACd;CAEA,mBAA2B;EACzB,OAAO,wBAAwB,KAAKF,QAAQ;GAAE,MAAM,KAAKC,MAAM;GAAM,IAAI,KAAKA,MAAM;EAAG,CAAC;CAC1F;AACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"postgres-migration-C_OPFhIF.mjs","names":["SqlMigration","#endView","#startView"],"sources":["../src/core/migrations/postgres-migration.ts"],"sourcesContent":["import type { Contract } from '@prisma-next/contract/types';\nimport type { SqlMigrationPlanOperation } from '@prisma-next/family-sql/control';\nimport type { SqlControlAdapter } from '@prisma-next/family-sql/control-adapter';\nimport { Migration as SqlMigration } from '@prisma-next/family-sql/migration';\nimport type { ControlStack } from '@prisma-next/framework-components/control';\nimport { MigrationContractViews } from '@prisma-next/migration-tools/migration';\nimport type { SqlStorage } from '@prisma-next/sql-contract/types';\nimport type { DdlColumn, DdlTableConstraint } from '@prisma-next/sql-relational-core/ast';\nimport { errorPostgresMigrationStackMissing } from '../errors';\nimport { PostgresContractView } from '../postgres-contract-view';\nimport { PostgresRlsPolicy, type PostgresRlsPolicyInput } from '../postgres-rls-policy';\nimport {\n AddCheckConstraintCall,\n AddColumnCall,\n AddForeignKeyCall,\n AddNativeEnumValueCall,\n AddPrimaryKeyCall,\n AddUniqueCall,\n AlterColumnTypeCall,\n type AlterColumnTypeOptions,\n CreateIndexCall,\n CreateNativeEnumTypeCall,\n CreatePostgresRlsPolicyCall,\n CreateSchemaCall,\n CreateTableCall,\n DisableRowLevelSecurityCall,\n DropCheckConstraintCall,\n DropColumnCall,\n DropConstraintCall,\n DropDefaultCall,\n DropIndexCall,\n DropNativeEnumTypeCall,\n DropNotNullCall,\n DropPostgresRlsPolicyCall,\n DropTableCall,\n EnableRowLevelSecurityCall,\n RenamePostgresRlsPolicyCall,\n SetDefaultCall,\n SetNotNullCall,\n} from './op-factory-call';\nimport { type DataTransformOptions, dataTransform } from './operations/data-transform';\nimport { installExtension } from './operations/dependencies';\nimport type { CreateIndexExtras } from './operations/indexes';\nimport type { ForeignKeySpec } from './operations/shared';\nimport type { PostgresPlanTargetDetails } from './planner-target-details';\n\n/**\n * Target-owned base class for Postgres migrations.\n *\n * Fixes the `SqlMigration` generic to `PostgresPlanTargetDetails` and the\n * abstract `targetId` to the Postgres target-id string literal, so both\n * user-authored migrations and renderer-generated scaffolds (the output of\n * `renderCallsToTypeScript`) can extend `PostgresMigration` directly without\n * redeclaring target-local identity.\n *\n * Mirrors `MongoMigration` in `@prisma-next/family-mongo`: the renderer\n * emits `extends Migration` against a facade re-export of this class\n * from `@prisma-next/postgres/migration`, keeping the authoring surface\n * target-scoped rather than family-scoped.\n *\n * The constructor materializes a single Postgres `SqlControlAdapter` from\n * `stack.adapter.create(stack)` and stores it; the protected `dataTransform`\n * instance method forwards to the free `dataTransform` factory with that\n * stored adapter, so user migrations can write `this.dataTransform(...)`\n * without threading the adapter through every call.\n *\n * Every method requires an explicit `schema`. Postgres migrations name their\n * schema deliberately — there is no default and no `search_path`-relative\n * option. A migration that left the schema unspecified would resolve against\n * whatever `search_path` the connection happened to carry, and that ambiguity\n * is an antipattern in a migration. (The unbound/unspecified namespace concept\n * remains for SQLite, which has no schemas, and for Mongo's connection `db`.)\n */\nexport abstract class PostgresMigration<\n Start extends Contract<SqlStorage> = Contract<SqlStorage>,\n End extends Contract<SqlStorage> = Contract<SqlStorage>,\n> extends SqlMigration<PostgresPlanTargetDetails, 'postgres', Start, End> {\n readonly targetId = 'postgres' as const;\n\n /**\n * Materialized Postgres control adapter, created once per migration\n * instance from the injected stack. `undefined` only when the migration\n * was instantiated without a stack (test fixtures); `controlAdapterFor`\n * throws a MIGRATION.POSTGRES_CONTROL_STACK_MISSING in that case to surface the misuse.\n */\n protected readonly controlAdapter: SqlControlAdapter<'postgres'> | undefined;\n\n #endView = new MigrationContractViews<PostgresContractView<End>>(\n this,\n 'PostgresMigration',\n (json) => PostgresContractView.fromJson<End>(json),\n );\n #startView = new MigrationContractViews<PostgresContractView<Start>>(\n this,\n 'PostgresMigration',\n (json) => PostgresContractView.fromJson<Start>(json),\n );\n\n constructor(stack?: ControlStack<'sql', 'postgres'>) {\n super(stack);\n // The descriptor `create()` is typed as the wider `ControlAdapterInstance`;\n // the Postgres descriptor concretely returns a `SqlControlAdapter<'postgres'>`,\n // so the cast holds for any Postgres-target stack assembled at runtime.\n this.controlAdapter = stack?.adapter\n ? (stack.adapter.create(stack) as SqlControlAdapter<'postgres'>)\n : undefined;\n }\n\n /**\n * Returns the materialized control adapter, or throws a MIGRATION.POSTGRES_CONTROL_STACK_MISSING naming\n * `operation` when the migration was constructed without a `ControlStack`.\n * Single home for the null-check that every DDL/DML method shares.\n */\n private controlAdapterFor(operation: string): SqlControlAdapter<'postgres'> {\n if (!this.controlAdapter) {\n throw errorPostgresMigrationStackMissing(operation);\n }\n return this.controlAdapter;\n }\n\n /**\n * The typed, schema-qualified Postgres view over this migration's end-state\n * contract — `this.endContract.namespace.<schema>.table.<name>`, etc. Throws\n * if no `endContractJson` was provided.\n */\n get endContract(): PostgresContractView<End> {\n return this.#endView.endContract;\n }\n\n /**\n * The typed Postgres view over this migration's start-state contract, or\n * `null` for a baseline migration (no `startContractJson`).\n */\n get startContract(): PostgresContractView<Start> | null {\n return this.#startView.startContract;\n }\n\n /**\n * Instance-method wrapper around the free `dataTransform` factory that\n * supplies the stored control adapter. Authors call this from inside\n * `get operations()`; the adapter argument is hidden from the call site.\n */\n protected dataTransform<TContract extends Contract<SqlStorage>>(\n contract: TContract,\n name: string,\n options: DataTransformOptions,\n ): Promise<SqlMigrationPlanOperation<PostgresPlanTargetDetails>> {\n return dataTransform(contract, name, options, this.controlAdapterFor('dataTransform'));\n }\n\n /**\n * Emit a `CREATE TABLE` migration operation. Builds a typed DDL node from\n * the supplied options and lowers it through the stored control adapter.\n * Throws if no adapter is present (i.e. migration instantiated without a stack).\n */\n protected createTable(options: {\n readonly schema: string;\n readonly table: string;\n readonly ifNotExists?: boolean;\n readonly columns: readonly DdlColumn[];\n readonly constraints?: readonly DdlTableConstraint[];\n }): Promise<SqlMigrationPlanOperation<PostgresPlanTargetDetails>> {\n return new CreateTableCall(\n options.schema,\n options.table,\n options.columns,\n options.constraints,\n ).toOp(this.controlAdapterFor('createTable'));\n }\n\n /**\n * Emit a `CREATE SCHEMA` migration operation. Builds a typed DDL node from\n * the supplied options and lowers it through the stored control adapter.\n * Throws if no adapter is present (i.e. migration instantiated without a stack).\n */\n protected createSchema(options: {\n readonly schema: string;\n readonly ifNotExists?: boolean;\n }): Promise<SqlMigrationPlanOperation<PostgresPlanTargetDetails>> {\n return new CreateSchemaCall(options.schema).toOp(this.controlAdapterFor('createSchema'));\n }\n\n /**\n * Emit a `CREATE TYPE ... AS ENUM (...)` migration operation for a managed\n * native enum. Builds a typed DDL node and lowers it through the stored\n * control adapter (members render in declaration order). Throws if no adapter\n * is present.\n */\n protected createNativeEnumType(options: {\n readonly schema: string;\n readonly typeName: string;\n readonly members: readonly string[];\n }): Promise<SqlMigrationPlanOperation<PostgresPlanTargetDetails>> {\n return new CreateNativeEnumTypeCall(options.schema, options.typeName, options.members).toOp(\n this.controlAdapterFor('createNativeEnumType'),\n );\n }\n\n /**\n * Emit a `DROP TYPE` migration operation for a managed native enum, lowered\n * through the stored control adapter. Throws if no adapter is present.\n */\n protected dropNativeEnumType(options: {\n readonly schema: string;\n readonly typeName: string;\n }): Promise<SqlMigrationPlanOperation<PostgresPlanTargetDetails>> {\n return new DropNativeEnumTypeCall(options.schema, options.typeName).toOp(\n this.controlAdapterFor('dropNativeEnumType'),\n );\n }\n\n /**\n * Emit an `ALTER TYPE ... ADD VALUE` migration operation appending one\n * member to a managed native enum, lowered through the stored control\n * adapter. Throws if no adapter is present. Every appended value is its\n * own operation — call this once per value to append more than one.\n */\n protected addNativeEnumValue(options: {\n readonly schema: string;\n readonly typeName: string;\n readonly value: string;\n }): Promise<SqlMigrationPlanOperation<PostgresPlanTargetDetails>> {\n return new AddNativeEnumValueCall(options.schema, options.typeName, options.value).toOp(\n this.controlAdapterFor('addNativeEnumValue'),\n );\n }\n\n protected addColumn(options: {\n readonly schema: string;\n readonly table: string;\n readonly column: DdlColumn;\n }): Promise<SqlMigrationPlanOperation<PostgresPlanTargetDetails>> {\n return new AddColumnCall(options.schema, options.table, options.column).toOp(\n this.controlAdapterFor('addColumn'),\n );\n }\n\n protected addPrimaryKey(options: {\n readonly schema: string;\n readonly table: string;\n readonly constraint: string;\n readonly columns: readonly string[];\n }): Promise<SqlMigrationPlanOperation<PostgresPlanTargetDetails>> {\n return new AddPrimaryKeyCall(\n options.schema,\n options.table,\n options.constraint,\n options.columns,\n ).toOp(this.controlAdapterFor('addPrimaryKey'));\n }\n\n protected addUnique(options: {\n readonly schema: string;\n readonly table: string;\n readonly constraint: string;\n readonly columns: readonly string[];\n }): Promise<SqlMigrationPlanOperation<PostgresPlanTargetDetails>> {\n return new AddUniqueCall(\n options.schema,\n options.table,\n options.constraint,\n options.columns,\n ).toOp(this.controlAdapterFor('addUnique'));\n }\n\n protected addForeignKey(options: {\n readonly schema: string;\n readonly table: string;\n readonly foreignKey: ForeignKeySpec;\n }): Promise<SqlMigrationPlanOperation<PostgresPlanTargetDetails>> {\n return new AddForeignKeyCall(options.schema, options.table, options.foreignKey).toOp(\n this.controlAdapterFor('addForeignKey'),\n );\n }\n\n protected addCheckConstraint(options: {\n readonly schema: string;\n readonly table: string;\n readonly constraint: string;\n readonly column: string;\n readonly values: readonly string[];\n }): Promise<SqlMigrationPlanOperation<PostgresPlanTargetDetails>> {\n return new AddCheckConstraintCall(\n options.schema,\n options.table,\n options.constraint,\n options.column,\n options.values,\n ).toOp(this.controlAdapterFor('addCheckConstraint'));\n }\n\n protected dropCheckConstraint(options: {\n readonly schema: string;\n readonly table: string;\n readonly constraint: string;\n }): Promise<SqlMigrationPlanOperation<PostgresPlanTargetDetails>> {\n return new DropCheckConstraintCall(options.schema, options.table, options.constraint).toOp(\n this.controlAdapterFor('dropCheckConstraint'),\n );\n }\n\n protected dropConstraint(options: {\n readonly schema: string;\n readonly table: string;\n readonly constraint: string;\n readonly kind?: 'foreignKey' | 'unique' | 'primaryKey';\n }): Promise<SqlMigrationPlanOperation<PostgresPlanTargetDetails>> {\n return new DropConstraintCall(\n options.schema,\n options.table,\n options.constraint,\n options.kind ?? 'unique',\n ).toOp(this.controlAdapterFor('dropConstraint'));\n }\n\n protected dropTable(options: {\n readonly schema: string;\n readonly table: string;\n }): Promise<SqlMigrationPlanOperation<PostgresPlanTargetDetails>> {\n return new DropTableCall(options.schema, options.table).toOp(\n this.controlAdapterFor('dropTable'),\n );\n }\n\n protected dropColumn(options: {\n readonly schema: string;\n readonly table: string;\n readonly column: string;\n }): Promise<SqlMigrationPlanOperation<PostgresPlanTargetDetails>> {\n return new DropColumnCall(options.schema, options.table, options.column).toOp(\n this.controlAdapterFor('dropColumn'),\n );\n }\n\n protected alterColumnType(options: {\n readonly schema: string;\n readonly table: string;\n readonly column: string;\n readonly options: AlterColumnTypeOptions;\n }): Promise<SqlMigrationPlanOperation<PostgresPlanTargetDetails>> {\n return new AlterColumnTypeCall(\n options.schema,\n options.table,\n options.column,\n options.options,\n ).toOp(this.controlAdapterFor('alterColumnType'));\n }\n\n protected setNotNull(options: {\n readonly schema: string;\n readonly table: string;\n readonly column: string;\n }): Promise<SqlMigrationPlanOperation<PostgresPlanTargetDetails>> {\n return new SetNotNullCall(options.schema, options.table, options.column).toOp(\n this.controlAdapterFor('setNotNull'),\n );\n }\n\n protected dropNotNull(options: {\n readonly schema: string;\n readonly table: string;\n readonly column: string;\n }): Promise<SqlMigrationPlanOperation<PostgresPlanTargetDetails>> {\n return new DropNotNullCall(options.schema, options.table, options.column).toOp(\n this.controlAdapterFor('dropNotNull'),\n );\n }\n\n protected setDefault(options: {\n readonly schema: string;\n readonly table: string;\n readonly column: string;\n readonly defaultSql: string;\n readonly operationClass?: 'additive' | 'widening';\n }): Promise<SqlMigrationPlanOperation<PostgresPlanTargetDetails>> {\n return new SetDefaultCall(\n options.schema,\n options.table,\n options.column,\n options.defaultSql,\n options.operationClass,\n ).toOp(this.controlAdapterFor('setDefault'));\n }\n\n protected dropDefault(options: {\n readonly schema: string;\n readonly table: string;\n readonly column: string;\n }): Promise<SqlMigrationPlanOperation<PostgresPlanTargetDetails>> {\n return new DropDefaultCall(options.schema, options.table, options.column).toOp(\n this.controlAdapterFor('dropDefault'),\n );\n }\n\n protected createIndex(options: {\n readonly schema: string;\n readonly table: string;\n readonly index: string;\n readonly columns: readonly string[];\n readonly extras?: CreateIndexExtras;\n }): Promise<SqlMigrationPlanOperation<PostgresPlanTargetDetails>> {\n return new CreateIndexCall(\n options.schema,\n options.table,\n options.index,\n options.columns,\n options.extras,\n ).toOp(this.controlAdapterFor('createIndex'));\n }\n\n protected dropIndex(options: {\n readonly schema: string;\n readonly table: string;\n readonly index: string;\n }): Promise<SqlMigrationPlanOperation<PostgresPlanTargetDetails>> {\n return new DropIndexCall(options.schema, options.table, options.index).toOp(\n this.controlAdapterFor('dropIndex'),\n );\n }\n\n protected installExtension(options: {\n readonly extensionName: string;\n readonly invariantId: string;\n readonly id: string;\n readonly label?: string;\n }): Promise<SqlMigrationPlanOperation<PostgresPlanTargetDetails>> {\n return installExtension(options, this.controlAdapterFor('installExtension'));\n }\n\n protected enableRowLevelSecurity(options: {\n readonly schema: string;\n readonly table: string;\n }): Promise<SqlMigrationPlanOperation<PostgresPlanTargetDetails>> {\n return new EnableRowLevelSecurityCall(options.schema, options.table).toOp(\n this.controlAdapterFor('enableRowLevelSecurity'),\n );\n }\n\n protected disableRowLevelSecurity(options: {\n readonly schema: string;\n readonly table: string;\n }): Promise<SqlMigrationPlanOperation<PostgresPlanTargetDetails>> {\n return new DisableRowLevelSecurityCall(options.schema, options.table).toOp(\n this.controlAdapterFor('disableRowLevelSecurity'),\n );\n }\n\n protected createRlsPolicy(options: {\n readonly schema: string;\n readonly table: string;\n readonly policy: PostgresRlsPolicyInput;\n }): Promise<SqlMigrationPlanOperation<PostgresPlanTargetDetails>> {\n return new CreatePostgresRlsPolicyCall(\n options.schema,\n options.table,\n new PostgresRlsPolicy(options.policy),\n ).toOp(this.controlAdapterFor('createRlsPolicy'));\n }\n\n protected dropRlsPolicy(options: {\n readonly schema: string;\n readonly table: string;\n readonly policy: string;\n }): Promise<SqlMigrationPlanOperation<PostgresPlanTargetDetails>> {\n return new DropPostgresRlsPolicyCall(options.schema, options.table, options.policy).toOp(\n this.controlAdapterFor('dropRlsPolicy'),\n );\n }\n\n protected renameRlsPolicy(options: {\n readonly schema: string;\n readonly table: string;\n readonly from: string;\n readonly to: string;\n }): Promise<SqlMigrationPlanOperation<PostgresPlanTargetDetails>> {\n return new RenamePostgresRlsPolicyCall(\n options.schema,\n options.table,\n options.from,\n options.to,\n ).toOp(this.controlAdapterFor('renameRlsPolicy'));\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyEA,IAAsB,oBAAtB,cAGUA,UAAgE;CACxE,WAAoB;;;;;;;CAQpB;CAEA,WAAW,IAAI,uBACb,MACA,sBACC,SAAS,qBAAqB,SAAc,IAAI,CACnD;CACA,aAAa,IAAI,uBACf,MACA,sBACC,SAAS,qBAAqB,SAAgB,IAAI,CACrD;CAEA,YAAY,OAAyC;EACnD,MAAM,KAAK;EAIX,KAAK,iBAAiB,OAAO,UACxB,MAAM,QAAQ,OAAO,KAAK,IAC3B,KAAA;CACN;;;;;;CAOA,kBAA0B,WAAkD;EAC1E,IAAI,CAAC,KAAK,gBACR,MAAM,mCAAmC,SAAS;EAEpD,OAAO,KAAK;CACd;;;;;;CAOA,IAAI,cAAyC;EAC3C,OAAO,KAAKC,SAAS;CACvB;;;;;CAMA,IAAI,gBAAoD;EACtD,OAAO,KAAKC,WAAW;CACzB;;;;;;CAOA,cACE,UACA,MACA,SAC+D;EAC/D,OAAO,cAAc,UAAU,MA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