@prisma/orm-target-mysql 8.0.0-rc.24-dev.22 → 8.0.0-rc.24-dev.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/adapter.mjs CHANGED
@@ -1,3 +1,3 @@
1
1
  import { n as mysqlAdapterContractContributions, r as mysqlAdapterDescriptorMeta, t as mysqlAdapterCapabilities } from "./descriptor-meta-e29H69KN-t-S8_DYh.mjs";
2
- import { a as readMysqlCatalog, n as buildMysqlSchemaIR, r as createMysqlControlAdapter, t as MYSQL_CATALOG_QUERIES } from "./control-DDjdwyGa.mjs";
2
+ import { a as readMysqlCatalog, n as buildMysqlSchemaIR, r as createMysqlControlAdapter, t as MYSQL_CATALOG_QUERIES } from "./control-CTfV1Zag.mjs";
3
3
  export { MYSQL_CATALOG_QUERIES, buildMysqlSchemaIR, createMysqlControlAdapter, mysqlAdapterCapabilities, mysqlAdapterContractContributions, mysqlAdapterDescriptorMeta, readMysqlCatalog };
@@ -1,2 +1,2 @@
1
- import { a as readMysqlCatalog, i as mysqlAdapterDescriptor, n as buildMysqlSchemaIR, r as createMysqlControlAdapter, t as MYSQL_CATALOG_QUERIES } from "./control-DDjdwyGa.mjs";
1
+ import { a as readMysqlCatalog, i as mysqlAdapterDescriptor, n as buildMysqlSchemaIR, r as createMysqlControlAdapter, t as MYSQL_CATALOG_QUERIES } from "./control-CTfV1Zag.mjs";
2
2
  export { MYSQL_CATALOG_QUERIES, buildMysqlSchemaIR, createMysqlControlAdapter, mysqlAdapterDescriptor as default, readMysqlCatalog };
@@ -12,7 +12,7 @@ import { codecForRef } from "@prisma/orm-framework/components/codec";
12
12
  import { structuredError } from "@prisma/orm-framework/utils/structured-error";
13
13
  import { encodeLiteralDefault, isDdlNode, renderOpaqueSql } from "@prisma/orm-family-sql/relational-core/ast";
14
14
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
15
- import { APP_SPACE_ID } from "@prisma/orm-framework/components/control";
15
+ import { APP_SPACE_ID, DATABASE_POLICIES_META_KEY, storedDatabasePolicies } from "@prisma/orm-framework/components/control";
16
16
  import { checkSqlDefaultText, contractColumns, readColumnDefault, sqlDefaultFunctions } from "@prisma/orm-family-sql/family/control";
17
17
  import { RelationalSchemaNodeKind, SqlSchemaIR, SqlTableIR } from "@prisma/orm-family-sql/schema-ir/types";
18
18
  import { REFERENTIAL_ACTION_SQL } from "@prisma/orm-family-sql/contract/referential-action-sql";
@@ -353,54 +353,59 @@ async function readLedgerEntries(driver, space) {
353
353
  };
354
354
  });
355
355
  }
356
- /** Every column of the marker row except its key, `space`, with what both the insert and the upsert's update write to it. */
357
- const MARKER_COLUMNS = [
358
- ["core_hash", (destination) => destination.storageHash],
359
- ["profile_hash", (destination) => destination.profileHash],
360
- ["contract_json", "NULL"],
361
- ["canonical_version", "NULL"],
362
- ["updated_at", "CURRENT_TIMESTAMP(3)"],
363
- ["app_tag", "NULL"],
364
- ["meta", "'{}'"],
365
- ["invariants", (destination) => JSON.stringify(destination.invariants ?? [])]
366
- ];
367
- function markerValueSql(value) {
368
- return typeof value === "string" ? value : "?";
369
- }
370
- const MARKER_INSERT = `INSERT INTO ${quoteIdentifier(MARKER_TABLE_NAME)} (space, ${MARKER_COLUMNS.map(([column]) => column).join(", ")}) VALUES (?, ${MARKER_COLUMNS.map(([, value]) => markerValueSql(value)).join(", ")})`;
371
- const MARKER_UPDATE = MARKER_COLUMNS.map(([column, value]) => `${column} = ${markerValueSql(value)}`).join(", ");
372
- function markerColumnParams(destination) {
373
- return MARKER_COLUMNS.flatMap(([, value]) => typeof value === "string" ? [] : [value(destination)]);
356
+ const MARKER_INSERT = `INSERT INTO ${quoteIdentifier(MARKER_TABLE_NAME)} (space, core_hash, profile_hash, contract_json, canonical_version, updated_at, app_tag, meta, invariants) VALUES (?, ?, ?, NULL, NULL, CURRENT_TIMESTAMP(3), NULL, ?, ?)`;
357
+ function metaOnInsert(destination) {
358
+ return destination.databasePolicies === void 0 ? {} : { [DATABASE_POLICIES_META_KEY]: storedDatabasePolicies(destination.databasePolicies) };
359
+ }
360
+ function markerInsertParams(space, destination) {
361
+ return [
362
+ space,
363
+ destination.storageHash,
364
+ destination.profileHash,
365
+ JSON.stringify(metaOnInsert(destination)),
366
+ JSON.stringify(destination.invariants ?? [])
367
+ ];
374
368
  }
375
369
  /** Inserts the marker row of `space`; fails when the space already has one. */
376
370
  async function insertMarkerRow(driver, space, destination) {
377
- await driver.query(MARKER_INSERT, [space, ...markerColumnParams(destination)]);
371
+ await driver.query(MARKER_INSERT, markerInsertParams(space, destination));
378
372
  }
379
- /** Writes the marker row of `space`, replacing the row the space already has. The update binds the values again instead of naming a row alias, which MariaDB does not accept, or `VALUES()`, which MySQL deprecates. */
373
+ /** Writes the marker row of `space`, replacing the row the space already has. Its `meta` is kept, with `policies` set when the destination records them. The update binds its values again instead of naming a row alias, which MariaDB does not accept, or `VALUES()`, which MySQL deprecates. */
380
374
  async function upsertMarkerRow(driver, space, destination) {
381
- const params = markerColumnParams(destination);
382
- await driver.query(`${MARKER_INSERT} ON DUPLICATE KEY UPDATE ${MARKER_UPDATE}`, [
383
- space,
384
- ...params,
385
- ...params
386
- ]);
375
+ const columns = "core_hash = ?, profile_hash = ?, contract_json = NULL, canonical_version = NULL, updated_at = CURRENT_TIMESTAMP(3), app_tag = NULL, invariants = ?";
376
+ const columnParams = [
377
+ destination.storageHash,
378
+ destination.profileHash,
379
+ JSON.stringify(destination.invariants ?? [])
380
+ ];
381
+ const [update, updateParams] = destination.databasePolicies === void 0 ? [columns, columnParams] : [`${columns}, meta = JSON_SET(meta, '$.${DATABASE_POLICIES_META_KEY}', JSON_EXTRACT(?, '$'))`, [...columnParams, JSON.stringify(storedDatabasePolicies(destination.databasePolicies))]];
382
+ await driver.query(`${MARKER_INSERT} ON DUPLICATE KEY UPDATE ${update}`, [...markerInsertParams(space, destination), ...updateParams]);
383
+ }
384
+ function metaOf(text) {
385
+ const parsed = parseJsonColumn("meta", text);
386
+ return typeof parsed === "object" && parsed !== null && !Array.isArray(parsed) ? Object.fromEntries(Object.entries(parsed)) : {};
387
387
  }
388
388
  function invariantsOf(text) {
389
389
  const parsed = parseJsonColumn("invariants", text);
390
390
  return Array.isArray(parsed) ? parsed.filter((item) => typeof item === "string") : [];
391
391
  }
392
392
  /**
393
- * Advances the marker row of `space` from `expectedFrom` to `destination`, and says whether it did. MySQL has no `RETURNING`, so the row is read and locked with `FOR UPDATE` first, inside the transaction the caller holds, and written only when it still holds `expectedFrom`. Supplied invariants are merged with the stored ones.
393
+ * Advances the marker row of `space` from `expectedFrom` to `destination`, and says whether it did. MySQL has no `RETURNING`, so the row is read and locked with `FOR UPDATE` first, inside the transaction the caller holds, and written only when it still holds `expectedFrom`. Supplied invariants are merged with the stored ones; supplied policies replace `meta.policies`.
394
394
  */
395
395
  async function compareAndSwapMarkerRow(driver, space, expectedFrom, destination) {
396
- const { rows } = await driver.query(`SELECT core_hash, invariants FROM ${quoteIdentifier(MARKER_TABLE_NAME)} WHERE space = ? FOR UPDATE`, [space]);
396
+ const { rows } = await driver.query(`SELECT core_hash, meta, invariants FROM ${quoteIdentifier(MARKER_TABLE_NAME)} WHERE space = ? FOR UPDATE`, [space]);
397
397
  const [row] = rows;
398
398
  if (row === void 0 || row["core_hash"] !== expectedFrom) return false;
399
399
  const invariants = destination.invariants === void 0 ? void 0 : [.../* @__PURE__ */ new Set([...invariantsOf(row["invariants"]), ...destination.invariants])].sort();
400
- await driver.query(`UPDATE ${quoteIdentifier(MARKER_TABLE_NAME)} SET core_hash = ?, profile_hash = ?, updated_at = CURRENT_TIMESTAMP(3)${invariants === void 0 ? "" : ", invariants = ?"} WHERE space = ? AND core_hash = ?`, [
400
+ const meta = destination.databasePolicies === void 0 ? void 0 : {
401
+ ...metaOf(row["meta"]),
402
+ [DATABASE_POLICIES_META_KEY]: storedDatabasePolicies(destination.databasePolicies)
403
+ };
404
+ await driver.query(`UPDATE ${quoteIdentifier(MARKER_TABLE_NAME)} SET core_hash = ?, profile_hash = ?, updated_at = CURRENT_TIMESTAMP(3)${invariants === void 0 ? "" : ", invariants = ?"}${meta === void 0 ? "" : ", meta = ?"} WHERE space = ? AND core_hash = ?`, [
401
405
  destination.storageHash,
402
406
  destination.profileHash,
403
407
  ...invariants === void 0 ? [] : [JSON.stringify(invariants)],
408
+ ...meta === void 0 ? [] : [JSON.stringify(meta)],
404
409
  space,
405
410
  expectedFrom
406
411
  ]);
@@ -610,4 +615,4 @@ const mysqlAdapterDescriptor = {
610
615
  //#endregion
611
616
  export { readMysqlCatalog as a, mysqlAdapterDescriptor as i, buildMysqlSchemaIR as n, createMysqlControlAdapter as r, MYSQL_CATALOG_QUERIES as t };
612
617
 
613
- //# sourceMappingURL=control-DDjdwyGa.mjs.map
618
+ //# sourceMappingURL=control-CTfV1Zag.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"control-CTfV1Zag.mjs","names":["#inTransaction"],"sources":["../../../../3-targets/mysql/1-mysql/2-adapter/dist/control.mjs"],"sourcesContent":["import { t as mysqlAdapterDescriptorMeta } from \"./descriptor-meta-e29H69KN.mjs\";\nimport { a as tableExists, i as readMarkerRows, n as parseJsonColumn, r as readMarkerResult, t as decodeMysqlMarkerRow } from \"./marker-read-D1hp62hF.mjs\";\nimport { assembleMysqlCodecRegistry, decodeMysqlDatetime, encodeMysqlDatetime, mysqlCurrentValueFor, mysqlNowExpression } from \"@internal/target-mysql/codecs\";\nimport { checkSqlDefaultText, contractColumns, readColumnDefault, sqlDefaultFunctions } from \"@internal/family-sql/control\";\nimport { parseMarkerRowSafely, withMarkerReadErrorHandling } from \"@internal/errors/execution\";\nimport { codecForRef } from \"@internal/framework-components/codec\";\nimport { APP_SPACE_ID, DATABASE_POLICIES_META_KEY, storedDatabasePolicies } from \"@internal/framework-components/control\";\nimport { encodeLiteralDefault, isDdlNode, renderOpaqueSql } from \"@internal/sql-relational-core/ast\";\nimport { buildControlTableBootstrapQueries, buildSignMarkerBootstrapQueries } from \"@internal/target-mysql/contract-free\";\nimport { CONTROL_TABLE_NAMES, LEDGER_TABLE_NAME, MARKER_TABLE_NAME } from \"@internal/target-mysql/control-tables\";\nimport { mysqlQueryNotYetSupported } from \"@internal/target-mysql/errors\";\nimport { withMarkerLock } from \"@internal/target-mysql/marker-lock\";\nimport { structuredError } from \"@internal/utils/structured-error\";\nimport { quoteIdentifier, quoteLiteral } from \"@internal/target-mysql/sql-utils\";\nimport { REFERENTIAL_ACTION_SQL } from \"@internal/sql-contract/referential-action-sql\";\nimport { resolveIntrospectedColumnType } from \"@internal/family-sql/control-adapter\";\nimport { RelationalSchemaNodeKind, SqlSchemaIR, SqlTableIR } from \"@internal/sql-schema-ir/types\";\nimport { readMysqlDefault } from \"@internal/target-mysql/default-normalizer\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { ledgerOriginFromStored } from \"@internal/migration-tools/ledger-origin\";\n//#region src/core/migrations/ddl-renderer.ts\n/** Column types MySQL gives a default only when it is written as an expression in parentheses. */\nconst EXPRESSION_DEFAULT_ONLY = /^(?:(?:tiny|medium|long)?(?:text|blob)|json|geometry)\\b/i;\nconst FRACTIONAL_SECONDS = /^(?:datetime|timestamp|time)\\((\\d)\\)$/i;\nfunction refusedDefault(where, why) {\n\tthrow structuredError(\"CONTRACT.DEFAULT_INVALID\", `Column \"${where.table}\".\"${where.column}\" has a default MySQL cannot store: ${why}`, { meta: {\n\t\ttable: where.table,\n\t\tcolumn: where.column\n\t} });\n}\n/** A wire value as the SQL literal MySQL reads for it. */\nfunction mysqlInlineLiteral(wire, where) {\n\tif (wire === null) return \"NULL\";\n\tif (typeof wire === \"boolean\") return wire ? \"1\" : \"0\";\n\tif (typeof wire === \"number\") {\n\t\tif (!Number.isFinite(wire)) return refusedDefault(where, `${wire} is not a finite number`);\n\t\treturn String(wire);\n\t}\n\tif (typeof wire === \"bigint\") return String(wire);\n\tif (typeof wire === \"string\") return quoteLiteral(wire);\n\tif (wire instanceof Date) return quoteLiteral(encodeMysqlDatetime(wire));\n\tif (wire instanceof Uint8Array) return `X'${Buffer.from(wire).toString(\"hex\")}'`;\n\tif (typeof wire === \"object\") return quoteLiteral(JSON.stringify(wire));\n\treturn refusedDefault(where, `a ${typeof wire} has no SQL literal`);\n}\nfunction withinParentheses(columnType, literal) {\n\treturn EXPRESSION_DEFAULT_ONLY.test(columnType.trim()) ? `(${literal})` : literal;\n}\n/**\n* The expression a `now()` default is written as: the current value the column's data type holds, `CURRENT_TIMESTAMP`, `CURRENT_DATE` or `CURRENT_TIME`, with the column's fractional-second precision, which MySQL requires to match. A column of a data type that holds no date or time is refused.\n*/\nfunction nowExpressionFor(columnType, codecLookup, codecRef, where) {\n\tconst dataType = codecRef === void 0 ? void 0 : codecLookup.descriptorFor(codecRef.codecId)?.dataType;\n\tconst current = mysqlCurrentValueFor(dataType);\n\tif (current === void 0) throw structuredError(\"CONTRACT.DEFAULT_INVALID\", `The column \"${where.table}\".\"${where.column}\" has a now() default, but its data type ${dataType} stores no date or time, so there is no current value to write. Remove the default, or give the field a date or time type.`, { meta: {\n\t\ttable: where.table,\n\t\tcolumn: where.column,\n\t\tdataType,\n\t\treason: \"now-default-not-date-or-time\"\n\t} });\n\tconst precision = FRACTIONAL_SECONDS.exec(columnType.trim())?.[1];\n\treturn mysqlNowExpression(current, precision === void 0 ? void 0 : Number(precision));\n}\n/**\n* The `DEFAULT …` clause of a column, or `''` for an `autoincrement()` default, which a column writes as `AUTO_INCREMENT` instead. A literal is read by the column's codec, and a text or blob column's literal is written as an expression, as MySQL requires.\n*/\nasync function renderMysqlColumnDefault(def, columnType, codecLookup, codecRef, where) {\n\tif (def.kind === \"function\") {\n\t\tconst text = def.expression.text;\n\t\tif (text === \"autoincrement()\") return \"\";\n\t\tif (text === \"now()\") return `DEFAULT (${nowExpressionFor(columnType, codecLookup, codecRef, where)})`;\n\t\tif (checkSqlDefaultText(text) !== void 0) throw structuredError(\"CONTRACT.DEFAULT_INVALID\", `Unsafe default expression in contract: \"${text}\". Default expressions must not contain semicolons, SQL comment tokens, dollar-quoting, or subqueries.`, { meta: { expression: text } });\n\t\treturn `DEFAULT (${renderOpaqueSql(def.expression)})`;\n\t}\n\tconst encoded = codecRef === void 0 ? void 0 : await encodeLiteralDefault(codecLookup, codecRef, def.value, where);\n\tif (encoded?.kind === \"sql-null\") return \"DEFAULT NULL\";\n\treturn `DEFAULT ${withinParentheses(columnType, mysqlInlineLiteral(encoded === void 0 ? def.value : encoded.wire, where))}`;\n}\nfunction isAutoincrement(column) {\n\treturn column.default?.kind === \"function\" && column.default.expression.text === \"autoincrement()\";\n}\nasync function renderColumn(column, codecLookup, table) {\n\tconst parts = [quoteIdentifier(column.name), column.type];\n\tif (column.notNull) parts.push(\"NOT NULL\");\n\tif (column.default !== void 0) {\n\t\tconst clause = await renderMysqlColumnDefault(column.default, column.type, codecLookup, column.codecRef, {\n\t\t\ttable,\n\t\t\tcolumn: column.name\n\t\t});\n\t\tif (clause.length > 0) parts.push(clause);\n\t}\n\tif (isAutoincrement(column)) parts.push(\"AUTO_INCREMENT\");\n\tif (column.primaryKey) parts.push(\"PRIMARY KEY\");\n\treturn parts.join(\" \");\n}\nfunction columnList(columns) {\n\treturn columns.map(quoteIdentifier).join(\", \");\n}\nfunction named(name, body) {\n\treturn name === void 0 ? body : `CONSTRAINT ${quoteIdentifier(name)} ${body}`;\n}\nfunction renderConstraint(constraint) {\n\tswitch (constraint.kind) {\n\t\tcase \"primary-key\": return named(constraint.name, `PRIMARY KEY (${columnList(constraint.columns)})`);\n\t\tcase \"unique\": return named(constraint.name, `UNIQUE (${columnList(constraint.columns)})`);\n\t\tcase \"foreign-key\": {\n\t\t\tconst actions = [constraint.onDelete === void 0 ? void 0 : `ON DELETE ${REFERENTIAL_ACTION_SQL[constraint.onDelete]}`, constraint.onUpdate === void 0 ? void 0 : `ON UPDATE ${REFERENTIAL_ACTION_SQL[constraint.onUpdate]}`].filter((action) => action !== void 0);\n\t\t\treturn named(constraint.name, [`FOREIGN KEY (${columnList(constraint.columns)}) REFERENCES ${quoteIdentifier(constraint.refTable)} (${columnList(constraint.refColumns)})`, ...actions].join(\" \"));\n\t\t}\n\t\tcase \"check-expression\": throw structuredError(\"CONTRACT.CONSTRAINT_INVALID\", `The MySQL target does not write CHECK constraints yet (constraint \"${constraint.name}\").`, { meta: { constraintName: constraint.name } });\n\t}\n}\n/** The `CREATE TABLE` statement of a MySQL DDL node. */\nasync function renderMysqlCreateTable(node, codecLookup) {\n\tconst definitions = [...await Promise.all(node.columns.map((column) => renderColumn(column, codecLookup, node.table))), ...(node.constraints ?? []).map(renderConstraint)];\n\treturn {\n\t\tsql: `CREATE TABLE ${node.ifNotExists === true ? \"IF NOT EXISTS \" : \"\"}${quoteIdentifier(node.table)} (\\n ${definitions.join(\",\\n \")}\\n)`,\n\t\tparams: []\n\t};\n}\n//#endregion\n//#region src/core/migrations/declared-indexes.ts\nfunction isLoose(value) {\n\treturn typeof value === \"object\" && value !== null;\n}\nfunction child(value, key) {\n\tconst found = isLoose(value) ? value[key] : void 0;\n\treturn isLoose(found) ? found : void 0;\n}\nfunction tableIndexKey(tableName, indexName) {\n\treturn JSON.stringify([tableName, indexName]);\n}\n/** The indexes the contract handed to introspection declares, read from every contract space it holds. */\nfunction declaredIndexes(contract) {\n\tconst contracts = isLoose(contract) && Array.isArray(contract[\"contracts\"]) ? contract[\"contracts\"] : [contract];\n\tconst declared = /* @__PURE__ */ new Set();\n\tconst declaredUnique = /* @__PURE__ */ new Set();\n\tfor (const space of contracts) for (const namespace of Object.values(child(child(space, \"storage\"), \"namespaces\") ?? {})) for (const [tableName, table] of Object.entries(child(child(namespace, \"entries\"), \"table\") ?? {})) {\n\t\tconst indexes = isLoose(table) ? table[\"indexes\"] : void 0;\n\t\tfor (const index of Array.isArray(indexes) ? indexes : []) {\n\t\t\tif (!isLoose(index) || typeof index[\"name\"] !== \"string\") continue;\n\t\t\tconst key = tableIndexKey(tableName, index[\"name\"]);\n\t\t\tdeclared.add(key);\n\t\t\tif (index[\"unique\"] === true) declaredUnique.add(key);\n\t\t}\n\t}\n\treturn {\n\t\tdeclaresIndex: (tableName, indexName) => declared.has(tableIndexKey(tableName, indexName)),\n\t\tdeclaresUniqueIndex: (tableName, indexName) => declaredUnique.has(tableIndexKey(tableName, indexName))\n\t};\n}\n//#endregion\n//#region src/core/migrations/introspection.ts\nconst NOTHING_DECLARED = {\n\tdeclaresIndex: () => false,\n\tdeclaresUniqueIndex: () => false\n};\nconst PRIMARY_INDEX = \"PRIMARY\";\nconst REFERENTIAL_ACTIONS = {\n\tRESTRICT: \"restrict\",\n\tCASCADE: \"cascade\",\n\t\"SET NULL\": \"setNull\",\n\t\"SET DEFAULT\": \"setDefault\"\n};\n/** A rule `REFERENTIAL_CONSTRAINTS` reports, with `NO ACTION`, MySQL's default, as no action at all. */\nfunction referentialAction(rule) {\n\tconst normalized = rule.toUpperCase();\n\tif (normalized === \"NO ACTION\") return void 0;\n\tconst action = REFERENTIAL_ACTIONS[normalized];\n\tif (action === void 0) throw structuredError(\"CONTRACT.INTROSPECTION_UNSUPPORTED\", `Unknown MySQL referential action rule: \"${rule}\". Expected one of: NO ACTION, RESTRICT, CASCADE, SET NULL, SET DEFAULT.`, { meta: { rule } });\n\treturn action;\n}\nfunction tableDependsOn(tableName) {\n\treturn [{\n\t\tnodeKind: RelationalSchemaNodeKind.schema,\n\t\tid: \"database\"\n\t}, {\n\t\tnodeKind: RelationalSchemaNodeKind.table,\n\t\tid: tableName\n\t}];\n}\nfunction columnDependsOn(tableName, columns) {\n\treturn columns.map((column) => [...tableDependsOn(tableName), {\n\t\tnodeKind: RelationalSchemaNodeKind.column,\n\t\tid: `column:${column}`\n\t}]);\n}\nfunction groupBy(rows, key) {\n\tconst groups = /* @__PURE__ */ new Map();\n\tfor (const row of rows) {\n\t\tconst group = groups.get(key(row));\n\t\tif (group === void 0) groups.set(key(row), [row]);\n\t\telse group.push(row);\n\t}\n\treturn groups;\n}\nfunction byPosition(position) {\n\treturn (a, b) => Number(position(a)) - Number(position(b));\n}\nasync function columnOf(row, dataTypes, readLiteralDefault) {\n\tconst reported = readMysqlDefault(row.column_default, row.extra);\n\tconst readDefault = reported === void 0 ? {} : reported.kind === \"function\" ? { resolvedDefault: reported } : await readLiteralDefault(row.table_name, row.column_name, reported.literal.body);\n\tconst reportedType = {\n\t\ttext: row.column_type,\n\t\tkind: void 0,\n\t\tschema: void 0,\n\t\tname: void 0\n\t};\n\treturn {\n\t\tname: row.column_name,\n\t\ttypeText: row.column_type,\n\t\tnullable: row.is_nullable === \"YES\",\n\t\t...ifDefined(\"default\", row.column_default ?? void 0),\n\t\t...readDefault,\n\t\treportedType,\n\t\t...resolveIntrospectedColumnType(reportedType, dataTypes)\n\t};\n}\nfunction indexesOf(rows) {\n\treturn [...groupBy(rows, (row) => row.index_name).entries()].map(([name, parts]) => {\n\t\tconst ordered = [...parts].sort(byPosition((part) => part.seq_in_index));\n\t\tconst expressions = ordered.flatMap((part) => part.expression === null ? [] : [part.expression]);\n\t\treturn {\n\t\t\tname,\n\t\t\tunique: ordered[0]?.non_unique === \"0\",\n\t\t\tcolumns: ordered.flatMap((part) => part.column_name === null ? [] : [part.column_name]),\n\t\t\texpression: expressions.length === 0 ? void 0 : expressions.join(\", \")\n\t\t};\n\t});\n}\nfunction sameColumns(a, b) {\n\treturn a.length === b.length && a.every((column, index) => column === b[index]);\n}\nfunction foreignKeysOf(tableName, rows) {\n\treturn [...groupBy(rows, (row) => row.constraint_name).entries()].sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0).map(([name, parts]) => {\n\t\tconst ordered = [...parts].sort(byPosition((part) => part.ordinal_position));\n\t\tconst [first] = ordered;\n\t\tconst columns = ordered.map((part) => part.column_name);\n\t\tconst referencedTable = first?.referenced_table_name ?? \"\";\n\t\tconst referencedSchema = first?.referenced_table_schema ?? void 0;\n\t\treturn {\n\t\t\tcolumns,\n\t\t\treferencedTable,\n\t\t\treferencedColumns: ordered.map((part) => part.referenced_column_name),\n\t\t\t...ifDefined(\"referencedSchema\", referencedSchema),\n\t\t\tname,\n\t\t\t...ifDefined(\"onDelete\", first === void 0 ? void 0 : referentialAction(first.delete_rule)),\n\t\t\t...ifDefined(\"onUpdate\", first === void 0 ? void 0 : referentialAction(first.update_rule)),\n\t\t\tdependsOn: [...referencedSchema === void 0 ? [tableDependsOn(referencedTable)] : [], ...columnDependsOn(tableName, columns)]\n\t\t};\n\t});\n}\n/**\n* The index InnoDB creates for a foreign key that no index already serves: it carries the key's name and exactly the key's columns. Introspection leaves it out, because the contract describes the key, not that index. An explicit index can look the same, so one the contract declares is kept.\n*/\nfunction isForeignKeyIndex(tableName, index, foreignKeys, declared) {\n\tif (declared.declaresIndex(tableName, index.name)) return false;\n\treturn foreignKeys.some((fk) => fk.name === index.name && index.expression === void 0 && sameColumns(fk.columns, index.columns));\n}\nasync function tableOf(tableName, rows, dataTypes, readLiteralDefault, declared) {\n\tconst columns = {};\n\tfor (const row of [...rows.columns].sort(byPosition((column) => column.ordinal_position))) columns[row.column_name] = await columnOf(row, dataTypes, readLiteralDefault);\n\tconst foreignKeys = foreignKeysOf(tableName, rows.foreignKeys);\n\tconst indexes = indexesOf(rows.indexes);\n\tconst expressionIndexNames = new Set(indexes.filter((index) => index.expression !== void 0).map((index) => index.name));\n\tconst uniqueConstraintNames = new Set(rows.constraints.filter((constraint) => constraint.constraint_type === \"UNIQUE\" && !expressionIndexNames.has(constraint.constraint_name) && !declared.declaresUniqueIndex(tableName, constraint.constraint_name)).map((constraint) => constraint.constraint_name));\n\tconst primary = indexes.find((index) => index.name === PRIMARY_INDEX);\n\tconst primaryKey = primary === void 0 ? void 0 : {\n\t\tcolumns: primary.columns,\n\t\tdependsOn: columnDependsOn(tableName, primary.columns)\n\t};\n\tconst uniques = indexes.filter((index) => uniqueConstraintNames.has(index.name)).map((index) => ({\n\t\tcolumns: index.columns,\n\t\tname: index.name,\n\t\tdependsOn: columnDependsOn(tableName, index.columns)\n\t}));\n\tconst plainIndexes = indexes.filter((index) => index.name !== PRIMARY_INDEX && !uniqueConstraintNames.has(index.name) && !isForeignKeyIndex(tableName, index, foreignKeys, declared)).map((index) => {\n\t\tconst base = {\n\t\t\tnaming: {\n\t\t\t\tkind: \"exact\",\n\t\t\t\tname: index.name\n\t\t\t},\n\t\t\twhere: void 0,\n\t\t\tunique: index.unique,\n\t\t\tpartial: false,\n\t\t\ttype: void 0,\n\t\t\toptions: void 0,\n\t\t\tannotations: void 0,\n\t\t\tdependsOn: columnDependsOn(tableName, index.columns)\n\t\t};\n\t\treturn index.expression === void 0 ? {\n\t\t\t...base,\n\t\t\tcolumns: index.columns\n\t\t} : {\n\t\t\t...base,\n\t\t\texpression: index.expression\n\t\t};\n\t});\n\treturn new SqlTableIR({\n\t\tname: tableName,\n\t\tcolumns,\n\t\t...ifDefined(\"primaryKey\", primaryKey),\n\t\tforeignKeys,\n\t\tuniques,\n\t\tindexes: plainIndexes\n\t});\n}\n/**\n* The schema IR of the database the rows describe: one flat tree of its tables. MySQL lists every unique index as a UNIQUE constraint, so one is reported as a unique constraint unless the contract declares a unique index of that name on the table, or it indexes an expression. The index InnoDB creates for a foreign key is left out, unless the contract declares an index of that name on the table.\n*/\nasync function buildMysqlSchemaIR(rows, dataTypes, readLiteralDefault, declared = NOTHING_DECLARED) {\n\tconst columnsByTable = groupBy(rows.columns, (row) => row.table_name);\n\tconst indexesByTable = groupBy(rows.indexes, (row) => row.table_name);\n\tconst constraintsByTable = groupBy(rows.constraints, (row) => row.table_name);\n\tconst foreignKeysByTable = groupBy(rows.foreignKeys, (row) => row.table_name);\n\tconst tables = {};\n\tfor (const tableName of rows.tables) tables[tableName] = await tableOf(tableName, {\n\t\tcolumns: columnsByTable.get(tableName) ?? [],\n\t\tindexes: indexesByTable.get(tableName) ?? [],\n\t\tconstraints: constraintsByTable.get(tableName) ?? [],\n\t\tforeignKeys: foreignKeysByTable.get(tableName) ?? []\n\t}, dataTypes, readLiteralDefault, declared);\n\treturn new SqlSchemaIR({ tables });\n}\n//#endregion\n//#region src/core/migrations/marker-ledger.ts\nconst LEDGER_COLUMNS = \"space, migration_name, migration_hash, origin_core_hash, destination_core_hash, operations, created_at\";\nfunction operationCount(operations) {\n\tconst parsed = typeof operations === \"string\" ? parseOperations(operations) : operations;\n\treturn Array.isArray(parsed) ? parsed.length : 0;\n}\nfunction parseOperations(text) {\n\ttry {\n\t\treturn JSON.parse(text);\n\t} catch {\n\t\treturn;\n\t}\n}\nfunction text(row, column) {\n\tconst value = row[column];\n\treturn typeof value === \"string\" ? value : String(value);\n}\n/** The ledger's entries for `space`, or for every space, in the order they were applied. */\nasync function readLedgerEntries(driver, space) {\n\tif (!await tableExists(driver, LEDGER_TABLE_NAME)) return [];\n\tconst select = `SELECT ${LEDGER_COLUMNS} FROM ${quoteIdentifier(LEDGER_TABLE_NAME)}`;\n\tconst { rows } = space === void 0 ? await driver.query(`${select} ORDER BY id`) : await driver.query(`${select} WHERE space = ? ORDER BY id`, [space]);\n\treturn rows.map((row) => {\n\t\tconst origin = row[\"origin_core_hash\"];\n\t\treturn {\n\t\t\tspace: text(row, \"space\"),\n\t\t\tmigrationName: text(row, \"migration_name\"),\n\t\t\tmigrationHash: text(row, \"migration_hash\"),\n\t\t\tfrom: ledgerOriginFromStored(typeof origin === \"string\" ? origin : null),\n\t\t\tto: text(row, \"destination_core_hash\"),\n\t\t\tappliedAt: decodeMysqlDatetime(text(row, \"created_at\")),\n\t\t\toperationCount: operationCount(row[\"operations\"])\n\t\t};\n\t});\n}\nconst MARKER_INSERT = `INSERT INTO ${quoteIdentifier(MARKER_TABLE_NAME)} (space, core_hash, profile_hash, contract_json, canonical_version, updated_at, app_tag, meta, invariants) VALUES (?, ?, ?, NULL, NULL, CURRENT_TIMESTAMP(3), NULL, ?, ?)`;\nfunction metaOnInsert(destination) {\n\treturn destination.databasePolicies === void 0 ? {} : { [DATABASE_POLICIES_META_KEY]: storedDatabasePolicies(destination.databasePolicies) };\n}\nfunction markerInsertParams(space, destination) {\n\treturn [\n\t\tspace,\n\t\tdestination.storageHash,\n\t\tdestination.profileHash,\n\t\tJSON.stringify(metaOnInsert(destination)),\n\t\tJSON.stringify(destination.invariants ?? [])\n\t];\n}\n/** Inserts the marker row of `space`; fails when the space already has one. */\nasync function insertMarkerRow(driver, space, destination) {\n\tawait driver.query(MARKER_INSERT, markerInsertParams(space, destination));\n}\n/** Writes the marker row of `space`, replacing the row the space already has. Its `meta` is kept, with `policies` set when the destination records them. The update binds its values again instead of naming a row alias, which MariaDB does not accept, or `VALUES()`, which MySQL deprecates. */\nasync function upsertMarkerRow(driver, space, destination) {\n\tconst columns = \"core_hash = ?, profile_hash = ?, contract_json = NULL, canonical_version = NULL, updated_at = CURRENT_TIMESTAMP(3), app_tag = NULL, invariants = ?\";\n\tconst columnParams = [\n\t\tdestination.storageHash,\n\t\tdestination.profileHash,\n\t\tJSON.stringify(destination.invariants ?? [])\n\t];\n\tconst [update, updateParams] = destination.databasePolicies === void 0 ? [columns, columnParams] : [`${columns}, meta = JSON_SET(meta, '$.${DATABASE_POLICIES_META_KEY}', JSON_EXTRACT(?, '$'))`, [...columnParams, JSON.stringify(storedDatabasePolicies(destination.databasePolicies))]];\n\tawait driver.query(`${MARKER_INSERT} ON DUPLICATE KEY UPDATE ${update}`, [...markerInsertParams(space, destination), ...updateParams]);\n}\nfunction metaOf(text) {\n\tconst parsed = parseJsonColumn(\"meta\", text);\n\treturn typeof parsed === \"object\" && parsed !== null && !Array.isArray(parsed) ? Object.fromEntries(Object.entries(parsed)) : {};\n}\nfunction invariantsOf(text) {\n\tconst parsed = parseJsonColumn(\"invariants\", text);\n\treturn Array.isArray(parsed) ? parsed.filter((item) => typeof item === \"string\") : [];\n}\n/**\n* Advances the marker row of `space` from `expectedFrom` to `destination`, and says whether it did. MySQL has no `RETURNING`, so the row is read and locked with `FOR UPDATE` first, inside the transaction the caller holds, and written only when it still holds `expectedFrom`. Supplied invariants are merged with the stored ones; supplied policies replace `meta.policies`.\n*/\nasync function compareAndSwapMarkerRow(driver, space, expectedFrom, destination) {\n\tconst { rows } = await driver.query(`SELECT core_hash, meta, invariants FROM ${quoteIdentifier(MARKER_TABLE_NAME)} WHERE space = ? FOR UPDATE`, [space]);\n\tconst [row] = rows;\n\tif (row === void 0 || row[\"core_hash\"] !== expectedFrom) return false;\n\tconst invariants = destination.invariants === void 0 ? void 0 : [.../* @__PURE__ */ new Set([...invariantsOf(row[\"invariants\"]), ...destination.invariants])].sort();\n\tconst meta = destination.databasePolicies === void 0 ? void 0 : {\n\t\t...metaOf(row[\"meta\"]),\n\t\t[DATABASE_POLICIES_META_KEY]: storedDatabasePolicies(destination.databasePolicies)\n\t};\n\tawait driver.query(`UPDATE ${quoteIdentifier(MARKER_TABLE_NAME)} SET core_hash = ?, profile_hash = ?, updated_at = CURRENT_TIMESTAMP(3)${invariants === void 0 ? \"\" : \", invariants = ?\"}${meta === void 0 ? \"\" : \", meta = ?\"} WHERE space = ? AND core_hash = ?`, [\n\t\tdestination.storageHash,\n\t\tdestination.profileHash,\n\t\t...invariants === void 0 ? [] : [JSON.stringify(invariants)],\n\t\t...meta === void 0 ? [] : [JSON.stringify(meta)],\n\t\tspace,\n\t\texpectedFrom\n\t]);\n\treturn true;\n}\n/** Appends a ledger entry for `space`. */\nasync function insertLedgerRow(driver, space, entry) {\n\tawait driver.query(`INSERT INTO ${quoteIdentifier(LEDGER_TABLE_NAME)} (space, migration_name, migration_hash, origin_core_hash, destination_core_hash, operations) VALUES (?, ?, ?, ?, ?, ?)`, [\n\t\tspace,\n\t\tentry.migrationName,\n\t\tentry.migrationHash,\n\t\tentry.from,\n\t\tentry.to,\n\t\tJSON.stringify(entry.operations)\n\t]);\n}\n//#endregion\n//#region src/core/migrations/control-adapter.ts\n/** A DDL node MySQL does not build, such as one another target's visitor accepts. */\nfunction unsupportedDdl(ast) {\n\treturn structuredError(\"RUNTIME.DDL_UNSUPPORTED\", `The MySQL control adapter cannot lower the DDL node \"${ast.kind}\".`, { meta: {\n\t\tsurface: \"control-adapter\",\n\t\tkind: ast.kind\n\t} });\n}\n/**\n* The MySQL control adapter, for MySQL or a target that extends it. It introspects the connection's database from `information_schema`, creates, reads and writes the marker and ledger tables, takes the marker lock, and runs work in a transaction. Query lowering refuses with `RUNTIME.AST_UNSUPPORTED`.\n*/\nvar MysqlControlAdapter = class {\n\tcodecRegistry;\n\tdeclaredDataTypes;\n\ttargetId;\n\treadCatalog;\n\tfamilyId = \"sql\";\n\tmarkerLocation = MARKER_TABLE_NAME;\n\t/** `declaredDataTypes` are the stack's data types, which introspection resolves each column's reported type over. */\n\tconstructor(codecRegistry, declaredDataTypes, targetId, readCatalog) {\n\t\tthis.codecRegistry = codecRegistry;\n\t\tthis.declaredDataTypes = declaredDataTypes;\n\t\tthis.targetId = targetId;\n\t\tthis.readCatalog = readCatalog;\n\t}\n\tbootstrapControlTableQueries() {\n\t\treturn buildControlTableBootstrapQueries();\n\t}\n\tbootstrapSignMarkerQueries() {\n\t\treturn buildSignMarkerBootstrapQueries();\n\t}\n\tlower(ast) {\n\t\tif (isDdlNode(ast)) throw structuredError(\"RUNTIME.DDL_UNSUPPORTED\", \"lower() cannot lower DDL: DDL default literals require inline codec encoding, which is async. Use lowerToExecuteRequest().\", { meta: { surface: \"control-adapter\" } });\n\t\tthrow mysqlQueryNotYetSupported(\"Lowering queries\");\n\t}\n\tasync lowerToExecuteRequest(ast) {\n\t\tif (!isDdlNode(ast)) throw mysqlQueryNotYetSupported(\"Lowering queries\");\n\t\tif (typeof ast.accept !== \"function\") throw unsupportedDdl(ast);\n\t\treturn ast.accept(new Proxy({ createTable: (node) => renderMysqlCreateTable(node, this.codecRegistry) }, { get: (target, method) => Reflect.get(target, method) ?? (() => Promise.reject(unsupportedDdl(ast))) }));\n\t}\n\tasync renderColumnDefault(column, table) {\n\t\tif (column.default === void 0) return \"\";\n\t\treturn renderMysqlColumnDefault(column.default, column.type, this.codecRegistry, column.codecRef, {\n\t\t\ttable,\n\t\t\tcolumn: column.name\n\t\t});\n\t}\n\tasync readMarker(driver, space) {\n\t\tconst result = await readMarkerResult(driver, space);\n\t\treturn result.kind === \"present\" ? result.record : null;\n\t}\n\tasync readAllMarkers(driver) {\n\t\treturn withMarkerReadErrorHandling(async () => {\n\t\t\tconst markers = /* @__PURE__ */ new Map();\n\t\t\tfor (const row of await readMarkerRows(driver, void 0) ?? []) {\n\t\t\t\tconst space = String(row[\"space\"]);\n\t\t\t\tmarkers.set(space, parseMarkerRowSafely(row, () => decodeMysqlMarkerRow(row), {\n\t\t\t\t\tspace,\n\t\t\t\t\tmarkerLocation: MARKER_TABLE_NAME\n\t\t\t\t}));\n\t\t\t}\n\t\t\treturn markers;\n\t\t}, {\n\t\t\tspace: APP_SPACE_ID,\n\t\t\tmarkerLocation: MARKER_TABLE_NAME\n\t\t});\n\t}\n\tasync readLedger(driver, space) {\n\t\treturn withMarkerReadErrorHandling(() => readLedgerEntries(driver, space), {\n\t\t\tspace: space ?? \"*\",\n\t\t\tmarkerLocation: LEDGER_TABLE_NAME\n\t\t});\n\t}\n\tasync insertMarker(driver, space, destination) {\n\t\tawait insertMarkerRow(driver, space, destination);\n\t}\n\tasync initMarker(driver, space, destination) {\n\t\tawait upsertMarkerRow(driver, space, destination);\n\t}\n\tasync updateMarker(driver, space, expectedFrom, destination) {\n\t\treturn compareAndSwapMarkerRow(driver, space, expectedFrom, destination);\n\t}\n\tasync writeLedgerEntry(driver, space, entry) {\n\t\tawait insertLedgerRow(driver, space, entry);\n\t}\n\t/** Takes no lock: MySQL's `GET_LOCK` lives for the session, not the transaction, so {@link holdMarkerLock} takes it around the transaction instead. */\n\tasync lockMarker(_driver) {}\n\t/** Takes `GET_LOCK` before `work` runs and releases it when `work` ends, so `db sign` creates the marker table, whose DDL would end a transaction, under the lock. */\n\tasync holdMarkerLock(driver, work) {\n\t\treturn withMarkerLock(driver, work);\n\t}\n\tasync withTransaction(driver, fn) {\n\t\treturn this.#inTransaction(driver, fn);\n\t}\n\tasync #inTransaction(driver, fn) {\n\t\tawait driver.query(\"START TRANSACTION\");\n\t\tlet result;\n\t\ttry {\n\t\t\tresult = await fn();\n\t\t} catch (error) {\n\t\t\ttry {\n\t\t\t\tawait driver.query(\"ROLLBACK\");\n\t\t\t} catch (rollbackError) {\n\t\t\t\tif (error instanceof Error && error.cause === void 0) error.cause = rollbackError;\n\t\t\t}\n\t\t\tthrow error;\n\t\t}\n\t\tawait driver.query(\"COMMIT\");\n\t\treturn result;\n\t}\n\tasync introspect(driver, contract) {\n\t\tconst columns = contractColumns(contract);\n\t\treturn buildMysqlSchemaIR(await this.readCatalog(driver), this.declaredDataTypes, async (tableName, columnName, rawDefault) => {\n\t\t\tconst column = columns.columnOf(void 0, tableName, columnName);\n\t\t\tconst codec = column === void 0 ? void 0 : codecForRef(this.codecRegistry, column.codecRef);\n\t\t\tif (codec === void 0) return {};\n\t\t\treturn readColumnDefault(codec, {\n\t\t\t\tliteral: {\n\t\t\t\t\tkind: \"value\",\n\t\t\t\t\tbody: rawDefault\n\t\t\t\t},\n\t\t\t\traw: rawDefault\n\t\t\t}, void 0);\n\t\t}, declaredIndexes(contract));\n\t}\n};\n/** The control adapter of MySQL, or of a target that extends it, for the stack the adapter descriptor is given. */\nfunction createMysqlControlAdapter(stack, options) {\n\treturn new MysqlControlAdapter(assembleMysqlCodecRegistry(stack.target, stack.extensions), stack.declaredDataTypes.map(({ type }) => type), stack.target.targetId, options.readCatalog);\n}\nconst MYSQL_CATALOG_QUERIES = {\n\ttables: `SELECT TABLE_NAME AS table_name\n FROM information_schema.TABLES\n WHERE TABLE_SCHEMA = DATABASE() AND TABLE_TYPE = 'BASE TABLE'\n ORDER BY TABLE_NAME`,\n\tcolumns: `SELECT TABLE_NAME AS table_name, COLUMN_NAME AS column_name,\n ORDINAL_POSITION AS ordinal_position, COLUMN_DEFAULT AS column_default,\n IS_NULLABLE AS is_nullable, COLUMN_TYPE AS column_type, EXTRA AS extra\n FROM information_schema.COLUMNS\n WHERE TABLE_SCHEMA = DATABASE()\n ORDER BY TABLE_NAME, ORDINAL_POSITION`,\n\tindexes: `SELECT TABLE_NAME AS table_name, INDEX_NAME AS index_name,\n NON_UNIQUE AS non_unique, SEQ_IN_INDEX AS seq_in_index,\n COLUMN_NAME AS column_name, EXPRESSION AS expression\n FROM information_schema.STATISTICS\n WHERE TABLE_SCHEMA = DATABASE()\n ORDER BY TABLE_NAME, INDEX_NAME, SEQ_IN_INDEX`,\n\tconstraints: `SELECT TABLE_NAME AS table_name, CONSTRAINT_NAME AS constraint_name,\n CONSTRAINT_TYPE AS constraint_type\n FROM information_schema.TABLE_CONSTRAINTS\n WHERE TABLE_SCHEMA = DATABASE()`,\n\tforeignKeys: `SELECT k.TABLE_NAME AS table_name, k.CONSTRAINT_NAME AS constraint_name,\n k.COLUMN_NAME AS column_name, k.ORDINAL_POSITION AS ordinal_position,\n NULLIF(k.REFERENCED_TABLE_SCHEMA, k.TABLE_SCHEMA) AS referenced_table_schema,\n k.REFERENCED_TABLE_NAME AS referenced_table_name,\n k.REFERENCED_COLUMN_NAME AS referenced_column_name,\n r.UPDATE_RULE AS update_rule, r.DELETE_RULE AS delete_rule\n FROM information_schema.KEY_COLUMN_USAGE k\n JOIN information_schema.REFERENTIAL_CONSTRAINTS r\n ON r.CONSTRAINT_SCHEMA = k.CONSTRAINT_SCHEMA\n AND r.TABLE_NAME = k.TABLE_NAME\n AND r.CONSTRAINT_NAME = k.CONSTRAINT_NAME\n WHERE k.TABLE_SCHEMA = DATABASE() AND k.REFERENCED_TABLE_NAME IS NOT NULL\n ORDER BY k.TABLE_NAME, k.CONSTRAINT_NAME, k.ORDINAL_POSITION`\n};\n/** Reads the catalog rows of the connection's database, leaving out the runner's control tables. */\nasync function readMysqlCatalog(driver, queries = MYSQL_CATALOG_QUERIES) {\n\tconst keep = (rows) => rows.filter((row) => !CONTROL_TABLE_NAMES.has(row.table_name));\n\tconst tables = await driver.query(queries.tables);\n\tconst columns = await driver.query(queries.columns);\n\tconst indexes = await driver.query(queries.indexes);\n\tconst constraints = await driver.query(queries.constraints);\n\tconst foreignKeys = await driver.query(queries.foreignKeys);\n\treturn {\n\t\ttables: keep(tables.rows).map((row) => row.table_name),\n\t\tcolumns: keep(columns.rows),\n\t\tindexes: keep(indexes.rows),\n\t\tconstraints: keep(constraints.rows),\n\t\tforeignKeys: keep(foreignKeys.rows)\n\t};\n}\n//#endregion\n//#region src/exports/control.ts\nconst mysqlAdapterDescriptor = {\n\t...mysqlAdapterDescriptorMeta,\n\tcontrolMutationDefaults: {\n\t\tdefaultFunctionRegistry: new Map(Object.entries(sqlDefaultFunctions())),\n\t\tgeneratorDescriptors: []\n\t},\n\tcreate(stack) {\n\t\treturn createMysqlControlAdapter(stack, { readCatalog: readMysqlCatalog });\n\t}\n};\n//#endregion\nexport { MYSQL_CATALOG_QUERIES, buildMysqlSchemaIR, createMysqlControlAdapter, mysqlAdapterDescriptor as default, readMysqlCatalog };\n\n//# sourceMappingURL=control.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAsBA,MAAM,0BAA0B;AAChC,MAAM,qBAAqB;AAC3B,SAAS,eAAe,OAAO,KAAK;CACnC,MAAM,gBAAgB,4BAA4B,WAAW,MAAM,MAAM,KAAK,MAAM,OAAO,sCAAsC,OAAO,EAAE,MAAM;EAC/I,OAAO,MAAM;EACb,QAAQ,MAAM;CACf,EAAE,CAAC;AACJ;;AAEA,SAAS,mBAAmB,MAAM,OAAO;CACxC,IAAI,SAAS,MAAM,OAAO;CAC1B,IAAI,OAAO,SAAS,WAAW,OAAO,OAAO,MAAM;CACnD,IAAI,OAAO,SAAS,UAAU;EAC7B,IAAI,CAAC,OAAO,SAAS,IAAI,GAAG,OAAO,eAAe,OAAO,GAAG,KAAK,wBAAwB;EACzF,OAAO,OAAO,IAAI;CACnB;CACA,IAAI,OAAO,SAAS,UAAU,OAAO,OAAO,IAAI;CAChD,IAAI,OAAO,SAAS,UAAU,OAAO,aAAa,IAAI;CACtD,IAAI,gBAAgB,MAAM,OAAO,aAAa,oBAAoB,IAAI,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C1B,SAAS,KAAK,QAAQ,IAAI;EAC1B,aAAa,KAAK,YAAY,IAAI;EAClC,aAAa,KAAK,YAAY,IAAI;CACnC;AACD;AAGA,MAAM,yBAAyB;CAC9B,GAAG;CACH,yBAAyB;EACxB,yBAAyB,IAAI,IAAI,OAAO,QAAQ,oBAAoB,CAAC,CAAC;EACtE,sBAAsB,CAAC;CACxB;CACA,OAAO,OAAO;EACb,OAAO,0BAA0B,OAAO,EAAE,aAAa,iBAAiB,CAAC;CAC1E;AACD"}
@@ -1,7 +1,7 @@
1
1
  import { s as mysqlError } from "./errors-Cng94tYg-DTH51xWG.mjs";
2
2
  import { n as mysqlTargetDescriptorMeta } from "./descriptor-meta-BF6YvSag-ChHHvlHc.mjs";
3
3
  import { t as MysqlContractSerializer } from "./mysql-contract-serializer-BnTKRSsN-BnV7fdYd.mjs";
4
- import { _ as createMysqlMigrationPlanner, b as mysqlContractToSchema, d as MYSQL_MIGRATION_MODULE, v as createMysqlMigrationRunner, y as diffMysqlSchema } from "./runner-BIjAWX-E-BgTmrD8f.mjs";
4
+ import { _ as createMysqlMigrationPlanner, b as mysqlContractToSchema, d as MYSQL_MIGRATION_MODULE, v as createMysqlMigrationRunner, y as diffMysqlSchema } from "./runner-DEKKxDyw-Cdo1Ysod.mjs";
5
5
  import { blindCast } from "@prisma/orm-framework/utils/casts";
6
6
  import { setFallbackTemporal } from "@prisma/orm-framework/type-implementations/temporal";
7
7
  import { SqlStorage } from "@prisma/orm-family-sql/contract/types";
@@ -70,4 +70,4 @@ const mysqlControlTargetDescriptor = createMysqlControlTargetDescriptor({
70
70
  //#endregion
71
71
  export { mysqlControlTargetDescriptor as n, createMysqlControlTargetDescriptor as t };
72
72
 
73
- //# sourceMappingURL=control-DNuE7H2C.mjs.map
73
+ //# sourceMappingURL=control-RYDTbndD.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"control-DNuE7H2C.mjs","names":[],"sources":["../../../../3-targets/mysql/1-mysql/1-target/dist/control.mjs"],"sourcesContent":["import { s as mysqlError } from \"./errors-Cng94tYg.mjs\";\nimport { n as mysqlScalarTypeConstructors, t as mysqlTargetDescriptorMeta } from \"./descriptor-meta-BF6YvSag.mjs\";\nimport { t as MysqlContractSerializer } from \"./mysql-contract-serializer-BnTKRSsN.mjs\";\nimport { _ as MYSQL_MIGRATION_MODULE, b as diffMysqlSchema, r as createMysqlMigrationPlanner, t as createMysqlMigrationRunner, x as mysqlContractToSchema } from \"./runner-BIjAWX-E.mjs\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { setFallbackTemporal } from \"@internal/type-implementations/temporal\";\nimport { sqlTypeLookupsOf } from \"@internal/family-sql/control\";\nimport { SqlStorage } from \"@internal/sql-contract/types\";\nimport { relationalNodeEntityKind, relationalNodeGranularity } from \"@internal/sql-schema-ir/types\";\nimport { Temporal } from \"temporal-polyfill/full/implementation\";\nimport { SqlSchemaVerifierBase } from \"@internal/family-sql/ir\";\n//#region src/core/migrations/mysql-schema-verifier.ts\n/** The MySQL `SchemaVerifier`. Verification runs through `diffSchema`; these hooks add nothing, as on the other SQL targets. */\nvar MysqlSchemaVerifier = class extends SqlSchemaVerifierBase {\n\tverifyCommonSqlSchema(_options) {\n\t\treturn [];\n\t}\n\tverifyTargetExtensions(_options) {\n\t\treturn [];\n\t}\n};\n//#endregion\n//#region src/core/migrations/control-target.ts\nfunction isSqlContract(contract) {\n\treturn contract === null || contract.storage instanceof SqlStorage;\n}\n/** The control target of MySQL, or of a target that extends it, which reuses MySQL's planner, runner, schema verifier and contract serializer under its own target id. */\nfunction createMysqlControlTargetDescriptor(options) {\n\tsetFallbackTemporal(Temporal);\n\tconst { descriptorMeta } = options;\n\tconst migrationTarget = {\n\t\ttargetId: descriptorMeta.targetId,\n\t\tmigrationModule: options.migrationModule\n\t};\n\treturn {\n\t\t...descriptorMeta,\n\t\tcontractSerializer: new MysqlContractSerializer(),\n\t\tschemaVerifier: new MysqlSchemaVerifier(),\n\t\tdiffSchema: diffMysqlSchema,\n\t\tclassifySubjectGranularity: relationalNodeGranularity,\n\t\tclassifyEntityKind: relationalNodeEntityKind,\n\t\tmigrations: {\n\t\t\tcreatePlanner(adapter) {\n\t\t\t\treturn createMysqlMigrationPlanner(adapter, migrationTarget);\n\t\t\t},\n\t\t\tcreateRunner(family) {\n\t\t\t\treturn blindCast(createMysqlMigrationRunner(family));\n\t\t\t},\n\t\t\tcontractToSchema(contract, frameworkComponents) {\n\t\t\t\tif (!isSqlContract(contract)) throw mysqlError(\"CONTRACT.TARGET_MISMATCH\", \"The MySQL target received a contract that is not a SQL contract.\");\n\t\t\t\treturn mysqlContractToSchema(contract, sqlTypeLookupsOf(frameworkComponents));\n\t\t\t}\n\t\t},\n\t\tcreate() {\n\t\t\treturn {\n\t\t\t\tfamilyId: \"sql\",\n\t\t\t\ttargetId: descriptorMeta.targetId\n\t\t\t};\n\t\t},\n\t\tcreatePlanner(adapter) {\n\t\t\treturn createMysqlMigrationPlanner(adapter, migrationTarget);\n\t\t},\n\t\tcreateRunner(family) {\n\t\t\treturn createMysqlMigrationRunner(family);\n\t\t}\n\t};\n}\nconst mysqlControlTargetDescriptor = createMysqlControlTargetDescriptor({\n\tdescriptorMeta: mysqlTargetDescriptorMeta,\n\tmigrationModule: MYSQL_MIGRATION_MODULE\n});\n//#endregion\nexport { createMysqlControlTargetDescriptor, mysqlControlTargetDescriptor as default, mysqlScalarTypeConstructors };\n\n//# sourceMappingURL=control.mjs.map"],"mappings":";;;;;;;;;;;;;AAaA,IAAI,sBAAsB,cAAc,sBAAsB;CAC7D,sBAAsB,UAAU;EAC/B,OAAO,CAAC;CACT;CACA,uBAAuB,UAAU;EAChC,OAAO,CAAC;CACT;AACD;AAGA,SAAS,cAAc,UAAU;CAChC,OAAO,aAAa,QAAQ,SAAS,mBAAmB;AACzD;;AAEA,SAAS,mCAAmC,SAAS;CACpD,oBAAoB,QAAQ;CAC5B,MAAM,EAAE,mBAAmB;CAC3B,MAAM,kBAAkB;EACvB,UAAU,eAAe;EACzB,iBAAiB,QAAQ;CAC1B;CACA,OAAO;EACN,GAAG;EACH,oBAAoB,IAAI,wBAAwB;EAChD,gBAAgB,IAAI,oBAAoB;EACxC,YAAY;EACZ,4BAA4B;EAC5B,oBAAoB;EACpB,YAAY;GACX,cAAc,SAAS;IACtB,OAAO,4BAA4B,SAAS,eAAe;GAC5D;GACA,aAAa,QAAQ;IACpB,OAAO,UAAU,2BAA2B,MAAM,CAAC;GACpD;GACA,iBAAiB,UAAU,qBAAqB;IAC/C,IAAI,CAAC,cAAc,QAAQ,GAAG,MAAM,WAAW,4BAA4B,kEAAkE;IAC7I,OAAO,sBAAsB,UAAU,iBAAiB,mBAAmB,CAAC;GAC7E;EACD;EACA,SAAS;GACR,OAAO;IACN,UAAU;IACV,UAAU,eAAe;GAC1B;EACD;EACA,cAAc,SAAS;GACtB,OAAO,4BAA4B,SAAS,eAAe;EAC5D;EACA,aAAa,QAAQ;GACpB,OAAO,2BAA2B,MAAM;EACzC;CACD;AACD;AACA,MAAM,+BAA+B,mCAAmC;CACvE,gBAAgB;CAChB,iBAAiB;AAClB,CAAC"}
1
+ {"version":3,"file":"control-RYDTbndD.mjs","names":[],"sources":["../../../../3-targets/mysql/1-mysql/1-target/dist/control.mjs"],"sourcesContent":["import { s as mysqlError } from \"./errors-Cng94tYg.mjs\";\nimport { n as mysqlScalarTypeConstructors, t as mysqlTargetDescriptorMeta } from \"./descriptor-meta-BF6YvSag.mjs\";\nimport { t as MysqlContractSerializer } from \"./mysql-contract-serializer-BnTKRSsN.mjs\";\nimport { _ as MYSQL_MIGRATION_MODULE, b as diffMysqlSchema, r as createMysqlMigrationPlanner, t as createMysqlMigrationRunner, x as mysqlContractToSchema } from \"./runner-DEKKxDyw.mjs\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { setFallbackTemporal } from \"@internal/type-implementations/temporal\";\nimport { sqlTypeLookupsOf } from \"@internal/family-sql/control\";\nimport { SqlStorage } from \"@internal/sql-contract/types\";\nimport { relationalNodeEntityKind, relationalNodeGranularity } from \"@internal/sql-schema-ir/types\";\nimport { Temporal } from \"temporal-polyfill/full/implementation\";\nimport { SqlSchemaVerifierBase } from \"@internal/family-sql/ir\";\n//#region src/core/migrations/mysql-schema-verifier.ts\n/** The MySQL `SchemaVerifier`. Verification runs through `diffSchema`; these hooks add nothing, as on the other SQL targets. */\nvar MysqlSchemaVerifier = class extends SqlSchemaVerifierBase {\n\tverifyCommonSqlSchema(_options) {\n\t\treturn [];\n\t}\n\tverifyTargetExtensions(_options) {\n\t\treturn [];\n\t}\n};\n//#endregion\n//#region src/core/migrations/control-target.ts\nfunction isSqlContract(contract) {\n\treturn contract === null || contract.storage instanceof SqlStorage;\n}\n/** The control target of MySQL, or of a target that extends it, which reuses MySQL's planner, runner, schema verifier and contract serializer under its own target id. */\nfunction createMysqlControlTargetDescriptor(options) {\n\tsetFallbackTemporal(Temporal);\n\tconst { descriptorMeta } = options;\n\tconst migrationTarget = {\n\t\ttargetId: descriptorMeta.targetId,\n\t\tmigrationModule: options.migrationModule\n\t};\n\treturn {\n\t\t...descriptorMeta,\n\t\tcontractSerializer: new MysqlContractSerializer(),\n\t\tschemaVerifier: new MysqlSchemaVerifier(),\n\t\tdiffSchema: diffMysqlSchema,\n\t\tclassifySubjectGranularity: relationalNodeGranularity,\n\t\tclassifyEntityKind: relationalNodeEntityKind,\n\t\tmigrations: {\n\t\t\tcreatePlanner(adapter) {\n\t\t\t\treturn createMysqlMigrationPlanner(adapter, migrationTarget);\n\t\t\t},\n\t\t\tcreateRunner(family) {\n\t\t\t\treturn blindCast(createMysqlMigrationRunner(family));\n\t\t\t},\n\t\t\tcontractToSchema(contract, frameworkComponents) {\n\t\t\t\tif (!isSqlContract(contract)) throw mysqlError(\"CONTRACT.TARGET_MISMATCH\", \"The MySQL target received a contract that is not a SQL contract.\");\n\t\t\t\treturn mysqlContractToSchema(contract, sqlTypeLookupsOf(frameworkComponents));\n\t\t\t}\n\t\t},\n\t\tcreate() {\n\t\t\treturn {\n\t\t\t\tfamilyId: \"sql\",\n\t\t\t\ttargetId: descriptorMeta.targetId\n\t\t\t};\n\t\t},\n\t\tcreatePlanner(adapter) {\n\t\t\treturn createMysqlMigrationPlanner(adapter, migrationTarget);\n\t\t},\n\t\tcreateRunner(family) {\n\t\t\treturn createMysqlMigrationRunner(family);\n\t\t}\n\t};\n}\nconst mysqlControlTargetDescriptor = createMysqlControlTargetDescriptor({\n\tdescriptorMeta: mysqlTargetDescriptorMeta,\n\tmigrationModule: MYSQL_MIGRATION_MODULE\n});\n//#endregion\nexport { createMysqlControlTargetDescriptor, mysqlControlTargetDescriptor as default, mysqlScalarTypeConstructors };\n\n//# sourceMappingURL=control.mjs.map"],"mappings":";;;;;;;;;;;;;AAaA,IAAI,sBAAsB,cAAc,sBAAsB;CAC7D,sBAAsB,UAAU;EAC/B,OAAO,CAAC;CACT;CACA,uBAAuB,UAAU;EAChC,OAAO,CAAC;CACT;AACD;AAGA,SAAS,cAAc,UAAU;CAChC,OAAO,aAAa,QAAQ,SAAS,mBAAmB;AACzD;;AAEA,SAAS,mCAAmC,SAAS;CACpD,oBAAoB,QAAQ;CAC5B,MAAM,EAAE,mBAAmB;CAC3B,MAAM,kBAAkB;EACvB,UAAU,eAAe;EACzB,iBAAiB,QAAQ;CAC1B;CACA,OAAO;EACN,GAAG;EACH,oBAAoB,IAAI,wBAAwB;EAChD,gBAAgB,IAAI,oBAAoB;EACxC,YAAY;EACZ,4BAA4B;EAC5B,oBAAoB;EACpB,YAAY;GACX,cAAc,SAAS;IACtB,OAAO,4BAA4B,SAAS,eAAe;GAC5D;GACA,aAAa,QAAQ;IACpB,OAAO,UAAU,2BAA2B,MAAM,CAAC;GACpD;GACA,iBAAiB,UAAU,qBAAqB;IAC/C,IAAI,CAAC,cAAc,QAAQ,GAAG,MAAM,WAAW,4BAA4B,kEAAkE;IAC7I,OAAO,sBAAsB,UAAU,iBAAiB,mBAAmB,CAAC;GAC7E;EACD;EACA,SAAS;GACR,OAAO;IACN,UAAU;IACV,UAAU,eAAe;GAC1B;EACD;EACA,cAAc,SAAS;GACtB,OAAO,4BAA4B,SAAS,eAAe;EAC5D;EACA,aAAa,QAAQ;GACpB,OAAO,2BAA2B,MAAM;EACzC;CACD;AACD;AACA,MAAM,+BAA+B,mCAAmC;CACvE,gBAAgB;CAChB,iBAAiB;AAClB,CAAC"}
@@ -13,7 +13,7 @@ import { ifDefined } from "@prisma/orm-framework/utils/defined";
13
13
  import { isSqlDataType, renderSqlTypeName } from "@prisma/orm-family-sql/contract/data-type";
14
14
  import { contractSnapshotJsonSpecifier, contractSnapshotTypesSpecifier, diffSchemas, expectAbsent, expectPresent, failedPostcheckWhy, failedPrecheckWhy, issueOutcome, migrationRunnerFailure, orderIssuesByDependencies, schemaCheckWhy, withDatabaseUnchanged, withFailingSpace } from "@prisma/orm-framework/components/control";
15
15
  import { UNBOUND_NAMESPACE_ID, entityAt } from "@prisma/orm-framework/components/ir";
16
- import { NO_RENAMED_ORIGINS, contractToSchemaIR, createSqlTextSources, plannerFailure, runnerFailure, runnerSuccess, sqlTypeLookupsOf, subjectsOfCalls } from "@prisma/orm-family-sql/family/control";
16
+ import { NO_RENAMED_ORIGINS, checkDatabasePoliciesHeld, contractToSchemaIR, createSqlTextSources, plannerFailure, runnerFailure, runnerSuccess, sqlTypeLookupsOf, subjectsOfCalls } from "@prisma/orm-family-sql/family/control";
17
17
  import { RelationalSchemaNodeKind, SqlSchemaIR, sqlColumnTypesEqual } from "@prisma/orm-family-sql/schema-ir/types";
18
18
  import { TsExpression, jsonToTsSource, renderImports } from "@prisma/orm-framework/ts-render";
19
19
  import { REFERENTIAL_ACTION_SQL } from "@prisma/orm-family-sql/contract/referential-action-sql";
@@ -22,7 +22,7 @@ import { Migration } from "@prisma/orm-family-sql/family/migration";
22
22
  import { isThenable } from "@prisma/orm-framework/utils/promise";
23
23
  import { keepInternalSpecifiers, resolveRequirementSpecifiers } from "@prisma/orm-framework/components/emission";
24
24
  import { detectScaffoldRuntime, shebangLineFor } from "@prisma/orm-toolchain/migration-tools/migration-ts";
25
- //#region ../../../3-targets/mysql/1-mysql/1-target/dist/runner-BIjAWX-E.mjs
25
+ //#region ../../../3-targets/mysql/1-mysql/1-target/dist/runner-DEKKxDyw.mjs
26
26
  /**
27
27
  * The schema IR a contract describes on MySQL: one flat tree of tables, each column typed by the data type its codec represents. A MySQL database holds no schemas, so foreign keys name no referenced schema, as introspection reports them.
28
28
  */
@@ -1390,9 +1390,15 @@ var MysqlMigrationRunner = class {
1390
1390
  this.family = family;
1391
1391
  }
1392
1392
  async execute(options) {
1393
- const { driver, perSpaceOptions } = options;
1393
+ const { driver, perSpaceOptions, expectedDatabasePolicies } = options;
1394
1394
  if (perSpaceOptions.length === 0) return ok({ perSpaceResults: [] });
1395
- return withMarkerLock(driver, () => this.#applySpaces(driver, perSpaceOptions), (result) => result.ok);
1395
+ return withMarkerLock(driver, async () => {
1396
+ if (expectedDatabasePolicies !== void 0) {
1397
+ const policiesCheck = await checkDatabasePoliciesHeld(this.family, driver, expectedDatabasePolicies);
1398
+ if (!policiesCheck.ok) return notOk(withDatabaseUnchanged(policiesCheck.failure, true));
1399
+ }
1400
+ return this.#applySpaces(driver, perSpaceOptions);
1401
+ }, (result) => result.ok);
1396
1402
  }
1397
1403
  async executeOnConnection(options) {
1398
1404
  return this.#applySpace(options, { changedDatabase: false });
@@ -1445,7 +1451,8 @@ var MysqlMigrationRunner = class {
1445
1451
  const originCheck = this.#checkOrigin(existingMarker, options.plan.origin ?? null);
1446
1452
  if (!originCheck.ok) return originCheck;
1447
1453
  const isSelfEdge = options.plan.origin?.storageHash === options.plan.destination.storageHash;
1448
- const applied = existingMarker !== null && existingMarker.storageHash === options.plan.destination.storageHash && (options.plan.destination.profileHash === void 0 || existingMarker.profileHash === options.plan.destination.profileHash) && options.plan.origin != null && !isSelfEdge ? {
1454
+ const atDestination = existingMarker !== null && existingMarker.storageHash === options.plan.destination.storageHash && (options.plan.destination.profileHash === void 0 || existingMarker.profileHash === options.plan.destination.profileHash);
1455
+ const applied = atDestination && options.plan.origin != null && !isSelfEdge ? {
1449
1456
  result: okVoid(),
1450
1457
  executed: [],
1451
1458
  executedCount: 0
@@ -1466,8 +1473,11 @@ var MysqlMigrationRunner = class {
1466
1473
  meta: { schemaIssues: verified.schema.issues }
1467
1474
  });
1468
1475
  const existingInvariants = new Set(existingMarker?.invariants ?? []);
1469
- if (!(isSelfEdge && applied.executedCount === 0 && options.plan.providedInvariants.every((id) => existingInvariants.has(id)))) {
1470
- const written = await this.#writeMarkerAndLedger(driver, options, existingMarker, applied.executed, progress);
1476
+ const incomingIsSubsetOfExisting = options.plan.providedInvariants.every((id) => existingInvariants.has(id));
1477
+ const isSelfEdgeNoOp = isSelfEdge && applied.executedCount === 0 && incomingIsSubsetOfExisting;
1478
+ const recordsPoliciesOnly = options.databasePolicies !== void 0 && applied.executedCount === 0 && atDestination && incomingIsSubsetOfExisting;
1479
+ if (!isSelfEdgeNoOp || options.databasePolicies !== void 0) {
1480
+ const written = await this.#writeMarkerAndLedger(driver, options, existingMarker, isSelfEdgeNoOp || recordsPoliciesOnly ? void 0 : applied.executed, progress);
1471
1481
  if (!written.ok) return written;
1472
1482
  }
1473
1483
  return runnerSuccess({
@@ -1562,7 +1572,8 @@ var MysqlMigrationRunner = class {
1562
1572
  const destination = {
1563
1573
  storageHash: plan.destination.storageHash,
1564
1574
  profileHash: plan.destination.profileHash ?? options.destinationContract.profileHash ?? plan.destination.storageHash,
1565
- invariants: plan.providedInvariants
1575
+ invariants: plan.providedInvariants,
1576
+ ...ifDefined("databasePolicies", options.databasePolicies)
1566
1577
  };
1567
1578
  await driver.query("START TRANSACTION");
1568
1579
  try {
@@ -1583,13 +1594,14 @@ var MysqlMigrationRunner = class {
1583
1594
  space: plan.spaceId
1584
1595
  });
1585
1596
  return runnerFailure("MIGRATION.MARKER_CAS_FAILURE", "Marker was modified by another process during migration execution.", { meta: {
1597
+ reason: "storageHash",
1586
1598
  space: plan.spaceId,
1587
1599
  expectedStorageHash: existingMarker.storageHash,
1588
1600
  foundStorageHash: found?.storageHash ?? null,
1589
1601
  destinationStorageHash: plan.destination.storageHash
1590
1602
  } });
1591
1603
  }
1592
- await this.#writeLedger(driver, options, executed);
1604
+ if (executed !== void 0) await this.#writeLedger(driver, options, executed);
1593
1605
  } catch (error) {
1594
1606
  await driver.query("ROLLBACK").catch(() => void 0);
1595
1607
  throw error;
@@ -1664,4 +1676,4 @@ function createMysqlMigrationRunner(family) {
1664
1676
  //#endregion
1665
1677
  export { createMysqlMigrationPlanner as _, CreateTableCall as a, mysqlContractToSchema as b, DropIndexCall as c, MYSQL_MIGRATION_MODULE as d, MysqlMigration as f, TypeScriptRenderableMysqlMigration as g, RawSqlCall as h, CreateIndexCall as i, DropTableCall as l, MysqlMigrationPlanner as m, AddForeignKeyCall as n, DropColumnCall as o, MysqlMigrationBase as p, AddUniqueCall as r, DropForeignKeyCall as s, AddColumnCall as t, DropUniqueCall as u, createMysqlMigrationRunner as v, rawSql as x, diffMysqlSchema as y };
1666
1678
 
1667
- //# sourceMappingURL=runner-BIjAWX-E-BgTmrD8f.mjs.map
1679
+ //# sourceMappingURL=runner-DEKKxDyw-Cdo1Ysod.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runner-DEKKxDyw-Cdo1Ysod.mjs","names":["#written","#migrationModule","#calls","#meta","#spaceId","#snapshotsImportPath","#destination","#lowerer","#operationsCache","#target","#planSql","#applySpaces","#applySpace","#checkDestination","#checkPolicy","#ensureControlTables","#checkOrigin","#applyOperations","#writeMarkerAndLedger","#allHold","#runChecks","#runSteps","#writeLedger"],"sources":["../../../../3-targets/mysql/1-mysql/1-target/dist/runner-DEKKxDyw.mjs"],"sourcesContent":["import { s as mysqlError } from \"./errors-Cng94tYg.mjs\";\nimport { n as quoteIdentifier } from \"./sql-utils-Cmv_TVa8.mjs\";\nimport { t as CONTROL_TABLE_NAMES } from \"./control-tables-CcQ77JE7.mjs\";\nimport { t as createTable } from \"./ddl-DDmMHyA_.mjs\";\nimport { t as mysqlResolveDefault } from \"./default-normalizer-C8pc7SbL.mjs\";\nimport { i as withMarkerLock } from \"./marker-lock-Bwew7cAs.mjs\";\nimport { dataTypeParams } from \"@internal/framework-components/codec\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { InternalError, isInternalError } from \"@internal/utils/internal-error\";\nimport { isStructuredError } from \"@internal/utils/structured-error\";\nimport { DdlColumn, FunctionColumnDefault, LiteralColumnDefault, PrimaryKeyConstraint, UniqueConstraint, opaqueSql } from \"@internal/sql-relational-core/ast\";\nimport { isSqlDataType, renderSqlTypeName } from \"@internal/sql-contract/data-type\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { contractSnapshotJsonSpecifier, contractSnapshotTypesSpecifier, diffSchemas, expectAbsent, expectPresent, failedPostcheckWhy, failedPrecheckWhy, issueOutcome, migrationRunnerFailure, orderIssuesByDependencies, schemaCheckWhy, withDatabaseUnchanged, withFailingSpace } from \"@internal/framework-components/control\";\nimport { NO_RENAMED_ORIGINS, checkDatabasePoliciesHeld, contractToSchemaIR, createSqlTextSources, plannerFailure, runnerFailure, runnerSuccess, sqlTypeLookupsOf, subjectsOfCalls } from \"@internal/family-sql/control\";\nimport { RelationalSchemaNodeKind, SqlSchemaIR, sqlColumnTypesEqual } from \"@internal/sql-schema-ir/types\";\nimport { UNBOUND_NAMESPACE_ID, entityAt } from \"@internal/framework-components/ir\";\nimport { TsExpression, jsonToTsSource, renderImports } from \"@internal/ts-render\";\nimport { REFERENTIAL_ACTION_SQL } from \"@internal/sql-contract/referential-action-sql\";\nimport { notOk, ok, okVoid } from \"@internal/utils/result\";\nimport { Migration } from \"@internal/family-sql/migration\";\nimport { isThenable } from \"@internal/utils/promise\";\nimport { keepInternalSpecifiers, resolveRequirementSpecifiers } from \"@internal/framework-components/emission\";\nimport { detectScaffoldRuntime, shebangLineFor } from \"@internal/migration-tools/migration-ts\";\n//#region src/core/migrations/diff-database-schema.ts\n/**\n* The schema IR a contract describes on MySQL: one flat tree of tables, each column typed by the data type its codec represents. A MySQL database holds no schemas, so foreign keys name no referenced schema, as introspection reports them.\n*/\nfunction mysqlContractToSchema(contract, types) {\n\treturn contractToSchemaIR(contract, {\n\t\tannotationNamespace: \"mysql\",\n\t\tresolveDefault: mysqlResolveDefault,\n\t\tdataTypeLookup: types.dataTypeLookup,\n\t\tcodecLookup: types.codecLookup\n\t});\n}\n/** The control policy of the table an issue is about. The tree is flat, so the table's name is the second segment of the issue's path. */\nfunction resolveControlPolicy(issue, contract) {\n\tconst tableName = issue.path[1];\n\tif (tableName === void 0) return void 0;\n\tfor (const namespaceId of Object.keys(contract.storage.namespaces)) {\n\t\tconst table = entityAt(contract.storage, {\n\t\t\tnamespaceId,\n\t\t\tentityKind: \"table\",\n\t\t\tentityName: tableName\n\t\t});\n\t\tif (table !== void 0) return table.control;\n\t}\n}\n/** The full-tree diff `db verify` derives its verdict from: the contract's tree against the one introspection built. */\nfunction diffMysqlSchema(input) {\n\tif (!(input.schema instanceof SqlSchemaIR)) throw mysqlError(\"CONTRACT.TARGET_MISMATCH\", \"The MySQL schema diff received a schema tree that MySQL introspection did not build.\");\n\tconst expected = mysqlContractToSchema(input.contract, sqlTypeLookupsOf(input.frameworkComponents));\n\tconst actual = input.schema;\n\tconst namespacesWithTables = Object.values(input.contract.storage.namespaces).filter((ns) => Object.keys(ns.entries.table ?? {}).length > 0);\n\treturn {\n\t\tissues: diffSchemas(expected, actual),\n\t\tresolveControlPolicy: (issue) => resolveControlPolicy(issue, input.contract),\n\t\tnamespacePairs: namespacesWithTables.map(() => ({ actual }))\n\t};\n}\n//#endregion\n//#region src/core/migrations/operations.ts\nfunction step(description, sql, params, expectation) {\n\treturn {\n\t\tdescription,\n\t\tsql,\n\t\t...ifDefined(\"params\", params),\n\t\t...ifDefined(\"expectation\", expectation)\n\t};\n}\nconst IN_DATABASE = \"TABLE_SCHEMA = DATABASE()\";\nfunction count(from, where, params) {\n\treturn {\n\t\tsql: `SELECT COUNT(*) FROM information_schema.${from} WHERE ${IN_DATABASE} AND ${where}`,\n\t\tparams\n\t};\n}\nfunction present(query) {\n\treturn {\n\t\tsql: `SELECT (${query.sql}) > 0 AS result`,\n\t\tparams: query.params\n\t};\n}\nfunction absent(query) {\n\treturn {\n\t\tsql: `SELECT (${query.sql}) = 0 AS result`,\n\t\tparams: query.params\n\t};\n}\nconst tableQuery = (table) => count(\"TABLES\", \"TABLE_NAME = ?\", [table]);\nconst columnQuery = (table, column) => count(\"COLUMNS\", \"TABLE_NAME = ? AND COLUMN_NAME = ?\", [table, column]);\nconst indexQuery = (table, index) => count(\"STATISTICS\", \"TABLE_NAME = ? AND INDEX_NAME = ?\", [table, index]);\nconst constraintQuery = (table, name, type) => count(\"TABLE_CONSTRAINTS\", \"TABLE_NAME = ? AND CONSTRAINT_NAME = ? AND CONSTRAINT_TYPE = ?\", [\n\ttable,\n\tname,\n\ttype\n]);\n/** A step that holds when `query` finds the object, or finds none, as `holds` says. */\nfunction check(description, query, holds, object) {\n\tconst { sql, params } = holds === \"present\" ? present(query) : absent(query);\n\treturn step(description, sql, params, holds === \"present\" ? expectPresent(object) : expectAbsent(object));\n}\nconst tableChecks = (table) => ({\n\tpresent: (description) => check(description, tableQuery(table), \"present\", `table \"${table}\"`),\n\tabsent: (description) => check(description, tableQuery(table), \"absent\", `table \"${table}\"`)\n});\nconst columnChecks = (table, column) => ({\n\tpresent: (description) => check(description, columnQuery(table, column), \"present\", `column \"${column}\" on \"${table}\"`),\n\tabsent: (description) => check(description, columnQuery(table, column), \"absent\", `column \"${column}\" on \"${table}\"`)\n});\nconst indexChecks = (table, index) => ({\n\tpresent: (description) => check(description, indexQuery(table, index), \"present\", `index \"${index}\" on \"${table}\"`),\n\tabsent: (description) => check(description, indexQuery(table, index), \"absent\", `index \"${index}\" on \"${table}\"`)\n});\nconst constraintChecks = (table, name, type) => {\n\tconst object = `${type === \"UNIQUE\" ? \"unique constraint\" : \"foreign key\"} \"${name}\" on \"${table}\"`;\n\treturn {\n\t\tpresent: (description) => check(description, constraintQuery(table, name, type), \"present\", object),\n\t\tabsent: (description) => check(description, constraintQuery(table, name, type), \"absent\", object)\n\t};\n};\nfunction columnList(columns) {\n\treturn columns.map(quoteIdentifier).join(\", \");\n}\n/** The column definition `ALTER TABLE … ADD COLUMN` writes, with the default the adapter renders through the column's codec. */\nasync function columnDefinitionSql(column, table, lowerer) {\n\tconst defaultClause = await lowerer.renderColumnDefault(column, table);\n\treturn [\n\t\tquoteIdentifier(column.name),\n\t\tcolumn.type,\n\t\t...column.notNull ? [\"NOT NULL\"] : [],\n\t\t...defaultClause.length > 0 ? [defaultClause] : []\n\t].join(\" \");\n}\nfunction foreignKeyActionsSql(actions) {\n\treturn [...actions.onDelete === void 0 ? [] : [` ON DELETE ${REFERENTIAL_ACTION_SQL[actions.onDelete]}`], ...actions.onUpdate === void 0 ? [] : [` ON UPDATE ${REFERENTIAL_ACTION_SQL[actions.onUpdate]}`]].join(\"\");\n}\n/** An operation written out in full in `migration.ts`, such as a table rename made by hand. */\nfunction rawSql(op) {\n\treturn op;\n}\n//#endregion\n//#region src/core/migrations/planner-target-details.ts\nfunction buildTargetDetails(objectType, name, table) {\n\treturn {\n\t\tobjectType,\n\t\tname,\n\t\t...ifDefined(\"table\", table)\n\t};\n}\n//#endregion\n//#region src/core/migrations/op-factory-call.ts\n/** The module every MySQL `migration.ts` imports its base class and helpers from. */\nconst MYSQL_MIGRATION_MODULE = \"@internal/mysql/migration\";\n/** The module call nodes name in their import requirements. `renderCallsToTypeScript` replaces it with the migration module of the target the scaffold is for. */\nconst MIGRATION_MODULE_PLACEHOLDER = MYSQL_MIGRATION_MODULE;\n/** The refusal of a `MysqlMigration` operation that needs the control adapter, on an instance built without a control stack. */\nfunction mysqlMigrationStackMissing(operation) {\n\treturn mysqlError(\"MIGRATION.MYSQL_CONTROL_STACK_MISSING\", `MysqlMigration.${operation} requires a control adapter`, {\n\t\twhy: `MysqlMigration.${operation} was invoked on an instance constructed without a ControlStack, so it cannot render its DDL.`,\n\t\tfix: \"Construct the migration via the migration CLI entrypoint, which assembles a ControlStack from prisma.config.ts, or pass a ControlStack with a MySQL adapter to the migration constructor in test fixtures.\",\n\t\tmeta: { operation }\n\t});\n}\nvar MysqlOpFactoryCallNode = class extends TsExpression {\n\timportRequirements() {\n\t\treturn [];\n\t}\n\tfreeze() {\n\t\tObject.freeze(this);\n\t}\n\tlowererFor(lowerer) {\n\t\tif (lowerer === void 0) throw mysqlMigrationStackMissing(this.factoryName);\n\t\treturn lowerer;\n\t}\n\ttargetIdFor(targetId) {\n\t\tif (targetId === void 0) throw new InternalError(`${this.factoryName}: an operation cannot be built without a target id; pass the id of the target the migration is for.`);\n\t\treturn targetId;\n\t}\n};\n/** Whether `call` is one of this target's calls. */\nfunction isMysqlOpFactoryCall(call) {\n\treturn call instanceof MysqlOpFactoryCallNode;\n}\nfunction renderColumnDefault(def, sql) {\n\treturn def.kind === \"literal\" ? `lit(${jsonToTsSource(def.value)})` : `fn(${sql.source(def.expression.text)})`;\n}\nfunction renderColumn(column, sql) {\n\tconst options = [\n\t\t...column.notNull ? [\"notNull: true\"] : [],\n\t\t...column.default === void 0 ? [] : [`default: ${renderColumnDefault(column.default, sql)}`],\n\t\t...column.codecRef === void 0 ? [] : [`codecRef: ${jsonToTsSource(column.codecRef)}`]\n\t];\n\tconst optionsSource = options.length > 0 ? `, { ${options.join(\", \")} }` : \"\";\n\treturn `col(${jsonToTsSource(column.name)}, ${jsonToTsSource(column.type)}${optionsSource})`;\n}\nfunction renderConstraint(constraint) {\n\tconst named = constraint.name === void 0 ? \"\" : `, { name: ${jsonToTsSource(constraint.name)} }`;\n\tswitch (constraint.kind) {\n\t\tcase \"primary-key\": return `primaryKey(${jsonToTsSource(constraint.columns)}${named})`;\n\t\tcase \"unique\": return `unique(${jsonToTsSource(constraint.columns)}${named})`;\n\t\tcase \"foreign-key\":\n\t\tcase \"check-expression\": throw mysqlError(\"CONTRACT.CONSTRAINT_INVALID\", `The MySQL createTable call writes primary keys and unique constraints only; add ${constraint.kind === \"foreign-key\" ? \"a foreign key with addForeignKey\" : \"no CHECK constraint\"} (constraint \"${constraint.name ?? \"\"}\").`, { meta: { constraintKind: constraint.kind } });\n\t}\n}\nfunction columnImports(columns) {\n\tconst symbols = new Set(columns.length > 0 ? [\"col\"] : []);\n\tfor (const column of columns) {\n\t\tif (column.default?.kind === \"literal\") symbols.add(\"lit\");\n\t\tif (column.default?.kind === \"function\") symbols.add(\"fn\");\n\t}\n\treturn [...symbols].map((symbol) => ({\n\t\tmoduleSpecifier: MIGRATION_MODULE_PLACEHOLDER,\n\t\tsymbol\n\t}));\n}\nvar CreateTableCall = class extends MysqlOpFactoryCallNode {\n\ttableName;\n\tfactoryName = \"createTable\";\n\toperationClass = \"additive\";\n\tlabel;\n\tcolumns;\n\tconstraints;\n\tconstructor(tableName, columns, constraints) {\n\t\tsuper();\n\t\tthis.tableName = tableName;\n\t\tthis.columns = Object.freeze([...columns]);\n\t\tthis.constraints = Object.freeze([...constraints]);\n\t\tthis.label = `Create table ${tableName}`;\n\t\tthis.freeze();\n\t}\n\tasync toOp(lowerer, targetId) {\n\t\tconst statement = await this.lowererFor(lowerer).lowerToExecuteRequest(createTable({\n\t\t\ttable: this.tableName,\n\t\t\tcolumns: this.columns,\n\t\t\tconstraints: this.constraints\n\t\t}));\n\t\tconst table = tableChecks(this.tableName);\n\t\treturn {\n\t\t\tid: `table.${this.tableName}`,\n\t\t\tlabel: this.label,\n\t\t\tsummary: `Creates table ${this.tableName} with its columns, primary key and unique constraints`,\n\t\t\toperationClass: \"additive\",\n\t\t\ttarget: {\n\t\t\t\tid: this.targetIdFor(targetId),\n\t\t\t\tdetails: buildTargetDetails(\"table\", this.tableName)\n\t\t\t},\n\t\t\tprecheck: [table.absent(`ensure table \"${this.tableName}\" does not exist`)],\n\t\t\texecute: [step(`create table \"${this.tableName}\"`, statement.sql, statement.params)],\n\t\t\tpostcheck: [table.present(`verify table \"${this.tableName}\" exists`)]\n\t\t};\n\t}\n\trenderTypeScript() {\n\t\treturn this.#written().source;\n\t}\n\timportRequirements() {\n\t\treturn this.#written().imports;\n\t}\n\t#written() {\n\t\tconst sql = createSqlTextSources(MIGRATION_MODULE_PLACEHOLDER);\n\t\tconst columns = this.columns.map((column) => renderColumn(column, sql)).join(\", \");\n\t\tconst constraints = this.constraints.map(renderConstraint);\n\t\tconst source = `this.createTable({ table: ${jsonToTsSource(this.tableName)}, columns: [${columns}]${constraints.length > 0 ? `, constraints: [${constraints.join(\", \")}]` : \"\"} })`;\n\t\tconst constraintImports = [...new Set(this.constraints.map((c) => c.kind === \"primary-key\" ? \"primaryKey\" : \"unique\"))].map((symbol) => ({\n\t\t\tmoduleSpecifier: MIGRATION_MODULE_PLACEHOLDER,\n\t\t\tsymbol\n\t\t}));\n\t\treturn {\n\t\t\tsource,\n\t\t\timports: [\n\t\t\t\t...columnImports(this.columns),\n\t\t\t\t...constraintImports,\n\t\t\t\t...sql.imports()\n\t\t\t]\n\t\t};\n\t}\n};\nvar DropTableCall = class extends MysqlOpFactoryCallNode {\n\ttableName;\n\tfactoryName = \"dropTable\";\n\toperationClass = \"destructive\";\n\tlabel;\n\tconstructor(tableName) {\n\t\tsuper();\n\t\tthis.tableName = tableName;\n\t\tthis.label = `Drop table ${tableName}`;\n\t\tthis.freeze();\n\t}\n\ttoOp(_lowerer, targetId) {\n\t\tconst table = tableChecks(this.tableName);\n\t\treturn {\n\t\t\tid: `dropTable.${this.tableName}`,\n\t\t\tlabel: this.label,\n\t\t\tsummary: `Drops table ${this.tableName} which is not in the contract`,\n\t\t\toperationClass: \"destructive\",\n\t\t\ttarget: {\n\t\t\t\tid: this.targetIdFor(targetId),\n\t\t\t\tdetails: buildTargetDetails(\"table\", this.tableName)\n\t\t\t},\n\t\t\tprecheck: [table.present(`ensure table \"${this.tableName}\" exists`)],\n\t\t\texecute: [step(`drop table \"${this.tableName}\"`, `DROP TABLE ${quoteIdentifier(this.tableName)}`)],\n\t\t\tpostcheck: [table.absent(`verify table \"${this.tableName}\" is gone`)]\n\t\t};\n\t}\n\trenderTypeScript() {\n\t\treturn `this.dropTable({ table: ${jsonToTsSource(this.tableName)} })`;\n\t}\n};\nvar AddColumnCall = class extends MysqlOpFactoryCallNode {\n\ttableName;\n\tcolumn;\n\tfactoryName = \"addColumn\";\n\toperationClass = \"additive\";\n\tlabel;\n\tcolumnName;\n\tconstructor(tableName, column) {\n\t\tsuper();\n\t\tthis.tableName = tableName;\n\t\tthis.column = column;\n\t\tthis.columnName = column.name;\n\t\tthis.label = `Add column ${column.name} on ${tableName}`;\n\t\tthis.freeze();\n\t}\n\tasync toOp(lowerer, targetId) {\n\t\tconst definition = await columnDefinitionSql(this.column, this.tableName, this.lowererFor(lowerer));\n\t\tconst column = columnChecks(this.tableName, this.columnName);\n\t\treturn {\n\t\t\tid: `column.${this.tableName}.${this.columnName}`,\n\t\t\tlabel: this.label,\n\t\t\tsummary: `Adds column ${this.columnName} to ${this.tableName}`,\n\t\t\toperationClass: \"additive\",\n\t\t\ttarget: {\n\t\t\t\tid: this.targetIdFor(targetId),\n\t\t\t\tdetails: buildTargetDetails(\"column\", this.columnName, this.tableName)\n\t\t\t},\n\t\t\tprecheck: [tableChecks(this.tableName).present(`ensure table \"${this.tableName}\" exists`), column.absent(`ensure column \"${this.columnName}\" is missing on \"${this.tableName}\"`)],\n\t\t\texecute: [step(`add column \"${this.columnName}\" to \"${this.tableName}\"`, `ALTER TABLE ${quoteIdentifier(this.tableName)} ADD COLUMN ${definition}`)],\n\t\t\tpostcheck: [column.present(`verify column \"${this.columnName}\" exists on \"${this.tableName}\"`)]\n\t\t};\n\t}\n\trenderTypeScript() {\n\t\treturn this.#written().source;\n\t}\n\timportRequirements() {\n\t\treturn this.#written().imports;\n\t}\n\t#written() {\n\t\tconst sql = createSqlTextSources(MIGRATION_MODULE_PLACEHOLDER);\n\t\treturn {\n\t\t\tsource: `this.addColumn({ table: ${jsonToTsSource(this.tableName)}, column: ${renderColumn(this.column, sql)} })`,\n\t\t\timports: [...columnImports([this.column]), ...sql.imports()]\n\t\t};\n\t}\n};\nvar DropColumnCall = class extends MysqlOpFactoryCallNode {\n\ttableName;\n\tcolumnName;\n\tfactoryName = \"dropColumn\";\n\toperationClass = \"destructive\";\n\tlabel;\n\tconstructor(tableName, columnName) {\n\t\tsuper();\n\t\tthis.tableName = tableName;\n\t\tthis.columnName = columnName;\n\t\tthis.label = `Drop column ${columnName} on ${tableName}`;\n\t\tthis.freeze();\n\t}\n\ttoOp(_lowerer, targetId) {\n\t\tconst column = columnChecks(this.tableName, this.columnName);\n\t\treturn {\n\t\t\tid: `dropColumn.${this.tableName}.${this.columnName}`,\n\t\t\tlabel: this.label,\n\t\t\tsummary: `Drops column ${this.columnName} on ${this.tableName} which is not in the contract`,\n\t\t\toperationClass: \"destructive\",\n\t\t\ttarget: {\n\t\t\t\tid: this.targetIdFor(targetId),\n\t\t\t\tdetails: buildTargetDetails(\"column\", this.columnName, this.tableName)\n\t\t\t},\n\t\t\tprecheck: [column.present(`ensure column \"${this.columnName}\" exists on \"${this.tableName}\"`)],\n\t\t\texecute: [step(`drop column \"${this.columnName}\" from \"${this.tableName}\"`, `ALTER TABLE ${quoteIdentifier(this.tableName)} DROP COLUMN ${quoteIdentifier(this.columnName)}`)],\n\t\t\tpostcheck: [column.absent(`verify column \"${this.columnName}\" is gone from \"${this.tableName}\"`)]\n\t\t};\n\t}\n\trenderTypeScript() {\n\t\treturn `this.dropColumn({ table: ${jsonToTsSource(this.tableName)}, column: ${jsonToTsSource(this.columnName)} })`;\n\t}\n};\nvar CreateIndexCall = class extends MysqlOpFactoryCallNode {\n\ttableName;\n\tindexName;\n\tcolumns;\n\tunique;\n\tfactoryName = \"createIndex\";\n\toperationClass = \"additive\";\n\tlabel;\n\tconstructor(tableName, indexName, columns, unique) {\n\t\tsuper();\n\t\tthis.tableName = tableName;\n\t\tthis.indexName = indexName;\n\t\tthis.columns = columns;\n\t\tthis.unique = unique;\n\t\tthis.label = `Create ${unique ? \"unique \" : \"\"}index ${indexName} on ${tableName}`;\n\t\tthis.freeze();\n\t}\n\ttoOp(_lowerer, targetId) {\n\t\tconst index = indexChecks(this.tableName, this.indexName);\n\t\treturn {\n\t\t\tid: `index.${this.tableName}.${this.indexName}`,\n\t\t\tlabel: this.label,\n\t\t\tsummary: `Creates ${this.unique ? \"unique \" : \"\"}index ${this.indexName} on ${this.tableName}`,\n\t\t\toperationClass: \"additive\",\n\t\t\ttarget: {\n\t\t\t\tid: this.targetIdFor(targetId),\n\t\t\t\tdetails: buildTargetDetails(\"index\", this.indexName, this.tableName)\n\t\t\t},\n\t\t\tprecheck: [index.absent(`ensure index \"${this.indexName}\" is missing`)],\n\t\t\texecute: [step(`create index \"${this.indexName}\"`, `CREATE ${this.unique ? \"UNIQUE \" : \"\"}INDEX ${quoteIdentifier(this.indexName)} ON ${quoteIdentifier(this.tableName)} (${columnList(this.columns)})`)],\n\t\t\tpostcheck: [index.present(`verify index \"${this.indexName}\" exists`)]\n\t\t};\n\t}\n\trenderTypeScript() {\n\t\treturn `this.createIndex({ table: ${jsonToTsSource(this.tableName)}, index: ${jsonToTsSource(this.indexName)}, columns: ${jsonToTsSource(this.columns)}${this.unique ? \", unique: true\" : \"\"} })`;\n\t}\n};\nvar DropIndexCall = class extends MysqlOpFactoryCallNode {\n\ttableName;\n\tindexName;\n\tfactoryName = \"dropIndex\";\n\toperationClass = \"widening\";\n\tlabel;\n\tconstructor(tableName, indexName) {\n\t\tsuper();\n\t\tthis.tableName = tableName;\n\t\tthis.indexName = indexName;\n\t\tthis.label = `Drop index ${indexName} on ${tableName}`;\n\t\tthis.freeze();\n\t}\n\ttoOp(_lowerer, targetId) {\n\t\tconst index = indexChecks(this.tableName, this.indexName);\n\t\treturn {\n\t\t\tid: `dropIndex.${this.tableName}.${this.indexName}`,\n\t\t\tlabel: this.label,\n\t\t\tsummary: `Drops index ${this.indexName} on ${this.tableName} which is not in the contract`,\n\t\t\toperationClass: \"widening\",\n\t\t\ttarget: {\n\t\t\t\tid: this.targetIdFor(targetId),\n\t\t\t\tdetails: buildTargetDetails(\"index\", this.indexName, this.tableName)\n\t\t\t},\n\t\t\tprecheck: [index.present(`ensure index \"${this.indexName}\" exists`)],\n\t\t\texecute: [step(`drop index \"${this.indexName}\"`, `DROP INDEX ${quoteIdentifier(this.indexName)} ON ${quoteIdentifier(this.tableName)}`)],\n\t\t\tpostcheck: [index.absent(`verify index \"${this.indexName}\" is gone`)]\n\t\t};\n\t}\n\trenderTypeScript() {\n\t\treturn `this.dropIndex({ table: ${jsonToTsSource(this.tableName)}, index: ${jsonToTsSource(this.indexName)} })`;\n\t}\n};\nvar AddUniqueCall = class extends MysqlOpFactoryCallNode {\n\ttableName;\n\tconstraintName;\n\tcolumns;\n\tfactoryName = \"addUnique\";\n\toperationClass = \"additive\";\n\tlabel;\n\tconstructor(tableName, constraintName, columns) {\n\t\tsuper();\n\t\tthis.tableName = tableName;\n\t\tthis.constraintName = constraintName;\n\t\tthis.columns = columns;\n\t\tthis.label = `Add unique constraint ${constraintName} on ${tableName}`;\n\t\tthis.freeze();\n\t}\n\ttoOp(_lowerer, targetId) {\n\t\tconst constraint = constraintChecks(this.tableName, this.constraintName, \"UNIQUE\");\n\t\treturn {\n\t\t\tid: `unique.${this.tableName}.${this.constraintName}`,\n\t\t\tlabel: this.label,\n\t\t\tsummary: `Adds unique constraint ${this.constraintName} on ${this.tableName}`,\n\t\t\toperationClass: \"additive\",\n\t\t\ttarget: {\n\t\t\t\tid: this.targetIdFor(targetId),\n\t\t\t\tdetails: buildTargetDetails(\"unique\", this.constraintName, this.tableName)\n\t\t\t},\n\t\t\tprecheck: [constraint.absent(`ensure unique constraint \"${this.constraintName}\" is missing`)],\n\t\t\texecute: [step(`add unique constraint \"${this.constraintName}\"`, `ALTER TABLE ${quoteIdentifier(this.tableName)} ADD CONSTRAINT ${quoteIdentifier(this.constraintName)} UNIQUE (${columnList(this.columns)})`)],\n\t\t\tpostcheck: [constraint.present(`verify unique constraint \"${this.constraintName}\" exists`)]\n\t\t};\n\t}\n\trenderTypeScript() {\n\t\treturn `this.addUnique({ table: ${jsonToTsSource(this.tableName)}, name: ${jsonToTsSource(this.constraintName)}, columns: ${jsonToTsSource(this.columns)} })`;\n\t}\n};\nvar DropUniqueCall = class extends MysqlOpFactoryCallNode {\n\ttableName;\n\tconstraintName;\n\tfactoryName = \"dropUnique\";\n\toperationClass = \"widening\";\n\tlabel;\n\tconstructor(tableName, constraintName) {\n\t\tsuper();\n\t\tthis.tableName = tableName;\n\t\tthis.constraintName = constraintName;\n\t\tthis.label = `Drop unique constraint ${constraintName} on ${tableName}`;\n\t\tthis.freeze();\n\t}\n\ttoOp(_lowerer, targetId) {\n\t\tconst constraint = constraintChecks(this.tableName, this.constraintName, \"UNIQUE\");\n\t\treturn {\n\t\t\tid: `dropUnique.${this.tableName}.${this.constraintName}`,\n\t\t\tlabel: this.label,\n\t\t\tsummary: `Drops unique constraint ${this.constraintName} on ${this.tableName} which is not in the contract`,\n\t\t\toperationClass: \"widening\",\n\t\t\ttarget: {\n\t\t\t\tid: this.targetIdFor(targetId),\n\t\t\t\tdetails: buildTargetDetails(\"unique\", this.constraintName, this.tableName)\n\t\t\t},\n\t\t\tprecheck: [constraint.present(`ensure unique constraint \"${this.constraintName}\" exists`)],\n\t\t\texecute: [step(`drop unique constraint \"${this.constraintName}\"`, `ALTER TABLE ${quoteIdentifier(this.tableName)} DROP INDEX ${quoteIdentifier(this.constraintName)}`)],\n\t\t\tpostcheck: [constraint.absent(`verify unique constraint \"${this.constraintName}\" is gone`)]\n\t\t};\n\t}\n\trenderTypeScript() {\n\t\treturn `this.dropUnique({ table: ${jsonToTsSource(this.tableName)}, name: ${jsonToTsSource(this.constraintName)} })`;\n\t}\n};\nvar AddForeignKeyCall = class extends MysqlOpFactoryCallNode {\n\ttableName;\n\tforeignKey;\n\tfactoryName = \"addForeignKey\";\n\toperationClass = \"additive\";\n\tlabel;\n\tconstructor(tableName, foreignKey) {\n\t\tsuper();\n\t\tthis.tableName = tableName;\n\t\tthis.foreignKey = foreignKey;\n\t\tthis.label = `Add foreign key ${foreignKey.name} on ${tableName}`;\n\t\tthis.freeze();\n\t}\n\ttoOp(_lowerer, targetId) {\n\t\tconst { name, columns, references } = this.foreignKey;\n\t\tconst constraint = constraintChecks(this.tableName, name, \"FOREIGN KEY\");\n\t\treturn {\n\t\t\tid: `foreignKey.${this.tableName}.${name}`,\n\t\t\tlabel: this.label,\n\t\t\tsummary: `Adds foreign key ${name} on ${this.tableName} referencing ${references.table}`,\n\t\t\toperationClass: \"additive\",\n\t\t\ttarget: {\n\t\t\t\tid: this.targetIdFor(targetId),\n\t\t\t\tdetails: buildTargetDetails(\"foreignKey\", name, this.tableName)\n\t\t\t},\n\t\t\tprecheck: [constraint.absent(`ensure foreign key \"${name}\" is missing`)],\n\t\t\texecute: [step(`add foreign key \"${name}\"`, `ALTER TABLE ${quoteIdentifier(this.tableName)} ADD CONSTRAINT ${quoteIdentifier(name)} FOREIGN KEY (${columnList(columns)}) REFERENCES ${quoteIdentifier(references.table)} (${columnList(references.columns)})${foreignKeyActionsSql(this.foreignKey)}`)],\n\t\t\tpostcheck: [constraint.present(`verify foreign key \"${name}\" exists`)]\n\t\t};\n\t}\n\trenderTypeScript() {\n\t\tconst { name, columns, references, onDelete, onUpdate } = this.foreignKey;\n\t\treturn `this.addForeignKey({ ${[\n\t\t\t`table: ${jsonToTsSource(this.tableName)}`,\n\t\t\t`name: ${jsonToTsSource(name)}`,\n\t\t\t`columns: ${jsonToTsSource(columns)}`,\n\t\t\t`references: ${jsonToTsSource(references)}`,\n\t\t\t...onDelete === void 0 ? [] : [`onDelete: ${jsonToTsSource(onDelete)}`],\n\t\t\t...onUpdate === void 0 ? [] : [`onUpdate: ${jsonToTsSource(onUpdate)}`]\n\t\t].join(\", \")} })`;\n\t}\n};\nvar DropForeignKeyCall = class extends MysqlOpFactoryCallNode {\n\ttableName;\n\tconstraintName;\n\tfactoryName = \"dropForeignKey\";\n\toperationClass = \"widening\";\n\tlabel;\n\tconstructor(tableName, constraintName) {\n\t\tsuper();\n\t\tthis.tableName = tableName;\n\t\tthis.constraintName = constraintName;\n\t\tthis.label = `Drop foreign key ${constraintName} on ${tableName}`;\n\t\tthis.freeze();\n\t}\n\ttoOp(_lowerer, targetId) {\n\t\tconst constraint = constraintChecks(this.tableName, this.constraintName, \"FOREIGN KEY\");\n\t\treturn {\n\t\t\tid: `dropForeignKey.${this.tableName}.${this.constraintName}`,\n\t\t\tlabel: this.label,\n\t\t\tsummary: `Drops foreign key ${this.constraintName} on ${this.tableName} which is not in the contract`,\n\t\t\toperationClass: \"widening\",\n\t\t\ttarget: {\n\t\t\t\tid: this.targetIdFor(targetId),\n\t\t\t\tdetails: buildTargetDetails(\"foreignKey\", this.constraintName, this.tableName)\n\t\t\t},\n\t\t\tprecheck: [constraint.present(`ensure foreign key \"${this.constraintName}\" exists`)],\n\t\t\texecute: [step(`drop foreign key \"${this.constraintName}\"`, `ALTER TABLE ${quoteIdentifier(this.tableName)} DROP FOREIGN KEY ${quoteIdentifier(this.constraintName)}`)],\n\t\t\tpostcheck: [constraint.absent(`verify foreign key \"${this.constraintName}\" is gone`)]\n\t\t};\n\t}\n\trenderTypeScript() {\n\t\treturn `this.dropForeignKey({ table: ${jsonToTsSource(this.tableName)}, name: ${jsonToTsSource(this.constraintName)} })`;\n\t}\n};\n/** An operation built elsewhere, such as the table rename a user writes by hand, carried as it is and written as `rawSql({...})`. */\nvar RawSqlCall = class extends MysqlOpFactoryCallNode {\n\top;\n\tfactoryName = \"rawSql\";\n\toperationClass;\n\tlabel;\n\tconstructor(op) {\n\t\tsuper();\n\t\tthis.op = op;\n\t\tthis.label = op.label;\n\t\tthis.operationClass = op.operationClass;\n\t\tthis.freeze();\n\t}\n\ttoOp() {\n\t\treturn this.op;\n\t}\n\trenderTypeScript() {\n\t\treturn `rawSql(${jsonToTsSource(this.op)})`;\n\t}\n\timportRequirements() {\n\t\treturn [{\n\t\t\tmoduleSpecifier: MIGRATION_MODULE_PLACEHOLDER,\n\t\t\tsymbol: \"rawSql\"\n\t\t}];\n\t}\n};\n/** The table rename a user writes by hand on MySQL, which the planner does not plan yet. */\nfunction renameTableByHandOp(from, to, targetId) {\n\tconst fromTable = tableChecks(from);\n\tconst toTable = tableChecks(to);\n\treturn {\n\t\tid: `renameTable.${from}`,\n\t\tlabel: `Rename table ${from} to ${to}`,\n\t\toperationClass: \"widening\",\n\t\ttarget: {\n\t\t\tid: targetId,\n\t\t\tdetails: buildTargetDetails(\"table\", to)\n\t\t},\n\t\tprecheck: [fromTable.present(`ensure table \"${from}\" exists`), toTable.absent(`ensure table \"${to}\" does not exist`)],\n\t\texecute: [step(`rename table \"${from}\" to \"${to}\"`, `RENAME TABLE ${quoteIdentifier(from)} TO ${quoteIdentifier(to)}`)],\n\t\tpostcheck: [toTable.present(`verify table \"${to}\" exists`), fromTable.absent(`verify table \"${from}\" no longer exists`)]\n\t};\n}\nfunction foreignKeySpecOf(fk, table) {\n\treturn {\n\t\tname: fk.name ?? `${table}_${fk.columns.join(\"_\")}_fkey`,\n\t\tcolumns: fk.columns,\n\t\treferences: {\n\t\t\ttable: fk.referencedTable,\n\t\t\tcolumns: fk.referencedColumns\n\t\t},\n\t\t...ifDefined(\"onDelete\", fk.onDelete),\n\t\t...ifDefined(\"onUpdate\", fk.onUpdate)\n\t};\n}\n//#endregion\n//#region src/core/migrations/column-ddl.ts\n/** The type DDL writes for a column node: the type it is stored as, with the parameters the contract writes, as MySQL reports it in `COLUMN_TYPE`. */\nfunction columnTypeSql(column) {\n\tconst type = column.storedType;\n\tif (type === void 0 || !isSqlDataType(type)) throw new InternalError(`column \"${column.name}\" has no data type; the expected tree must be derived via contractToSchemaIR for planning`);\n\treturn renderSqlTypeName(type, dataTypeParams(type, column.codecRef?.typeParams));\n}\nfunction ddlDefaultOf(columnDefault) {\n\tif (columnDefault === void 0) return void 0;\n\treturn columnDefault.kind === \"literal\" ? new LiteralColumnDefault(columnDefault.value) : new FunctionColumnDefault(opaqueSql(columnDefault.expression));\n}\n/** The default a column node's DDL writes: the one the contract authored, which `resolvedDefault` normalises for the diff. */\nfunction columnDefaultOf(column) {\n\treturn column.authoredDefault ?? column.resolvedDefault;\n}\n/** The `DdlColumn` of a column node. An `autoincrement()` default stays a function default, which the adapter writes as `AUTO_INCREMENT`. */\nfunction ddlColumnFromNode(column) {\n\tconst columnDefault = ddlDefaultOf(columnDefaultOf(column));\n\treturn new DdlColumn({\n\t\tname: column.name,\n\t\ttype: columnTypeSql(column),\n\t\t...column.nullable ? {} : { notNull: true },\n\t\t...columnDefault === void 0 ? {} : { default: columnDefault },\n\t\t...column.codecRef === void 0 ? {} : { codecRef: column.codecRef }\n\t});\n}\n/** The name a unique constraint is created and dropped by; MySQL names an unnamed one after its first column, which the contract never leaves to it. */\nfunction uniqueName(table, unique) {\n\treturn unique.name ?? `${table}_${unique.columns.join(\"_\")}_key`;\n}\n/** The constraints `CREATE TABLE` writes for a table node: its primary key and unique constraints. Foreign keys are added after every table exists, so tables can reference each other. */\nfunction tableConstraintsFromNode(table) {\n\treturn [...table.primaryKey === void 0 ? [] : [new PrimaryKeyConstraint({ columns: table.primaryKey.columns })], ...table.uniques.map((unique) => new UniqueConstraint({\n\t\tcolumns: unique.columns,\n\t\tname: uniqueName(table.name, unique)\n\t}))];\n}\n//#endregion\n//#region src/core/migrations/issue-planner.ts\n/**\n* Drops each issue under a missing or extra node: the call for a table or column accounts for everything beneath it.\n*/\nfunction coalesceSubtreeIssues(issues) {\n\tconst collapsing = issues.filter((issue) => {\n\t\tconst outcome = issueOutcome(issue);\n\t\treturn outcome === \"not-found\" || outcome === \"not-expected\";\n\t}).map((issue) => issue.path);\n\treturn issues.filter((issue) => !collapsing.some((ancestor) => issue.path.length > ancestor.length && ancestor.every((segment, index) => issue.path[index] === segment)));\n}\nfunction issueNode(issue) {\n\tconst node = issue.expected ?? issue.actual;\n\treturn node === void 0 ? void 0 : blindCast(node);\n}\nfunction expectedNode(issue) {\n\treturn blindCast(issue.expected);\n}\nfunction actualNode(issue) {\n\treturn blindCast(issue.actual);\n}\nfunction location(table, column) {\n\treturn {\n\t\tentityKind: \"table\",\n\t\t...table === void 0 ? {} : { entityName: table },\n\t\t...column === void 0 ? {} : { column }\n\t};\n}\nfunction placeOf(issue, at) {\n\tif (at?.entityName === void 0) return issue.path.slice(1).join(\".\");\n\treturn at.column === void 0 ? at.entityName : `${at.entityName}.${at.column}`;\n}\n/** The conflict for a change the MySQL planner does not plan yet. */\nfunction notYetSupported(kind, change, issue, conflictLocation) {\n\treturn {\n\t\tkind,\n\t\tsummary: `${change} is not yet supported by the migration planner (${placeOf(issue, conflictLocation)})`,\n\t\twhy: \"The migration planner creates and drops tables, columns, indexes, unique constraints and foreign keys; it does not change a column, a default, a primary key or a CHECK constraint yet. Use `migration new` to write this change by hand.\",\n\t\t...conflictLocation === void 0 ? {} : { location: conflictLocation }\n\t};\n}\nfunction createTableCalls(table) {\n\treturn [\n\t\tnew CreateTableCall(table.name, Object.values(table.columns).map(ddlColumnFromNode), tableConstraintsFromNode(table)),\n\t\t...table.indexes.flatMap((index) => index.columns === void 0 ? [] : [new CreateIndexCall(table.name, index.name, index.columns, index.unique)]),\n\t\t...table.foreignKeys.map((fk) => new AddForeignKeyCall(table.name, foreignKeySpecOf(fk, table.name)))\n\t];\n}\nfunction mapTableIssue(issue) {\n\tswitch (issueOutcome(issue)) {\n\t\tcase \"not-found\": {\n\t\t\tconst table = expectedNode(issue);\n\t\t\treturn table.indexes.find((index) => index.columns === void 0) === void 0 ? ok(createTableCalls(table)) : notOk(notYetSupported(\"indexIncompatible\", \"An expression index\", issue, location(table.name)));\n\t\t}\n\t\tcase \"not-expected\": {\n\t\t\tconst table = actualNode(issue);\n\t\t\treturn ok(CONTROL_TABLE_NAMES.has(table.name) ? [] : [new DropTableCall(table.name)]);\n\t\t}\n\t\tdefault: return notOk(notYetSupported(\"unsupportedOperation\", \"Changing a table\", issue));\n\t}\n}\nfunction mapColumnIssue(issue, table) {\n\tswitch (issueOutcome(issue)) {\n\t\tcase \"not-found\": {\n\t\t\tconst column = expectedNode(issue);\n\t\t\tconst columnDefault = columnDefaultOf(column);\n\t\t\treturn column.nullable || columnDefault !== void 0 && !(columnDefault.kind === \"function\" && columnDefault.expression === \"autoincrement()\") ? ok([new AddColumnCall(table, ddlColumnFromNode(column))]) : notOk(notYetSupported(\"nullabilityConflict\", \"Adding a required column without a default\", issue, location(table, column.name)));\n\t\t}\n\t\tcase \"not-expected\": return ok([new DropColumnCall(table, actualNode(issue).name)]);\n\t\tdefault: {\n\t\t\tconst expected = expectedNode(issue);\n\t\t\tconst typesEqual = sqlColumnTypesEqual(expected, actualNode(issue));\n\t\t\treturn notOk(notYetSupported(typesEqual ? \"nullabilityConflict\" : \"typeMismatch\", typesEqual ? \"Changing a column's nullability\" : \"Changing a column's type\", issue, location(table, expected.name)));\n\t\t}\n\t}\n}\nfunction mapIndexIssue(issue, table) {\n\tswitch (issueOutcome(issue)) {\n\t\tcase \"not-found\": {\n\t\t\tconst index = expectedNode(issue);\n\t\t\treturn index.columns === void 0 ? notOk(notYetSupported(\"indexIncompatible\", \"An expression index\", issue, location(table))) : ok([new CreateIndexCall(table, index.name, index.columns, index.unique)]);\n\t\t}\n\t\tcase \"not-expected\": return ok([new DropIndexCall(table, actualNode(issue).name)]);\n\t\tdefault: return notOk(notYetSupported(\"indexIncompatible\", \"Changing an index\", issue, location(table)));\n\t}\n}\nfunction mapUniqueIssue(issue, table) {\n\tswitch (issueOutcome(issue)) {\n\t\tcase \"not-found\": {\n\t\t\tconst unique = expectedNode(issue);\n\t\t\treturn ok([new AddUniqueCall(table, uniqueName(table, unique), unique.columns)]);\n\t\t}\n\t\tcase \"not-expected\": return ok([new DropUniqueCall(table, uniqueName(table, actualNode(issue)))]);\n\t\tdefault: return notOk(notYetSupported(\"indexIncompatible\", \"Changing a unique constraint\", issue, location(table)));\n\t}\n}\nfunction mapForeignKeyIssue(issue, table) {\n\tswitch (issueOutcome(issue)) {\n\t\tcase \"not-found\": return ok([new AddForeignKeyCall(table, foreignKeySpecOf(expectedNode(issue), table))]);\n\t\tcase \"not-expected\": return ok([new DropForeignKeyCall(table, foreignKeySpecOf(actualNode(issue), table).name)]);\n\t\tdefault: return notOk(notYetSupported(\"foreignKeyConflict\", \"Changing a foreign key\", issue, location(table)));\n\t}\n}\nfunction mapIssueToCalls(issue) {\n\tconst node = issueNode(issue);\n\tconst table = issue.path[1];\n\tif (node === void 0) return notOk(notYetSupported(\"unsupportedOperation\", \"A change with no node\", issue));\n\tif (node.nodeKind === RelationalSchemaNodeKind.table) return mapTableIssue(issue);\n\tif (table === void 0) return notOk(notYetSupported(\"unsupportedOperation\", `A ${node.nodeKind} change`, issue));\n\tswitch (node.nodeKind) {\n\t\tcase RelationalSchemaNodeKind.column: return mapColumnIssue(issue, table);\n\t\tcase RelationalSchemaNodeKind.index: return mapIndexIssue(issue, table);\n\t\tcase RelationalSchemaNodeKind.unique: return mapUniqueIssue(issue, table);\n\t\tcase RelationalSchemaNodeKind.foreignKey: return mapForeignKeyIssue(issue, table);\n\t\tcase RelationalSchemaNodeKind.columnDefault: return notOk(notYetSupported(\"unsupportedOperation\", \"Changing a column's default\", issue, location(table)));\n\t\tcase RelationalSchemaNodeKind.primaryKey: return notOk(notYetSupported(\"indexIncompatible\", \"Changing a primary key\", issue, location(table)));\n\t\tcase RelationalSchemaNodeKind.check: return notOk(notYetSupported(\"unsupportedOperation\", \"A CHECK constraint\", issue, location(table)));\n\t\tdefault: return notOk(notYetSupported(\"unsupportedOperation\", `A ${node.nodeKind} change`, issue));\n\t}\n}\n/**\n* The order calls run in: foreign keys are dropped before the tables, columns and indexes they use, and added after every table, column and index they need exists. The index InnoDB made for a dropped key is dropped right after the key, before any key is added, so a new key on the same columns makes its own.\n*/\nconst CALL_ORDER = [\n\t\"dropForeignKey\",\n\t\"createTable\",\n\t\"addColumn\",\n\t\"addUnique\",\n\t\"createIndex\",\n\t\"addForeignKey\",\n\t\"dropUnique\",\n\t\"dropIndex\",\n\t\"dropColumn\",\n\t\"dropTable\",\n\t\"rawSql\"\n];\nfunction locationOfCall(call) {\n\treturn \"tableName\" in call ? {\n\t\tentityKind: \"table\",\n\t\tentityName: call.tableName,\n\t\t...\"columnName\" in call ? { column: call.columnName } : {},\n\t\t...\"indexName\" in call ? { index: call.indexName } : {}\n\t} : void 0;\n}\nfunction conflictForDisallowedCall(call, allowed) {\n\tconst callLocation = locationOfCall(call);\n\treturn {\n\t\tkind: call instanceof CreateIndexCall || call instanceof DropIndexCall ? \"indexIncompatible\" : \"missingButNonAdditive\",\n\t\tsummary: `Operation \"${call.label}\" requires class \"${call.operationClass}\", but policy allows only: ${allowed.join(\", \")}`,\n\t\twhy: \"Use `migration new` to author a custom migration for this change.\",\n\t\trefusedOperationClass: call.operationClass,\n\t\t...callLocation === void 0 ? {} : { location: callLocation }\n\t};\n}\nconst MAX_IDENTIFIER_CHARACTERS = 64;\n/** The names a call gives new objects, each with where the conflict that refuses it points. */\nfunction namesGiven(call) {\n\tif (call instanceof CreateTableCall) return [\n\t\t{\n\t\t\tname: call.tableName,\n\t\t\tat: location(call.tableName)\n\t\t},\n\t\t...call.columns.map((column) => ({\n\t\t\tname: column.name,\n\t\t\tat: location(call.tableName, column.name)\n\t\t})),\n\t\t...call.constraints.flatMap((constraint) => constraint.name === void 0 ? [] : [{\n\t\t\tname: constraint.name,\n\t\t\tat: {\n\t\t\t\t...location(call.tableName),\n\t\t\t\tconstraint: constraint.name\n\t\t\t}\n\t\t}])\n\t];\n\tif (call instanceof AddColumnCall) return [{\n\t\tname: call.column.name,\n\t\tat: location(call.tableName, call.column.name)\n\t}];\n\tif (call instanceof CreateIndexCall) return [{\n\t\tname: call.indexName,\n\t\tat: {\n\t\t\t...location(call.tableName),\n\t\t\tindex: call.indexName\n\t\t}\n\t}];\n\tif (call instanceof AddUniqueCall) return [{\n\t\tname: call.constraintName,\n\t\tat: {\n\t\t\t...location(call.tableName),\n\t\t\tconstraint: call.constraintName\n\t\t}\n\t}];\n\tif (call instanceof AddForeignKeyCall) return [{\n\t\tname: call.foreignKey.name,\n\t\tat: {\n\t\t\t...location(call.tableName),\n\t\t\tconstraint: call.foreignKey.name\n\t\t}\n\t}];\n\treturn [];\n}\nfunction placeText(at) {\n\treturn at.column === void 0 ? `${at.entityName}` : `${at.entityName}.${at.column}`;\n}\n/** MySQL refuses a name longer than 64 characters only when the statement runs, after the statements before it committed, so the planner refuses it first. */\nfunction longNameConflicts(call) {\n\treturn namesGiven(call).filter(({ name }) => Array.from(name).length > MAX_IDENTIFIER_CHARACTERS).map(({ name, at }) => ({\n\t\tkind: \"unsupportedOperation\",\n\t\tsummary: `The name ${name} is longer than the ${MAX_IDENTIFIER_CHARACTERS} characters the database allows (${placeText(at)})`,\n\t\twhy: `The database refuses a table, column, index or constraint name longer than ${MAX_IDENTIFIER_CHARACTERS} characters. Give it a shorter name in the contract.`,\n\t\tlocation: at\n\t}));\n}\nfunction isAutoincrement(column) {\n\treturn column.default?.kind === \"function\" && column.default.expression.text === \"autoincrement()\";\n}\n/** MySQL refuses a table whose `AUTO_INCREMENT` column does not lead a key, so the planner refuses it first. */\nfunction autoincrementKeyConflicts(call) {\n\tif (!(call instanceof CreateTableCall)) return [];\n\tconst keyLeaders = new Set(call.constraints.flatMap((constraint) => constraint.kind === \"primary-key\" || constraint.kind === \"unique\" ? constraint.columns.slice(0, 1) : []));\n\treturn call.columns.filter((column) => isAutoincrement(column) && !column.primaryKey && !keyLeaders.has(column.name)).map((column) => ({\n\t\tkind: \"unsupportedOperation\",\n\t\tsummary: `An autoincrement column that is not the first column of the primary key or a unique constraint is not supported by the database (${call.tableName}.${column.name})`,\n\t\twhy: \"The database requires an AUTO_INCREMENT column to be the first column of a key, and refuses the table otherwise.\",\n\t\tlocation: location(call.tableName, column.name)\n\t}));\n}\n/** Whether an index on `indexColumns` can serve a foreign key on `keyColumns`: InnoDB needs the key's columns first, in order. */\nfunction servesKey(indexColumns, keyColumns) {\n\treturn keyColumns.length <= indexColumns.length && keyColumns.every((column, position) => indexColumns[position] === column);\n}\nfunction indexColumnLists(table, leaving) {\n\treturn [\n\t\t...table.primaryKey === void 0 ? [] : [table.primaryKey.columns],\n\t\t...table.uniques.flatMap((unique) => uniqueName(table.name, unique) === leaving ? [] : [unique.columns]),\n\t\t...table.indexes.flatMap((index) => index.name === leaving || index.columns === void 0 ? [] : [index.columns])\n\t];\n}\nfunction isKeyServed(table, keyColumns, leaving) {\n\treturn indexColumnLists(table, leaving).some((columns) => servesKey(columns, keyColumns));\n}\n/**\n* When a foreign key is dropped and no other index served it, InnoDB made an index of its own, with the key's name, and keeps it after the key is gone. Introspection leaves that index out while the key exists, so it is dropped with the key unless the destination keeps an index of that name.\n*/\nfunction innoDbIndexDrops(calls, expected, actual) {\n\treturn calls.flatMap((call) => {\n\t\tif (!(call instanceof DropForeignKeyCall)) return [];\n\t\tconst before = actual.tables[call.tableName];\n\t\tconst after = expected.tables[call.tableName];\n\t\tconst key = before?.foreignKeys.find((fk) => foreignKeySpecOf(fk, call.tableName).name === call.constraintName);\n\t\tif (before === void 0 || after === void 0 || key === void 0) return [];\n\t\tif (isKeyServed(before, key.columns)) return [];\n\t\tif (after.indexes.some((index) => index.name === call.constraintName)) return [];\n\t\treturn [{\n\t\t\tcall: new DropIndexCall(call.tableName, call.constraintName),\n\t\t\tindexName: call.constraintName,\n\t\t\tcolumns: key.columns\n\t\t}];\n\t});\n}\nfunction droppedIndexes(calls, actual) {\n\treturn calls.flatMap((call) => {\n\t\tconst table = \"tableName\" in call ? actual.tables[call.tableName] : void 0;\n\t\tif (table === void 0) return [];\n\t\tif (call instanceof DropIndexCall) {\n\t\t\tconst index = table.indexes.find(({ name }) => name === call.indexName);\n\t\t\treturn index?.columns === void 0 ? [] : [{\n\t\t\t\tcall,\n\t\t\t\tindexName: call.indexName,\n\t\t\t\tcolumns: index.columns\n\t\t\t}];\n\t\t}\n\t\tif (call instanceof DropUniqueCall) {\n\t\t\tconst unique = table.uniques.find((candidate) => uniqueName(table.name, candidate) === call.constraintName);\n\t\t\treturn unique === void 0 ? [] : [{\n\t\t\t\tcall,\n\t\t\t\tindexName: call.constraintName,\n\t\t\t\tcolumns: unique.columns\n\t\t\t}];\n\t\t}\n\t\treturn [];\n\t});\n}\n/**\n* A dropped index that one of `protectedKeys` uses, when no index the destination keeps can take over: MySQL refuses that drop.\n*/\nfunction conflictForIndexAKeyUses(dropped, expected, protectedKeys) {\n\tconst tableName = dropped.call.tableName;\n\tconst table = expected.tables[tableName];\n\tconst key = table?.foreignKeys.find((fk) => protectedKeys(tableName, fk) && servesKey(dropped.columns, fk.columns) && !isKeyServed(table, fk.columns, dropped.indexName));\n\tif (key === void 0) return void 0;\n\treturn {\n\t\tkind: \"indexIncompatible\",\n\t\tsummary: `Dropping index ${dropped.indexName}, which foreign key ${foreignKeySpecOf(key, tableName).name} uses, is not yet supported by the migration planner (${tableName})`,\n\t\twhy: \"The database refuses to drop an index a foreign key uses. Keep an index whose first columns are the foreign key's columns, or use `migration new` to drop the foreign key, drop the index and add the foreign key again.\",\n\t\tlocation: {\n\t\t\tentityKind: \"table\",\n\t\t\tentityName: tableName,\n\t\t\tindex: dropped.indexName\n\t\t}\n\t};\n}\n/** The calls that turn `actual` into `expected` for `issues`, in the order they run, or the conflicts that stop the plan. */\nfunction planIssues(input) {\n\tconst calls = [];\n\tconst conflicts = [];\n\tconst allowed = input.policy.allowedOperationClasses;\n\tfor (const issue of orderIssuesByDependencies(input.issues)) {\n\t\tconst mapped = mapIssueToCalls(issue);\n\t\tif (!mapped.ok) {\n\t\t\tconflicts.push(mapped.failure);\n\t\t\tcontinue;\n\t\t}\n\t\tfor (const call of mapped.value) {\n\t\t\tconflicts.push(...longNameConflicts(call), ...autoincrementKeyConflicts(call));\n\t\t\tif (allowed.includes(call.operationClass)) calls.push(call);\n\t\t\telse conflicts.push(conflictForDisallowedCall(call, allowed));\n\t\t}\n\t}\n\tconst droppedKeys = new Set(calls.flatMap((call) => call instanceof DropForeignKeyCall ? [`${call.tableName}.${call.constraintName}`] : []));\n\tconst isKeptKey = (tableName, fk) => !droppedKeys.has(`${tableName}.${foreignKeySpecOf(fk, tableName).name}`);\n\tfor (const dropped of droppedIndexes(calls, input.actual)) {\n\t\tconst conflict = conflictForIndexAKeyUses(dropped, input.expected, () => true);\n\t\tif (conflict !== void 0) conflicts.push(conflict);\n\t}\n\tconst innoDbIndexes = innoDbIndexDrops(calls, input.expected, input.actual);\n\tfor (const dropped of innoDbIndexes) {\n\t\tconst conflict = conflictForIndexAKeyUses(dropped, input.expected, isKeptKey);\n\t\tif (conflict !== void 0) conflicts.push(conflict);\n\t\tif (!allowed.includes(dropped.call.operationClass)) conflicts.push(conflictForDisallowedCall(dropped.call, allowed));\n\t}\n\tif (conflicts.length > 0) return notOk(conflicts);\n\tconst inOrder = (factoryName) => calls.filter((call) => call.factoryName === factoryName);\n\treturn ok([\n\t\t...inOrder(\"dropForeignKey\"),\n\t\t...innoDbIndexes.map(({ call }) => call),\n\t\t...CALL_ORDER.filter((factoryName) => factoryName !== \"dropForeignKey\").flatMap(inOrder)\n\t]);\n}\n//#endregion\n//#region src/core/migrations/mysql-migration.ts\n/**\n* The base class of a `migration.ts` for MySQL or a target that extends it, such as MariaDB. Each protected method returns the operation its name says, for the target `targetId` names, rendered through the control adapter the migration CLI builds from `prisma.config.ts`.\n*/\nvar MysqlMigrationBase = class extends Migration {\n\tcontrolAdapter;\n\tconstructor(stack) {\n\t\tsuper(stack);\n\t\tthis.controlAdapter = stack?.adapter === void 0 ? void 0 : blindCast(stack.adapter.create(stack));\n\t}\n\tadapterFor(operation) {\n\t\tif (this.controlAdapter === void 0) throw mysqlMigrationStackMissing(operation);\n\t\treturn this.controlAdapter;\n\t}\n\tcreateTable(options) {\n\t\treturn new CreateTableCall(options.table, options.columns, options.constraints ?? []).toOp(this.adapterFor(\"createTable\"), this.targetId);\n\t}\n\tdropTable(options) {\n\t\treturn new DropTableCall(options.table).toOp(void 0, this.targetId);\n\t}\n\taddColumn(options) {\n\t\treturn new AddColumnCall(options.table, options.column).toOp(this.adapterFor(\"addColumn\"), this.targetId);\n\t}\n\tdropColumn(options) {\n\t\treturn new DropColumnCall(options.table, options.column).toOp(void 0, this.targetId);\n\t}\n\tcreateIndex(options) {\n\t\treturn new CreateIndexCall(options.table, options.index, options.columns, options.unique === true).toOp(void 0, this.targetId);\n\t}\n\tdropIndex(options) {\n\t\treturn new DropIndexCall(options.table, options.index).toOp(void 0, this.targetId);\n\t}\n\taddUnique(options) {\n\t\treturn new AddUniqueCall(options.table, options.name, options.columns).toOp(void 0, this.targetId);\n\t}\n\tdropUnique(options) {\n\t\treturn new DropUniqueCall(options.table, options.name).toOp(void 0, this.targetId);\n\t}\n\taddForeignKey(options) {\n\t\treturn new AddForeignKeyCall(options.table, {\n\t\t\tname: options.name,\n\t\t\tcolumns: options.columns,\n\t\t\treferences: options.references,\n\t\t\t...ifDefined(\"onDelete\", options.onDelete),\n\t\t\t...ifDefined(\"onUpdate\", options.onUpdate)\n\t\t}).toOp(void 0, this.targetId);\n\t}\n\tdropForeignKey(options) {\n\t\treturn new DropForeignKeyCall(options.table, options.name).toOp(void 0, this.targetId);\n\t}\n};\n/** The base class of a MySQL `migration.ts`. */\nvar MysqlMigration = class extends MysqlMigrationBase {\n\ttargetId = \"mysql\";\n};\n//#endregion\n//#region src/core/migrations/render-ops.ts\nfunction assertTargetOp(op, factoryName, expectedTargetId) {\n\tconst targetId = blindCast(op).target?.id;\n\tif (targetId !== expectedTargetId) throw new InternalError(`renderOps: expected a ${expectedTargetId} operation but got target.id=\"${String(targetId)}\" for op.id=\"${op.id}\" (factoryName=\"${factoryName}\").`);\n}\nfunction checkedOp(opOrPromise, factoryName, targetId) {\n\tif (isThenable(opOrPromise)) {\n\t\tconst checked = opOrPromise.then((op) => {\n\t\t\tassertTargetOp(op, factoryName, targetId);\n\t\t\treturn op;\n\t\t});\n\t\tchecked.catch(() => void 0);\n\t\treturn checked;\n\t}\n\tassertTargetOp(opOrPromise, factoryName, targetId);\n\treturn opOrPromise;\n}\n/** The operations `calls` lower to, in order, each checked to be an operation of the target `targetId` names. */\nfunction renderOps(calls, lowerer, targetId) {\n\treturn calls.map((call) => checkedOp(isMysqlOpFactoryCall(call) ? call.toOp(lowerer, targetId) : blindCast(call).toOp(lowerer), call.factoryName, targetId));\n}\n//#endregion\n//#region src/core/migrations/render-typescript.ts\n/** The base class and the CLI entrypoint every scaffold imports, both from the facade's `migration` module. */\nconst BASE_IMPORTS = [{\n\tmoduleSpecifier: MIGRATION_MODULE_PLACEHOLDER,\n\tsymbol: \"Migration\"\n}, {\n\tmoduleSpecifier: MIGRATION_MODULE_PLACEHOLDER,\n\tsymbol: \"MigrationCLI\"\n}];\nfunction renderCallsToTypeScript(calls, meta) {\n\tconst imports = buildImports(calls, meta);\n\tconst operationsBody = calls.map((c) => c.renderTypeScript()).join(\",\\n\");\n\tconst hasStart = meta.from !== null;\n\tconst startField = hasStart ? [\" override readonly startContractJson = startContract;\"] : [];\n\treturn [\n\t\tshebangLineFor(detectScaffoldRuntime()),\n\t\timports,\n\t\t\"\",\n\t\t`export default class M extends Migration<${hasStart ? \"Start\" : \"never\"}, End> {`,\n\t\t...startField,\n\t\t\" override readonly endContractJson = endContract;\",\n\t\t\"\",\n\t\t\" override get operations() {\",\n\t\t\" return [\",\n\t\tindent(operationsBody, 6),\n\t\t\" ];\",\n\t\t\" }\",\n\t\t\"}\",\n\t\t\"\",\n\t\t\"MigrationCLI.run(import.meta.url, M);\",\n\t\t\"\"\n\t].join(\"\\n\");\n}\nfunction buildImports(calls, meta) {\n\tconst requirements = [...BASE_IMPORTS, ...contractImports(meta)];\n\tfor (const call of calls) for (const req of call.importRequirements()) requirements.push(req);\n\tconst resolve = meta.resolveImportSpecifier ?? keepInternalSpecifiers;\n\treturn renderImports(resolveRequirementSpecifiers(requirements, (specifier) => resolve(specifier === \"@internal/mysql/migration\" ? meta.migrationModule : specifier)));\n}\nfunction contractImports(meta) {\n\tconst reqs = [{\n\t\tmoduleSpecifier: contractSnapshotJsonSpecifier(meta.snapshotsImportPath, meta.to),\n\t\tsymbol: \"endContract\",\n\t\tkind: \"default\",\n\t\tattributes: { type: \"json\" }\n\t}, {\n\t\tmoduleSpecifier: contractSnapshotTypesSpecifier(meta.snapshotsImportPath, meta.to),\n\t\tsymbol: \"Contract\",\n\t\talias: \"End\",\n\t\ttypeOnly: true\n\t}];\n\tif (meta.from !== null) {\n\t\treqs.push({\n\t\t\tmoduleSpecifier: contractSnapshotJsonSpecifier(meta.snapshotsImportPath, meta.from),\n\t\t\tsymbol: \"startContract\",\n\t\t\tkind: \"default\",\n\t\t\tattributes: { type: \"json\" }\n\t\t});\n\t\treqs.push({\n\t\t\tmoduleSpecifier: contractSnapshotTypesSpecifier(meta.snapshotsImportPath, meta.from),\n\t\t\tsymbol: \"Contract\",\n\t\t\talias: \"Start\",\n\t\t\ttypeOnly: true\n\t\t});\n\t}\n\treturn reqs;\n}\nfunction indent(text, spaces) {\n\tconst pad = \" \".repeat(spaces);\n\treturn text.split(\"\\n\").map((line) => line.trim() ? `${pad}${line}` : line).join(\"\\n\");\n}\n//#endregion\n//#region src/core/migrations/planner-produced-mysql-migration.ts\n/** The plan the MySQL planner produces: its operations, and the `migration.ts` that writes them. */\nvar TypeScriptRenderableMysqlMigration = class extends MysqlMigrationBase {\n\ttargetId;\n\t#migrationModule;\n\t#calls;\n\t#meta;\n\t#destination;\n\t#spaceId;\n\t#snapshotsImportPath;\n\t#lowerer;\n\t#operationsCache;\n\tconstructor(options) {\n\t\tsuper();\n\t\tthis.targetId = options.target.targetId;\n\t\tthis.#migrationModule = options.target.migrationModule;\n\t\tthis.#calls = options.calls;\n\t\tthis.#meta = options.meta;\n\t\tthis.#spaceId = options.spaceId;\n\t\tthis.#snapshotsImportPath = options.snapshotsImportPath;\n\t\tthis.#destination = options.destination ?? { storageHash: options.meta.to };\n\t\tthis.#lowerer = options.lowerer;\n\t}\n\tget operations() {\n\t\tthis.#operationsCache ??= renderOps(this.#calls, this.#lowerer, this.targetId);\n\t\treturn this.#operationsCache;\n\t}\n\tdescribe() {\n\t\treturn this.#meta;\n\t}\n\tget destination() {\n\t\treturn this.#destination;\n\t}\n\tget spaceId() {\n\t\treturn this.#spaceId;\n\t}\n\trenderTypeScript(resolveImportSpecifier) {\n\t\treturn renderCallsToTypeScript(this.#calls, {\n\t\t\tfrom: this.#meta.from,\n\t\t\tto: this.#meta.to,\n\t\t\tsnapshotsImportPath: this.#snapshotsImportPath,\n\t\t\tresolveImportSpecifier,\n\t\t\tmigrationModule: this.#migrationModule\n\t\t});\n\t}\n};\n//#endregion\n//#region src/core/migrations/planner.ts\nfunction tableRenameByHand(targetId) {\n\treturn {\n\t\trenderTableRename: (rename) => new RawSqlCall(renameTableByHandOp(rename.from, rename.to, targetId)).renderTypeScript(),\n\t\ttableRenameByHand: (rename) => [`RENAME TABLE ${quoteIdentifier(rename.from)} TO ${quoteIdentifier(rename.to)}`]\n\t};\n}\nfunction tableTarget(table, column) {\n\treturn {\n\t\tstorageName: column === void 0 ? table : `${table}.${column}`,\n\t\ttable: {\n\t\t\tnamespaceId: UNBOUND_NAMESPACE_ID,\n\t\t\ttable,\n\t\t\tcolumn\n\t\t}\n\t};\n}\nfunction callSubjects(call) {\n\tconst dataLoss = call instanceof DropTableCall ? [{\n\t\t...tableTarget(call.tableName),\n\t\tloss: \"drop\"\n\t}] : call instanceof DropColumnCall ? [{\n\t\t...tableTarget(call.tableName, call.columnName),\n\t\tloss: \"drop\"\n\t}] : [];\n\treturn {\n\t\toperationCount: 1,\n\t\tlabel: call.label,\n\t\tdataLoss,\n\t\taccessChanges: [],\n\t\ttemporaryValues: []\n\t};\n}\n/** Whether `issue` is an extra table some contract space owns, which this space must leave alone. */\nfunction isTableOwnedElsewhere(issue, ownership) {\n\tif (issueOutcome(issue) !== \"not-expected\") return false;\n\tif (issueNode(issue)?.nodeKind !== RelationalSchemaNodeKind.table) return false;\n\tconst table = issue.path[1];\n\treturn table !== void 0 && ownership.declaresEntity({\n\t\tnamespaceId: UNBOUND_NAMESPACE_ID,\n\t\tentityKind: \"table\",\n\t\tentityName: table\n\t});\n}\n/**\n* The MySQL migration planner, for MySQL or a target that extends it. It diffs the contract's schema against the live one and plans creating and dropping tables, columns, indexes, unique constraints and foreign keys. Every other change, and every statement such as a rename, is refused with a conflict that says it is not yet supported on MySQL.\n*/\nvar MysqlMigrationPlanner = class {\n\t#lowerer;\n\t#target;\n\tconstructor(lowerer, target) {\n\t\tthis.#lowerer = lowerer;\n\t\tthis.#target = target;\n\t}\n\tplan(options) {\n\t\treturn this.#planSql(blindCast(options));\n\t}\n\temptyMigration(context, spaceId) {\n\t\treturn new TypeScriptRenderableMysqlMigration({\n\t\t\tcalls: [],\n\t\t\tmeta: {\n\t\t\t\tfrom: context.fromHash,\n\t\t\t\tto: context.toHash\n\t\t\t},\n\t\t\tspaceId,\n\t\t\tsnapshotsImportPath: context.snapshotsImportPath,\n\t\t\tlowerer: this.#lowerer,\n\t\t\ttarget: this.#target\n\t\t});\n\t}\n\t#planSql(options) {\n\t\tif (!options.policy.allowedOperationClasses.includes(\"additive\")) return plannerFailure([{\n\t\t\tkind: \"unsupportedOperation\",\n\t\t\tsummary: \"Migration planner requires additive operations be allowed\",\n\t\t\twhy: \"The planner requires the \\\"additive\\\" operation class to be allowed in the policy.\"\n\t\t}]);\n\t\tconst [statement] = options.statements;\n\t\tif (statement !== void 0) return plannerFailure([statementNotYetSupported(statement)]);\n\t\tif (!(options.schema instanceof SqlSchemaIR)) throw mysqlError(\"CONTRACT.TARGET_MISMATCH\", \"The MySQL planner received a schema tree that neither MySQL introspection nor contractToSchema built.\");\n\t\tconst expected = mysqlContractToSchema(options.contract, sqlTypeLookupsOf(options.frameworkComponents));\n\t\tconst actual = options.schema;\n\t\tconst allowed = options.policy.allowedOperationClasses;\n\t\tconst strict = allowed.includes(\"widening\") || allowed.includes(\"destructive\");\n\t\tconst { ownership } = options;\n\t\tconst planned = planIssues({\n\t\t\tissues: coalesceSubtreeIssues(diffSchemas(expected, actual)).filter((issue) => (strict || issueOutcome(issue) !== \"not-expected\") && (ownership === void 0 || !isTableOwnedElsewhere(issue, ownership))),\n\t\t\texpected,\n\t\t\tactual,\n\t\t\tpolicy: options.policy\n\t\t});\n\t\tif (!planned.ok) return plannerFailure(planned.failure);\n\t\tconst calls = planned.value;\n\t\treturn {\n\t\t\tkind: \"success\",\n\t\t\tplan: new TypeScriptRenderableMysqlMigration({\n\t\t\t\tcalls,\n\t\t\t\tmeta: {\n\t\t\t\t\tfrom: options.origin?.storageHash ?? null,\n\t\t\t\t\tto: options.contract.storage.storageHash\n\t\t\t\t},\n\t\t\t\tspaceId: options.spaceId,\n\t\t\t\tsnapshotsImportPath: options.snapshotsImportPath,\n\t\t\t\tdestination: {\n\t\t\t\t\tstorageHash: options.contract.storage.storageHash,\n\t\t\t\t\t...options.contract.profileHash === void 0 ? {} : { profileHash: options.contract.profileHash }\n\t\t\t\t},\n\t\t\t\tlowerer: this.#lowerer,\n\t\t\t\ttarget: this.#target\n\t\t\t}),\n\t\t\tappliedStatements: [],\n\t\t\t...subjectsOfCalls(calls.map(callSubjects), {\n\t\t\t\tfromContract: options.fromContract,\n\t\t\t\tcontract: options.contract,\n\t\t\t\torigins: NO_RENAMED_ORIGINS,\n\t\t\t\tbyHand: tableRenameByHand(this.#target.targetId),\n\t\t\t\tremovedVariants: []\n\t\t\t})\n\t\t};\n\t}\n};\nfunction statementNotYetSupported(statement) {\n\treturn {\n\t\tkind: \"statementRefused\",\n\t\tsummary: `A ${statement.kind} statement is not yet supported by the migration planner`,\n\t\twhy: \"The migration planner plans no rename, conversion or backfill yet. Plan the change without the statement, or write it by hand in a migration of its own with `migration new`.\",\n\t\trefusedStatement: statement\n\t};\n}\nfunction createMysqlMigrationPlanner(lowerer, target) {\n\treturn new MysqlMigrationPlanner(lowerer, target);\n}\n//#endregion\n//#region src/core/migrations/runner.ts\n/** An error without a structured code, such as a driver's socket error, thrown while a space applied: reported as `MIGRATION.EXECUTION_FAILED`, with its own code, when it has one, in `errorCode`. */\nfunction failureFromThrown(error) {\n\tconst errorCode = typeof error === \"object\" && error !== null ? Reflect.get(error, \"code\") : void 0;\n\treturn migrationRunnerFailure(\"MIGRATION.EXECUTION_FAILED\", error instanceof Error ? error.message : String(error), {\n\t\tmeta: typeof errorCode === \"string\" ? { errorCode } : {},\n\t\tcause: error\n\t});\n}\n/** The structured error thrown while a space applied, keeping its code, advice and docs link, with the space and whether the database changed added to its facts. */\nfunction withSpaceFacts(error, failingSpace, databaseUnchanged) {\n\treturn Object.assign(error, { meta: {\n\t\t...error.meta ?? {},\n\t\tfailingSpace,\n\t\tdatabaseUnchanged\n\t} });\n}\nfunction stepHolds(rows) {\n\tconst value = rows[0] === void 0 ? void 0 : Object.values(rows[0])[0];\n\tif (typeof value === \"string\") return value !== \"0\" && value.length > 0;\n\treturn Boolean(value);\n}\nfunction skipRecord(operation) {\n\treturn Object.freeze({\n\t\tid: operation.id,\n\t\tlabel: operation.label,\n\t\t...ifDefined(\"summary\", operation.summary),\n\t\toperationClass: operation.operationClass,\n\t\ttarget: operation.target,\n\t\tprecheck: Object.freeze([]),\n\t\texecute: Object.freeze([]),\n\t\tpostcheck: Object.freeze([...operation.postcheck]),\n\t\tmeta: Object.freeze({\n\t\t\t...operation.meta ?? {},\n\t\t\trunner: Object.freeze({\n\t\t\t\tskipped: true,\n\t\t\t\treason: \"postcheck_pre_satisfied\"\n\t\t\t})\n\t\t})\n\t});\n}\n/**\n* The MySQL migration runner. MySQL commits every DDL statement as it runs, so no transaction can undo an apply: the runner applies one space at a time, checks each operation before and after it runs, verifies the space's schema with the caller's strictness (every space, not only the app space), and only then writes the space's marker and ledger entries, in one transaction. A failure leaves the spaces before it applied, and running the apply again skips what already holds. The whole apply holds the marker lock, which MySQL keeps for the session, so it is released on the same connection when the apply ends.\n*/\nvar MysqlMigrationRunner = class {\n\tfamily;\n\tconstructor(family) {\n\t\tthis.family = family;\n\t}\n\tasync execute(options) {\n\t\tconst { driver, perSpaceOptions, expectedDatabasePolicies } = options;\n\t\tif (perSpaceOptions.length === 0) return ok({ perSpaceResults: [] });\n\t\treturn withMarkerLock(driver, async () => {\n\t\t\tif (expectedDatabasePolicies !== void 0) {\n\t\t\t\tconst policiesCheck = await checkDatabasePoliciesHeld(this.family, driver, expectedDatabasePolicies);\n\t\t\t\tif (!policiesCheck.ok) return notOk(withDatabaseUnchanged(policiesCheck.failure, true));\n\t\t\t}\n\t\t\treturn this.#applySpaces(driver, perSpaceOptions);\n\t\t}, (result) => result.ok);\n\t}\n\tasync executeOnConnection(options) {\n\t\treturn this.#applySpace(options, { changedDatabase: false });\n\t}\n\tasync #applySpaces(driver, perSpaceOptions) {\n\t\tconst perSpaceResults = [];\n\t\tlet changedBefore = false;\n\t\tfor (const spaceOptions of perSpaceOptions) {\n\t\t\tconst space = spaceOptions.space ?? spaceOptions.plan.spaceId;\n\t\t\tconst progress = { changedDatabase: false };\n\t\t\tlet result;\n\t\t\ttry {\n\t\t\t\tresult = await this.#applySpace({\n\t\t\t\t\t...spaceOptions,\n\t\t\t\t\tdriver,\n\t\t\t\t\tspace\n\t\t\t\t}, progress);\n\t\t\t} catch (error) {\n\t\t\t\tif (isInternalError(error)) throw error;\n\t\t\t\tconst databaseUnchanged = !changedBefore && !progress.changedDatabase;\n\t\t\t\tif (isStructuredError(error)) throw withSpaceFacts(error, space, databaseUnchanged);\n\t\t\t\tresult = notOk(failureFromThrown(error));\n\t\t\t}\n\t\t\tif (!result.ok) return notOk(withFailingSpace(withDatabaseUnchanged(result.failure, !changedBefore && !progress.changedDatabase), space));\n\t\t\tchangedBefore ||= progress.changedDatabase;\n\t\t\tperSpaceResults.push({\n\t\t\t\tspace,\n\t\t\t\tvalue: result.value\n\t\t\t});\n\t\t}\n\t\treturn ok({ perSpaceResults });\n\t}\n\tasync #applySpace(options, progress) {\n\t\tconst { driver } = options;\n\t\tif (options.space !== void 0 && options.space !== options.plan.spaceId) throw mysqlError(\"MIGRATION.CONTRACT_SPACE_VIOLATION\", `SqlMigrationRunner: options.space (${options.space}) does not match plan.spaceId (${options.plan.spaceId})`, { meta: {\n\t\t\tspace: options.space,\n\t\t\tplanSpaceId: options.plan.spaceId\n\t\t} });\n\t\tconst space = options.plan.spaceId;\n\t\tconst operations = blindCast(await Promise.all(options.plan.operations));\n\t\tconst destinationCheck = this.#checkDestination(options.plan.destination, options.destinationContract);\n\t\tif (!destinationCheck.ok) return destinationCheck;\n\t\tconst policyCheck = this.#checkPolicy(options.policy, operations);\n\t\tif (!policyCheck.ok) return policyCheck;\n\t\tawait this.#ensureControlTables(driver, options);\n\t\tconst existingMarker = await this.family.readMarker({\n\t\t\tdriver,\n\t\t\tspace\n\t\t});\n\t\tconst originCheck = this.#checkOrigin(existingMarker, options.plan.origin ?? null);\n\t\tif (!originCheck.ok) return originCheck;\n\t\tconst isSelfEdge = options.plan.origin?.storageHash === options.plan.destination.storageHash;\n\t\tconst atDestination = existingMarker !== null && existingMarker.storageHash === options.plan.destination.storageHash && (options.plan.destination.profileHash === void 0 || existingMarker.profileHash === options.plan.destination.profileHash);\n\t\tconst applied = atDestination && options.plan.origin != null && !isSelfEdge ? {\n\t\t\tresult: okVoid(),\n\t\t\texecuted: [],\n\t\t\texecutedCount: 0\n\t\t} : await this.#applyOperations(driver, options, operations, progress);\n\t\tif (!applied.result.ok) return applied.result;\n\t\tconst schema = await this.family.introspect({\n\t\t\tdriver,\n\t\t\tcontract: options.destinationContract\n\t\t});\n\t\tconst verified = this.family.verifySchema({\n\t\t\tcontract: options.destinationContract,\n\t\t\tschema,\n\t\t\tstrict: options.strictVerification ?? true,\n\t\t\tframeworkComponents: options.frameworkComponents\n\t\t});\n\t\tif (!verified.ok) return runnerFailure(\"MIGRATION.SCHEMA_VERIFY_FAILED\", verified.summary, {\n\t\t\twhy: schemaCheckWhy(verified.schema.issues),\n\t\t\tmeta: { schemaIssues: verified.schema.issues }\n\t\t});\n\t\tconst existingInvariants = new Set(existingMarker?.invariants ?? []);\n\t\tconst incomingIsSubsetOfExisting = options.plan.providedInvariants.every((id) => existingInvariants.has(id));\n\t\tconst isSelfEdgeNoOp = isSelfEdge && applied.executedCount === 0 && incomingIsSubsetOfExisting;\n\t\tconst recordsPoliciesOnly = options.databasePolicies !== void 0 && applied.executedCount === 0 && atDestination && incomingIsSubsetOfExisting;\n\t\tif (!isSelfEdgeNoOp || options.databasePolicies !== void 0) {\n\t\t\tconst written = await this.#writeMarkerAndLedger(driver, options, existingMarker, isSelfEdgeNoOp || recordsPoliciesOnly ? void 0 : applied.executed, progress);\n\t\t\tif (!written.ok) return written;\n\t\t}\n\t\treturn runnerSuccess({\n\t\t\toperationsPlanned: operations.length,\n\t\t\toperationsExecuted: applied.executedCount\n\t\t});\n\t}\n\tasync #ensureControlTables(driver, options) {\n\t\tfor (const query of this.family.bootstrapControlTableQueries()) {\n\t\t\tconst statement = await this.family.lowerAst(query, { contract: options.destinationContract });\n\t\t\tawait driver.query(statement.sql, statement.params);\n\t\t}\n\t}\n\tasync #applyOperations(driver, options, operations, progress) {\n\t\tconst checks = options.executionChecks;\n\t\tconst runPrechecks = checks?.prechecks !== false;\n\t\tconst runPostchecks = checks?.postchecks !== false;\n\t\tconst runIdempotency = checks?.idempotencyChecks !== false;\n\t\tconst executed = [];\n\t\tlet executedCount = 0;\n\t\tconst stop = (result) => ({\n\t\t\tresult,\n\t\t\texecuted,\n\t\t\texecutedCount\n\t\t});\n\t\tfor (const operation of operations) {\n\t\t\toptions.callbacks?.onOperationStart?.(operation);\n\t\t\ttry {\n\t\t\t\tif (runPostchecks && runIdempotency && await this.#allHold(driver, operation.postcheck)) {\n\t\t\t\t\texecuted.push(skipRecord(operation));\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (runPrechecks) {\n\t\t\t\t\tconst precheck = await this.#runChecks(driver, operation, \"precheck\");\n\t\t\t\t\tif (!precheck.ok) return stop(precheck);\n\t\t\t\t}\n\t\t\t\tconst execution = await this.#runSteps(driver, operation, progress);\n\t\t\t\tif (!execution.ok) return stop(execution);\n\t\t\t\texecutedCount += 1;\n\t\t\t\tif (runPostchecks) {\n\t\t\t\t\tconst postcheck = await this.#runChecks(driver, operation, \"postcheck\");\n\t\t\t\t\tif (!postcheck.ok) return stop(postcheck);\n\t\t\t\t}\n\t\t\t\texecuted.push(operation);\n\t\t\t} finally {\n\t\t\t\toptions.callbacks?.onOperationComplete?.(operation);\n\t\t\t}\n\t\t}\n\t\treturn stop(okVoid());\n\t}\n\tasync #allHold(driver, steps) {\n\t\tif (steps.length === 0) return false;\n\t\tfor (const step of steps) if (!stepHolds((await driver.query(step.sql, step.params ?? [])).rows)) return false;\n\t\treturn true;\n\t}\n\tasync #runChecks(driver, operation, phase) {\n\t\tfor (const step of operation[phase]) {\n\t\t\tif (stepHolds((await driver.query(step.sql, step.params ?? [])).rows)) continue;\n\t\t\tconst failedCheck = {\n\t\t\t\toperationId: operation.id,\n\t\t\t\tphase,\n\t\t\t\tdescription: step.description,\n\t\t\t\t...ifDefined(\"expectation\", step.expectation)\n\t\t\t};\n\t\t\treturn runnerFailure(phase === \"precheck\" ? \"MIGRATION.PRECHECK_FAILED\" : \"MIGRATION.POSTCHECK_FAILED\", `Operation ${operation.id} failed during ${phase}: ${step.description}`, {\n\t\t\t\twhy: phase === \"precheck\" ? failedPrecheckWhy(failedCheck) : failedPostcheckWhy(failedCheck),\n\t\t\t\tmeta: { failedCheck }\n\t\t\t});\n\t\t}\n\t\treturn okVoid();\n\t}\n\t/** Runs an operation's steps, and records in `progress` each one that reached the database, which a DDL statement changes for good. */\n\tasync #runSteps(driver, operation, progress) {\n\t\tfor (const step of operation.execute) try {\n\t\t\tawait driver.query(step.sql, step.params ?? []);\n\t\t\tprogress.changedDatabase = true;\n\t\t} catch (error) {\n\t\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\t\treturn runnerFailure(\"MIGRATION.EXECUTION_FAILED\", `Operation ${operation.id} failed during execution: ${step.description}`, {\n\t\t\t\twhy: message,\n\t\t\t\tmeta: {\n\t\t\t\t\toperationId: operation.id,\n\t\t\t\t\tstepDescription: step.description,\n\t\t\t\t\tsql: step.sql\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t\treturn okVoid();\n\t}\n\tasync #writeMarkerAndLedger(driver, options, existingMarker, executed, progress) {\n\t\tconst { plan } = options;\n\t\tconst destination = {\n\t\t\tstorageHash: plan.destination.storageHash,\n\t\t\tprofileHash: plan.destination.profileHash ?? options.destinationContract.profileHash ?? plan.destination.storageHash,\n\t\t\tinvariants: plan.providedInvariants,\n\t\t\t...ifDefined(\"databasePolicies\", options.databasePolicies)\n\t\t};\n\t\tawait driver.query(\"START TRANSACTION\");\n\t\ttry {\n\t\t\tif (existingMarker === null) await this.family.initMarker({\n\t\t\t\tdriver,\n\t\t\t\tspace: plan.spaceId,\n\t\t\t\tdestination\n\t\t\t});\n\t\t\telse if (!await this.family.updateMarker({\n\t\t\t\tdriver,\n\t\t\t\tspace: plan.spaceId,\n\t\t\t\texpectedFrom: existingMarker.storageHash,\n\t\t\t\tdestination\n\t\t\t})) {\n\t\t\t\tawait driver.query(\"ROLLBACK\");\n\t\t\t\tconst found = await this.family.readMarker({\n\t\t\t\t\tdriver,\n\t\t\t\t\tspace: plan.spaceId\n\t\t\t\t});\n\t\t\t\treturn runnerFailure(\"MIGRATION.MARKER_CAS_FAILURE\", \"Marker was modified by another process during migration execution.\", { meta: {\n\t\t\t\t\treason: \"storageHash\",\n\t\t\t\t\tspace: plan.spaceId,\n\t\t\t\t\texpectedStorageHash: existingMarker.storageHash,\n\t\t\t\t\tfoundStorageHash: found?.storageHash ?? null,\n\t\t\t\t\tdestinationStorageHash: plan.destination.storageHash\n\t\t\t\t} });\n\t\t\t}\n\t\t\tif (executed !== void 0) await this.#writeLedger(driver, options, executed);\n\t\t} catch (error) {\n\t\t\tawait driver.query(\"ROLLBACK\").catch(() => void 0);\n\t\t\tthrow error;\n\t\t}\n\t\tprogress.changedDatabase = true;\n\t\tawait driver.query(\"COMMIT\");\n\t\treturn okVoid();\n\t}\n\tasync #writeLedger(driver, options, executed) {\n\t\tconst { plan, migrationEdges } = options;\n\t\tconst edgeOperations = migrationEdges.reduce((sum, edge) => sum + edge.operationCount, 0);\n\t\tif (edgeOperations !== plan.operations.length) throw new InternalError(`Ledger write: plan.operations length (${plan.operations.length}) does not match sum of migrationEdges operationCount (${edgeOperations})`);\n\t\tlet offset = 0;\n\t\tfor (const edge of migrationEdges) {\n\t\t\tconst operations = executed.slice(offset, offset + edge.operationCount);\n\t\t\toffset += edge.operationCount;\n\t\t\tawait this.family.writeLedgerEntry({\n\t\t\t\tdriver,\n\t\t\t\tspace: plan.spaceId,\n\t\t\t\tentry: {\n\t\t\t\t\tedgeId: `${edge.from}->${edge.to}`,\n\t\t\t\t\tfrom: edge.from,\n\t\t\t\t\tto: edge.to,\n\t\t\t\t\tmigrationName: edge.dirName,\n\t\t\t\t\tmigrationHash: edge.migrationHash,\n\t\t\t\t\toperations\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\t#checkDestination(destination, contract) {\n\t\tif (destination.storageHash !== contract.storage.storageHash) return runnerFailure(\"MIGRATION.DESTINATION_CONTRACT_MISMATCH\", `Plan destination storage hash (${destination.storageHash}) does not match provided contract storage hash (${contract.storage.storageHash}).`, { meta: {\n\t\t\tplanStorageHash: destination.storageHash,\n\t\t\tcontractStorageHash: contract.storage.storageHash\n\t\t} });\n\t\tif (destination.profileHash !== void 0 && contract.profileHash !== void 0 && destination.profileHash !== contract.profileHash) return runnerFailure(\"MIGRATION.DESTINATION_CONTRACT_MISMATCH\", `Plan destination profile hash (${destination.profileHash}) does not match provided contract profile hash (${contract.profileHash}).`, { meta: {\n\t\t\tplanProfileHash: destination.profileHash,\n\t\t\tcontractProfileHash: contract.profileHash\n\t\t} });\n\t\treturn okVoid();\n\t}\n\t#checkPolicy(policy, operations) {\n\t\tconst allowed = new Set(policy.allowedOperationClasses);\n\t\tconst refused = operations.find((operation) => !allowed.has(operation.operationClass));\n\t\tif (refused === void 0) return okVoid();\n\t\treturn runnerFailure(\"MIGRATION.POLICY_VIOLATION\", `Operation ${refused.id} has class \"${refused.operationClass}\" which is not allowed by policy.`, {\n\t\t\twhy: `Policy only allows: ${policy.allowedOperationClasses.join(\", \")}.`,\n\t\t\tmeta: {\n\t\t\t\toperationId: refused.id,\n\t\t\t\toperationClass: refused.operationClass,\n\t\t\t\tallowedClasses: policy.allowedOperationClasses\n\t\t\t}\n\t\t});\n\t}\n\t#checkOrigin(marker, origin) {\n\t\tif (origin === null) return okVoid();\n\t\tif (marker === null) return runnerFailure(\"MIGRATION.MARKER_ORIGIN_MISMATCH\", `Missing contract marker: expected origin storage hash ${origin.storageHash}.`, { meta: { expectedOriginStorageHash: origin.storageHash } });\n\t\tif (marker.storageHash !== origin.storageHash) return runnerFailure(\"MIGRATION.MARKER_ORIGIN_MISMATCH\", `Existing contract marker (${marker.storageHash}) does not match plan origin (${origin.storageHash}).`, { meta: {\n\t\t\tmarkerStorageHash: marker.storageHash,\n\t\t\texpectedOriginStorageHash: origin.storageHash\n\t\t} });\n\t\tif (origin.profileHash !== void 0 && marker.profileHash !== origin.profileHash) return runnerFailure(\"MIGRATION.MARKER_ORIGIN_MISMATCH\", `Existing contract marker profile hash (${marker.profileHash}) does not match plan origin profile hash (${origin.profileHash}).`, { meta: {\n\t\t\tmarkerProfileHash: marker.profileHash,\n\t\t\texpectedOriginProfileHash: origin.profileHash\n\t\t} });\n\t\treturn okVoid();\n\t}\n};\nfunction createMysqlMigrationRunner(family) {\n\treturn new MysqlMigrationRunner(family);\n}\n//#endregion\nexport { MYSQL_MIGRATION_MODULE as _, MysqlMigration as a, diffMysqlSchema as b, AddForeignKeyCall as c, CreateTableCall as d, DropColumnCall as f, DropUniqueCall as g, DropTableCall as h, TypeScriptRenderableMysqlMigration as i, AddUniqueCall as l, DropIndexCall as m, MysqlMigrationPlanner as n, MysqlMigrationBase as o, DropForeignKeyCall as p, createMysqlMigrationPlanner as r, AddColumnCall as s, createMysqlMigrationRunner as t, CreateIndexCall as u, RawSqlCall as v, mysqlContractToSchema as x, rawSql as y };\n\n//# sourceMappingURL=runner-DEKKxDyw.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,SAAS,sBAAsB,UAAU,OAAO;CAC/C,OAAO,mBAAmB,UAAU;EACnC,qBAAqB;EACrB,gBAAgB;EAChB,gBAAgB,MAAM;EACtB,aAAa,MAAM;CACpB,CAAC;AACF;;AAEA,SAAS,qBAAqB,OAAO,UAAU;CAC9C,MAAM,YAAY,MAAM,KAAK;CAC7B,IAAI,cAAc,KAAK,GAAG,OAAO,KAAK;CACtC,KAAK,MAAM,eAAe,OAAO,KAAK,SAAS,QAAQ,UAAU,GAAG;EACnE,MAAM,QAAQ,SAAS,SAAS,SAAS;GACxC;GACA,YAAY;GACZ,YAAY;EACb,CAAC;EACD,IAAI,UAAU,KAAK,GAAG,OAAO,MAAM;CACpC;AACD;;AAEA,SAAS,gBAAgB,OAAO;CAC/B,IAAI,EAAE,MAAM,kBAAkB,cAAc,MAAM,WAAW,4BAA4B,sFAAsF;CAC/K,MAAM,WAAW,sBAAsB,MAAM,UAAU,iBAAiB,MAAM,mBAAmB,CAAC;CAClG,MAAM,SAAS,MAAM;CACrB,MAAM,uBAAuB,OAAO,OAAO,MAAM,SAAS,QAAQ,UAAU,CAAC,CAAC,QAAQ,OAAO,OAAO,KAAK,GAAG,QAAQ,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;CAC3I,OAAO;EACN,QAAQ,YAAY,UAAU,MAAM;EACpC,uBAAuB,UAAU,qBAAqB,OAAO,MAAM,QAAQ;EAC3E,gBAAgB,qBAAqB,WAAW,EAAE,OAAO,EAAE;CAC5D;AACD;AAGA,SAAS,KAAK,aAAa,KAAK,QAAQ,aAAa;CACpD,OAAO;EACN;EACA;EACA,GAAG,UAA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n as mysqlCreateNamespace, t as MysqlDatabase } from "./mysql-database-
17
17
  import { t as MysqlContractSerializer } from "./mysql-contract-serializer-BnTKRSsN-BnV7fdYd.mjs";
18
18
  import { n as readMysqlDefault, t as mysqlResolveDefault } from "./default-normalizer-C8pc7SbL-BXd70q02.mjs";
19
19
  import { i as withMarkerLock, n as acquireMarkerLock, r as releaseMarkerLock, t as MARKER_LOCK_TIMEOUT_SECONDS } from "./marker-lock-Bwew7cAs-ElLxlCQp.mjs";
20
- import { _ as createMysqlMigrationPlanner, a as CreateTableCall, c as DropIndexCall, f as MysqlMigration, g as TypeScriptRenderableMysqlMigration, h as RawSqlCall, i as CreateIndexCall, l as DropTableCall, m as MysqlMigrationPlanner, n as AddForeignKeyCall, o as DropColumnCall, p as MysqlMigrationBase, r as AddUniqueCall, s as DropForeignKeyCall, t as AddColumnCall, u as DropUniqueCall, v as createMysqlMigrationRunner, x as rawSql } from "./runner-BIjAWX-E-BgTmrD8f.mjs";
21
- import { t as createMysqlControlTargetDescriptor } from "./control-DNuE7H2C.mjs";
20
+ import { _ as createMysqlMigrationPlanner, a as CreateTableCall, c as DropIndexCall, f as MysqlMigration, g as TypeScriptRenderableMysqlMigration, h as RawSqlCall, i as CreateIndexCall, l as DropTableCall, m as MysqlMigrationPlanner, n as AddForeignKeyCall, o as DropColumnCall, p as MysqlMigrationBase, r as AddUniqueCall, s as DropForeignKeyCall, t as AddColumnCall, u as DropUniqueCall, v as createMysqlMigrationRunner, x as rawSql } from "./runner-DEKKxDyw-Cdo1Ysod.mjs";
21
+ import { t as createMysqlControlTargetDescriptor } from "./control-RYDTbndD.mjs";
22
22
  import { a as placeholder, c as unique, i as lit, n as col, o as primaryKey, r as fn, s as sql, t as MigrationCLI } from "./migration-tFuoN9GB.mjs";
23
23
  import { i as validateMysqlIsolationLevel, n as mysqlIsolationLevels, t as mysqlIsolationLevelSchema } from "./runtime-DUDdsFyy.mjs";
24
24
  import { t as tokenizeMysqlSql } from "./sql-utils-BE8tDXHs.mjs";
@@ -1,3 +1,3 @@
1
1
  import { t as mysqlScalarTypeConstructors } from "./descriptor-meta-BF6YvSag-ChHHvlHc.mjs";
2
- import { n as mysqlControlTargetDescriptor, t as createMysqlControlTargetDescriptor } from "./control-DNuE7H2C.mjs";
2
+ import { n as mysqlControlTargetDescriptor, t as createMysqlControlTargetDescriptor } from "./control-RYDTbndD.mjs";
3
3
  export { createMysqlControlTargetDescriptor, mysqlControlTargetDescriptor as default, mysqlScalarTypeConstructors };
@@ -1,3 +1,3 @@
1
- import { _ as createMysqlMigrationPlanner, a as CreateTableCall, c as DropIndexCall, f as MysqlMigration, g as TypeScriptRenderableMysqlMigration, h as RawSqlCall, i as CreateIndexCall, l as DropTableCall, m as MysqlMigrationPlanner, n as AddForeignKeyCall, o as DropColumnCall, p as MysqlMigrationBase, r as AddUniqueCall, s as DropForeignKeyCall, t as AddColumnCall, u as DropUniqueCall, v as createMysqlMigrationRunner, x as rawSql } from "./runner-BIjAWX-E-BgTmrD8f.mjs";
1
+ import { _ as createMysqlMigrationPlanner, a as CreateTableCall, c as DropIndexCall, f as MysqlMigration, g as TypeScriptRenderableMysqlMigration, h as RawSqlCall, i as CreateIndexCall, l as DropTableCall, m as MysqlMigrationPlanner, n as AddForeignKeyCall, o as DropColumnCall, p as MysqlMigrationBase, r as AddUniqueCall, s as DropForeignKeyCall, t as AddColumnCall, u as DropUniqueCall, v as createMysqlMigrationRunner, x as rawSql } from "./runner-DEKKxDyw-Cdo1Ysod.mjs";
2
2
  import { a as placeholder, c as unique, i as lit, n as col, o as primaryKey, r as fn, s as sql, t as MigrationCLI } from "./migration-tFuoN9GB.mjs";
3
3
  export { AddColumnCall, AddForeignKeyCall, AddUniqueCall, CreateIndexCall, CreateTableCall, DropColumnCall, DropForeignKeyCall, DropIndexCall, DropTableCall, DropUniqueCall, MysqlMigration as Migration, MigrationCLI, MysqlMigrationBase, MysqlMigrationPlanner, RawSqlCall, TypeScriptRenderableMysqlMigration, col, createMysqlMigrationPlanner, createMysqlMigrationRunner, fn, lit, placeholder, primaryKey, rawSql, sql, unique };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/orm-target-mysql",
3
- "version": "8.0.0-rc.24-dev.22",
3
+ "version": "8.0.0-rc.24-dev.24",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -9,21 +9,21 @@
9
9
  "dist"
10
10
  ],
11
11
  "dependencies": {
12
- "@prisma/orm-family-sql": "8.0.0-rc.24-dev.22",
13
- "@prisma/orm-framework": "8.0.0-rc.24-dev.22",
14
- "@prisma/orm-toolchain": "8.0.0-rc.24-dev.22",
12
+ "@prisma/orm-family-sql": "8.0.0-rc.24-dev.24",
13
+ "@prisma/orm-framework": "8.0.0-rc.24-dev.24",
14
+ "@prisma/orm-toolchain": "8.0.0-rc.24-dev.24",
15
15
  "@standard-schema/spec": "1.1.0",
16
16
  "arktype": "^2.2.2",
17
17
  "mariadb": "3.5.4",
18
18
  "temporal-spec": "1.0.1"
19
19
  },
20
20
  "devDependencies": {
21
- "@internal/adapter-mysql": "8.0.0-rc.24-dev.22",
22
- "@internal/driver-mysql": "8.0.0-rc.24-dev.22",
23
- "@internal/target-mysql": "8.0.0-rc.24-dev.22",
24
- "@repo/test-utils": "8.0.0-rc.24-dev.22",
25
- "@repo/tsconfig": "8.0.0-rc.24-dev.22",
26
- "@repo/tsdown": "8.0.0-rc.24-dev.22",
21
+ "@internal/adapter-mysql": "8.0.0-rc.24-dev.24",
22
+ "@internal/driver-mysql": "8.0.0-rc.24-dev.24",
23
+ "@internal/target-mysql": "8.0.0-rc.24-dev.24",
24
+ "@repo/test-utils": "8.0.0-rc.24-dev.24",
25
+ "@repo/tsconfig": "8.0.0-rc.24-dev.24",
26
+ "@repo/tsdown": "8.0.0-rc.24-dev.24",
27
27
  "tsdown": "0.22.14",
28
28
  "typescript": "5.9.3",
29
29
  "vitest": "5.0.0-rc.2"
@@ -1 +0,0 @@
1
- {"version":3,"file":"control-DDjdwyGa.mjs","names":["#inTransaction"],"sources":["../../../../3-targets/mysql/1-mysql/2-adapter/dist/control.mjs"],"sourcesContent":["import { t as mysqlAdapterDescriptorMeta } from \"./descriptor-meta-e29H69KN.mjs\";\nimport { a as tableExists, i as readMarkerRows, n as parseJsonColumn, r as readMarkerResult, t as decodeMysqlMarkerRow } from \"./marker-read-D1hp62hF.mjs\";\nimport { assembleMysqlCodecRegistry, decodeMysqlDatetime, encodeMysqlDatetime, mysqlCurrentValueFor, mysqlNowExpression } from \"@internal/target-mysql/codecs\";\nimport { checkSqlDefaultText, contractColumns, readColumnDefault, sqlDefaultFunctions } from \"@internal/family-sql/control\";\nimport { parseMarkerRowSafely, withMarkerReadErrorHandling } from \"@internal/errors/execution\";\nimport { codecForRef } from \"@internal/framework-components/codec\";\nimport { APP_SPACE_ID } from \"@internal/framework-components/control\";\nimport { encodeLiteralDefault, isDdlNode, renderOpaqueSql } from \"@internal/sql-relational-core/ast\";\nimport { buildControlTableBootstrapQueries, buildSignMarkerBootstrapQueries } from \"@internal/target-mysql/contract-free\";\nimport { CONTROL_TABLE_NAMES, LEDGER_TABLE_NAME, MARKER_TABLE_NAME } from \"@internal/target-mysql/control-tables\";\nimport { mysqlQueryNotYetSupported } from \"@internal/target-mysql/errors\";\nimport { withMarkerLock } from \"@internal/target-mysql/marker-lock\";\nimport { structuredError } from \"@internal/utils/structured-error\";\nimport { quoteIdentifier, quoteLiteral } from \"@internal/target-mysql/sql-utils\";\nimport { REFERENTIAL_ACTION_SQL } from \"@internal/sql-contract/referential-action-sql\";\nimport { resolveIntrospectedColumnType } from \"@internal/family-sql/control-adapter\";\nimport { RelationalSchemaNodeKind, SqlSchemaIR, SqlTableIR } from \"@internal/sql-schema-ir/types\";\nimport { readMysqlDefault } from \"@internal/target-mysql/default-normalizer\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { ledgerOriginFromStored } from \"@internal/migration-tools/ledger-origin\";\n//#region src/core/migrations/ddl-renderer.ts\n/** Column types MySQL gives a default only when it is written as an expression in parentheses. */\nconst EXPRESSION_DEFAULT_ONLY = /^(?:(?:tiny|medium|long)?(?:text|blob)|json|geometry)\\b/i;\nconst FRACTIONAL_SECONDS = /^(?:datetime|timestamp|time)\\((\\d)\\)$/i;\nfunction refusedDefault(where, why) {\n\tthrow structuredError(\"CONTRACT.DEFAULT_INVALID\", `Column \"${where.table}\".\"${where.column}\" has a default MySQL cannot store: ${why}`, { meta: {\n\t\ttable: where.table,\n\t\tcolumn: where.column\n\t} });\n}\n/** A wire value as the SQL literal MySQL reads for it. */\nfunction mysqlInlineLiteral(wire, where) {\n\tif (wire === null) return \"NULL\";\n\tif (typeof wire === \"boolean\") return wire ? \"1\" : \"0\";\n\tif (typeof wire === \"number\") {\n\t\tif (!Number.isFinite(wire)) return refusedDefault(where, `${wire} is not a finite number`);\n\t\treturn String(wire);\n\t}\n\tif (typeof wire === \"bigint\") return String(wire);\n\tif (typeof wire === \"string\") return quoteLiteral(wire);\n\tif (wire instanceof Date) return quoteLiteral(encodeMysqlDatetime(wire));\n\tif (wire instanceof Uint8Array) return `X'${Buffer.from(wire).toString(\"hex\")}'`;\n\tif (typeof wire === \"object\") return quoteLiteral(JSON.stringify(wire));\n\treturn refusedDefault(where, `a ${typeof wire} has no SQL literal`);\n}\nfunction withinParentheses(columnType, literal) {\n\treturn EXPRESSION_DEFAULT_ONLY.test(columnType.trim()) ? `(${literal})` : literal;\n}\n/**\n* The expression a `now()` default is written as: the current value the column's data type holds, `CURRENT_TIMESTAMP`, `CURRENT_DATE` or `CURRENT_TIME`, with the column's fractional-second precision, which MySQL requires to match. A column of a data type that holds no date or time is refused.\n*/\nfunction nowExpressionFor(columnType, codecLookup, codecRef, where) {\n\tconst dataType = codecRef === void 0 ? void 0 : codecLookup.descriptorFor(codecRef.codecId)?.dataType;\n\tconst current = mysqlCurrentValueFor(dataType);\n\tif (current === void 0) throw structuredError(\"CONTRACT.DEFAULT_INVALID\", `The column \"${where.table}\".\"${where.column}\" has a now() default, but its data type ${dataType} stores no date or time, so there is no current value to write. Remove the default, or give the field a date or time type.`, { meta: {\n\t\ttable: where.table,\n\t\tcolumn: where.column,\n\t\tdataType,\n\t\treason: \"now-default-not-date-or-time\"\n\t} });\n\tconst precision = FRACTIONAL_SECONDS.exec(columnType.trim())?.[1];\n\treturn mysqlNowExpression(current, precision === void 0 ? void 0 : Number(precision));\n}\n/**\n* The `DEFAULT …` clause of a column, or `''` for an `autoincrement()` default, which a column writes as `AUTO_INCREMENT` instead. A literal is read by the column's codec, and a text or blob column's literal is written as an expression, as MySQL requires.\n*/\nasync function renderMysqlColumnDefault(def, columnType, codecLookup, codecRef, where) {\n\tif (def.kind === \"function\") {\n\t\tconst text = def.expression.text;\n\t\tif (text === \"autoincrement()\") return \"\";\n\t\tif (text === \"now()\") return `DEFAULT (${nowExpressionFor(columnType, codecLookup, codecRef, where)})`;\n\t\tif (checkSqlDefaultText(text) !== void 0) throw structuredError(\"CONTRACT.DEFAULT_INVALID\", `Unsafe default expression in contract: \"${text}\". Default expressions must not contain semicolons, SQL comment tokens, dollar-quoting, or subqueries.`, { meta: { expression: text } });\n\t\treturn `DEFAULT (${renderOpaqueSql(def.expression)})`;\n\t}\n\tconst encoded = codecRef === void 0 ? void 0 : await encodeLiteralDefault(codecLookup, codecRef, def.value, where);\n\tif (encoded?.kind === \"sql-null\") return \"DEFAULT NULL\";\n\treturn `DEFAULT ${withinParentheses(columnType, mysqlInlineLiteral(encoded === void 0 ? def.value : encoded.wire, where))}`;\n}\nfunction isAutoincrement(column) {\n\treturn column.default?.kind === \"function\" && column.default.expression.text === \"autoincrement()\";\n}\nasync function renderColumn(column, codecLookup, table) {\n\tconst parts = [quoteIdentifier(column.name), column.type];\n\tif (column.notNull) parts.push(\"NOT NULL\");\n\tif (column.default !== void 0) {\n\t\tconst clause = await renderMysqlColumnDefault(column.default, column.type, codecLookup, column.codecRef, {\n\t\t\ttable,\n\t\t\tcolumn: column.name\n\t\t});\n\t\tif (clause.length > 0) parts.push(clause);\n\t}\n\tif (isAutoincrement(column)) parts.push(\"AUTO_INCREMENT\");\n\tif (column.primaryKey) parts.push(\"PRIMARY KEY\");\n\treturn parts.join(\" \");\n}\nfunction columnList(columns) {\n\treturn columns.map(quoteIdentifier).join(\", \");\n}\nfunction named(name, body) {\n\treturn name === void 0 ? body : `CONSTRAINT ${quoteIdentifier(name)} ${body}`;\n}\nfunction renderConstraint(constraint) {\n\tswitch (constraint.kind) {\n\t\tcase \"primary-key\": return named(constraint.name, `PRIMARY KEY (${columnList(constraint.columns)})`);\n\t\tcase \"unique\": return named(constraint.name, `UNIQUE (${columnList(constraint.columns)})`);\n\t\tcase \"foreign-key\": {\n\t\t\tconst actions = [constraint.onDelete === void 0 ? void 0 : `ON DELETE ${REFERENTIAL_ACTION_SQL[constraint.onDelete]}`, constraint.onUpdate === void 0 ? void 0 : `ON UPDATE ${REFERENTIAL_ACTION_SQL[constraint.onUpdate]}`].filter((action) => action !== void 0);\n\t\t\treturn named(constraint.name, [`FOREIGN KEY (${columnList(constraint.columns)}) REFERENCES ${quoteIdentifier(constraint.refTable)} (${columnList(constraint.refColumns)})`, ...actions].join(\" \"));\n\t\t}\n\t\tcase \"check-expression\": throw structuredError(\"CONTRACT.CONSTRAINT_INVALID\", `The MySQL target does not write CHECK constraints yet (constraint \"${constraint.name}\").`, { meta: { constraintName: constraint.name } });\n\t}\n}\n/** The `CREATE TABLE` statement of a MySQL DDL node. */\nasync function renderMysqlCreateTable(node, codecLookup) {\n\tconst definitions = [...await Promise.all(node.columns.map((column) => renderColumn(column, codecLookup, node.table))), ...(node.constraints ?? []).map(renderConstraint)];\n\treturn {\n\t\tsql: `CREATE TABLE ${node.ifNotExists === true ? \"IF NOT EXISTS \" : \"\"}${quoteIdentifier(node.table)} (\\n ${definitions.join(\",\\n \")}\\n)`,\n\t\tparams: []\n\t};\n}\n//#endregion\n//#region src/core/migrations/declared-indexes.ts\nfunction isLoose(value) {\n\treturn typeof value === \"object\" && value !== null;\n}\nfunction child(value, key) {\n\tconst found = isLoose(value) ? value[key] : void 0;\n\treturn isLoose(found) ? found : void 0;\n}\nfunction tableIndexKey(tableName, indexName) {\n\treturn JSON.stringify([tableName, indexName]);\n}\n/** The indexes the contract handed to introspection declares, read from every contract space it holds. */\nfunction declaredIndexes(contract) {\n\tconst contracts = isLoose(contract) && Array.isArray(contract[\"contracts\"]) ? contract[\"contracts\"] : [contract];\n\tconst declared = /* @__PURE__ */ new Set();\n\tconst declaredUnique = /* @__PURE__ */ new Set();\n\tfor (const space of contracts) for (const namespace of Object.values(child(child(space, \"storage\"), \"namespaces\") ?? {})) for (const [tableName, table] of Object.entries(child(child(namespace, \"entries\"), \"table\") ?? {})) {\n\t\tconst indexes = isLoose(table) ? table[\"indexes\"] : void 0;\n\t\tfor (const index of Array.isArray(indexes) ? indexes : []) {\n\t\t\tif (!isLoose(index) || typeof index[\"name\"] !== \"string\") continue;\n\t\t\tconst key = tableIndexKey(tableName, index[\"name\"]);\n\t\t\tdeclared.add(key);\n\t\t\tif (index[\"unique\"] === true) declaredUnique.add(key);\n\t\t}\n\t}\n\treturn {\n\t\tdeclaresIndex: (tableName, indexName) => declared.has(tableIndexKey(tableName, indexName)),\n\t\tdeclaresUniqueIndex: (tableName, indexName) => declaredUnique.has(tableIndexKey(tableName, indexName))\n\t};\n}\n//#endregion\n//#region src/core/migrations/introspection.ts\nconst NOTHING_DECLARED = {\n\tdeclaresIndex: () => false,\n\tdeclaresUniqueIndex: () => false\n};\nconst PRIMARY_INDEX = \"PRIMARY\";\nconst REFERENTIAL_ACTIONS = {\n\tRESTRICT: \"restrict\",\n\tCASCADE: \"cascade\",\n\t\"SET NULL\": \"setNull\",\n\t\"SET DEFAULT\": \"setDefault\"\n};\n/** A rule `REFERENTIAL_CONSTRAINTS` reports, with `NO ACTION`, MySQL's default, as no action at all. */\nfunction referentialAction(rule) {\n\tconst normalized = rule.toUpperCase();\n\tif (normalized === \"NO ACTION\") return void 0;\n\tconst action = REFERENTIAL_ACTIONS[normalized];\n\tif (action === void 0) throw structuredError(\"CONTRACT.INTROSPECTION_UNSUPPORTED\", `Unknown MySQL referential action rule: \"${rule}\". Expected one of: NO ACTION, RESTRICT, CASCADE, SET NULL, SET DEFAULT.`, { meta: { rule } });\n\treturn action;\n}\nfunction tableDependsOn(tableName) {\n\treturn [{\n\t\tnodeKind: RelationalSchemaNodeKind.schema,\n\t\tid: \"database\"\n\t}, {\n\t\tnodeKind: RelationalSchemaNodeKind.table,\n\t\tid: tableName\n\t}];\n}\nfunction columnDependsOn(tableName, columns) {\n\treturn columns.map((column) => [...tableDependsOn(tableName), {\n\t\tnodeKind: RelationalSchemaNodeKind.column,\n\t\tid: `column:${column}`\n\t}]);\n}\nfunction groupBy(rows, key) {\n\tconst groups = /* @__PURE__ */ new Map();\n\tfor (const row of rows) {\n\t\tconst group = groups.get(key(row));\n\t\tif (group === void 0) groups.set(key(row), [row]);\n\t\telse group.push(row);\n\t}\n\treturn groups;\n}\nfunction byPosition(position) {\n\treturn (a, b) => Number(position(a)) - Number(position(b));\n}\nasync function columnOf(row, dataTypes, readLiteralDefault) {\n\tconst reported = readMysqlDefault(row.column_default, row.extra);\n\tconst readDefault = reported === void 0 ? {} : reported.kind === \"function\" ? { resolvedDefault: reported } : await readLiteralDefault(row.table_name, row.column_name, reported.literal.body);\n\tconst reportedType = {\n\t\ttext: row.column_type,\n\t\tkind: void 0,\n\t\tschema: void 0,\n\t\tname: void 0\n\t};\n\treturn {\n\t\tname: row.column_name,\n\t\ttypeText: row.column_type,\n\t\tnullable: row.is_nullable === \"YES\",\n\t\t...ifDefined(\"default\", row.column_default ?? void 0),\n\t\t...readDefault,\n\t\treportedType,\n\t\t...resolveIntrospectedColumnType(reportedType, dataTypes)\n\t};\n}\nfunction indexesOf(rows) {\n\treturn [...groupBy(rows, (row) => row.index_name).entries()].map(([name, parts]) => {\n\t\tconst ordered = [...parts].sort(byPosition((part) => part.seq_in_index));\n\t\tconst expressions = ordered.flatMap((part) => part.expression === null ? [] : [part.expression]);\n\t\treturn {\n\t\t\tname,\n\t\t\tunique: ordered[0]?.non_unique === \"0\",\n\t\t\tcolumns: ordered.flatMap((part) => part.column_name === null ? [] : [part.column_name]),\n\t\t\texpression: expressions.length === 0 ? void 0 : expressions.join(\", \")\n\t\t};\n\t});\n}\nfunction sameColumns(a, b) {\n\treturn a.length === b.length && a.every((column, index) => column === b[index]);\n}\nfunction foreignKeysOf(tableName, rows) {\n\treturn [...groupBy(rows, (row) => row.constraint_name).entries()].sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0).map(([name, parts]) => {\n\t\tconst ordered = [...parts].sort(byPosition((part) => part.ordinal_position));\n\t\tconst [first] = ordered;\n\t\tconst columns = ordered.map((part) => part.column_name);\n\t\tconst referencedTable = first?.referenced_table_name ?? \"\";\n\t\tconst referencedSchema = first?.referenced_table_schema ?? void 0;\n\t\treturn {\n\t\t\tcolumns,\n\t\t\treferencedTable,\n\t\t\treferencedColumns: ordered.map((part) => part.referenced_column_name),\n\t\t\t...ifDefined(\"referencedSchema\", referencedSchema),\n\t\t\tname,\n\t\t\t...ifDefined(\"onDelete\", first === void 0 ? void 0 : referentialAction(first.delete_rule)),\n\t\t\t...ifDefined(\"onUpdate\", first === void 0 ? void 0 : referentialAction(first.update_rule)),\n\t\t\tdependsOn: [...referencedSchema === void 0 ? [tableDependsOn(referencedTable)] : [], ...columnDependsOn(tableName, columns)]\n\t\t};\n\t});\n}\n/**\n* The index InnoDB creates for a foreign key that no index already serves: it carries the key's name and exactly the key's columns. Introspection leaves it out, because the contract describes the key, not that index. An explicit index can look the same, so one the contract declares is kept.\n*/\nfunction isForeignKeyIndex(tableName, index, foreignKeys, declared) {\n\tif (declared.declaresIndex(tableName, index.name)) return false;\n\treturn foreignKeys.some((fk) => fk.name === index.name && index.expression === void 0 && sameColumns(fk.columns, index.columns));\n}\nasync function tableOf(tableName, rows, dataTypes, readLiteralDefault, declared) {\n\tconst columns = {};\n\tfor (const row of [...rows.columns].sort(byPosition((column) => column.ordinal_position))) columns[row.column_name] = await columnOf(row, dataTypes, readLiteralDefault);\n\tconst foreignKeys = foreignKeysOf(tableName, rows.foreignKeys);\n\tconst indexes = indexesOf(rows.indexes);\n\tconst expressionIndexNames = new Set(indexes.filter((index) => index.expression !== void 0).map((index) => index.name));\n\tconst uniqueConstraintNames = new Set(rows.constraints.filter((constraint) => constraint.constraint_type === \"UNIQUE\" && !expressionIndexNames.has(constraint.constraint_name) && !declared.declaresUniqueIndex(tableName, constraint.constraint_name)).map((constraint) => constraint.constraint_name));\n\tconst primary = indexes.find((index) => index.name === PRIMARY_INDEX);\n\tconst primaryKey = primary === void 0 ? void 0 : {\n\t\tcolumns: primary.columns,\n\t\tdependsOn: columnDependsOn(tableName, primary.columns)\n\t};\n\tconst uniques = indexes.filter((index) => uniqueConstraintNames.has(index.name)).map((index) => ({\n\t\tcolumns: index.columns,\n\t\tname: index.name,\n\t\tdependsOn: columnDependsOn(tableName, index.columns)\n\t}));\n\tconst plainIndexes = indexes.filter((index) => index.name !== PRIMARY_INDEX && !uniqueConstraintNames.has(index.name) && !isForeignKeyIndex(tableName, index, foreignKeys, declared)).map((index) => {\n\t\tconst base = {\n\t\t\tnaming: {\n\t\t\t\tkind: \"exact\",\n\t\t\t\tname: index.name\n\t\t\t},\n\t\t\twhere: void 0,\n\t\t\tunique: index.unique,\n\t\t\tpartial: false,\n\t\t\ttype: void 0,\n\t\t\toptions: void 0,\n\t\t\tannotations: void 0,\n\t\t\tdependsOn: columnDependsOn(tableName, index.columns)\n\t\t};\n\t\treturn index.expression === void 0 ? {\n\t\t\t...base,\n\t\t\tcolumns: index.columns\n\t\t} : {\n\t\t\t...base,\n\t\t\texpression: index.expression\n\t\t};\n\t});\n\treturn new SqlTableIR({\n\t\tname: tableName,\n\t\tcolumns,\n\t\t...ifDefined(\"primaryKey\", primaryKey),\n\t\tforeignKeys,\n\t\tuniques,\n\t\tindexes: plainIndexes\n\t});\n}\n/**\n* The schema IR of the database the rows describe: one flat tree of its tables. MySQL lists every unique index as a UNIQUE constraint, so one is reported as a unique constraint unless the contract declares a unique index of that name on the table, or it indexes an expression. The index InnoDB creates for a foreign key is left out, unless the contract declares an index of that name on the table.\n*/\nasync function buildMysqlSchemaIR(rows, dataTypes, readLiteralDefault, declared = NOTHING_DECLARED) {\n\tconst columnsByTable = groupBy(rows.columns, (row) => row.table_name);\n\tconst indexesByTable = groupBy(rows.indexes, (row) => row.table_name);\n\tconst constraintsByTable = groupBy(rows.constraints, (row) => row.table_name);\n\tconst foreignKeysByTable = groupBy(rows.foreignKeys, (row) => row.table_name);\n\tconst tables = {};\n\tfor (const tableName of rows.tables) tables[tableName] = await tableOf(tableName, {\n\t\tcolumns: columnsByTable.get(tableName) ?? [],\n\t\tindexes: indexesByTable.get(tableName) ?? [],\n\t\tconstraints: constraintsByTable.get(tableName) ?? [],\n\t\tforeignKeys: foreignKeysByTable.get(tableName) ?? []\n\t}, dataTypes, readLiteralDefault, declared);\n\treturn new SqlSchemaIR({ tables });\n}\n//#endregion\n//#region src/core/migrations/marker-ledger.ts\nconst LEDGER_COLUMNS = \"space, migration_name, migration_hash, origin_core_hash, destination_core_hash, operations, created_at\";\nfunction operationCount(operations) {\n\tconst parsed = typeof operations === \"string\" ? parseOperations(operations) : operations;\n\treturn Array.isArray(parsed) ? parsed.length : 0;\n}\nfunction parseOperations(text) {\n\ttry {\n\t\treturn JSON.parse(text);\n\t} catch {\n\t\treturn;\n\t}\n}\nfunction text(row, column) {\n\tconst value = row[column];\n\treturn typeof value === \"string\" ? value : String(value);\n}\n/** The ledger's entries for `space`, or for every space, in the order they were applied. */\nasync function readLedgerEntries(driver, space) {\n\tif (!await tableExists(driver, LEDGER_TABLE_NAME)) return [];\n\tconst select = `SELECT ${LEDGER_COLUMNS} FROM ${quoteIdentifier(LEDGER_TABLE_NAME)}`;\n\tconst { rows } = space === void 0 ? await driver.query(`${select} ORDER BY id`) : await driver.query(`${select} WHERE space = ? ORDER BY id`, [space]);\n\treturn rows.map((row) => {\n\t\tconst origin = row[\"origin_core_hash\"];\n\t\treturn {\n\t\t\tspace: text(row, \"space\"),\n\t\t\tmigrationName: text(row, \"migration_name\"),\n\t\t\tmigrationHash: text(row, \"migration_hash\"),\n\t\t\tfrom: ledgerOriginFromStored(typeof origin === \"string\" ? origin : null),\n\t\t\tto: text(row, \"destination_core_hash\"),\n\t\t\tappliedAt: decodeMysqlDatetime(text(row, \"created_at\")),\n\t\t\toperationCount: operationCount(row[\"operations\"])\n\t\t};\n\t});\n}\n/** Every column of the marker row except its key, `space`, with what both the insert and the upsert's update write to it. */\nconst MARKER_COLUMNS = [\n\t[\"core_hash\", (destination) => destination.storageHash],\n\t[\"profile_hash\", (destination) => destination.profileHash],\n\t[\"contract_json\", \"NULL\"],\n\t[\"canonical_version\", \"NULL\"],\n\t[\"updated_at\", \"CURRENT_TIMESTAMP(3)\"],\n\t[\"app_tag\", \"NULL\"],\n\t[\"meta\", \"'{}'\"],\n\t[\"invariants\", (destination) => JSON.stringify(destination.invariants ?? [])]\n];\nfunction markerValueSql(value) {\n\treturn typeof value === \"string\" ? value : \"?\";\n}\nconst MARKER_INSERT = `INSERT INTO ${quoteIdentifier(MARKER_TABLE_NAME)} (space, ${MARKER_COLUMNS.map(([column]) => column).join(\", \")}) VALUES (?, ${MARKER_COLUMNS.map(([, value]) => markerValueSql(value)).join(\", \")})`;\nconst MARKER_UPDATE = MARKER_COLUMNS.map(([column, value]) => `${column} = ${markerValueSql(value)}`).join(\", \");\nfunction markerColumnParams(destination) {\n\treturn MARKER_COLUMNS.flatMap(([, value]) => typeof value === \"string\" ? [] : [value(destination)]);\n}\n/** Inserts the marker row of `space`; fails when the space already has one. */\nasync function insertMarkerRow(driver, space, destination) {\n\tawait driver.query(MARKER_INSERT, [space, ...markerColumnParams(destination)]);\n}\n/** Writes the marker row of `space`, replacing the row the space already has. The update binds the values again instead of naming a row alias, which MariaDB does not accept, or `VALUES()`, which MySQL deprecates. */\nasync function upsertMarkerRow(driver, space, destination) {\n\tconst params = markerColumnParams(destination);\n\tawait driver.query(`${MARKER_INSERT} ON DUPLICATE KEY UPDATE ${MARKER_UPDATE}`, [\n\t\tspace,\n\t\t...params,\n\t\t...params\n\t]);\n}\nfunction invariantsOf(text) {\n\tconst parsed = parseJsonColumn(\"invariants\", text);\n\treturn Array.isArray(parsed) ? parsed.filter((item) => typeof item === \"string\") : [];\n}\n/**\n* Advances the marker row of `space` from `expectedFrom` to `destination`, and says whether it did. MySQL has no `RETURNING`, so the row is read and locked with `FOR UPDATE` first, inside the transaction the caller holds, and written only when it still holds `expectedFrom`. Supplied invariants are merged with the stored ones.\n*/\nasync function compareAndSwapMarkerRow(driver, space, expectedFrom, destination) {\n\tconst { rows } = await driver.query(`SELECT core_hash, invariants FROM ${quoteIdentifier(MARKER_TABLE_NAME)} WHERE space = ? FOR UPDATE`, [space]);\n\tconst [row] = rows;\n\tif (row === void 0 || row[\"core_hash\"] !== expectedFrom) return false;\n\tconst invariants = destination.invariants === void 0 ? void 0 : [.../* @__PURE__ */ new Set([...invariantsOf(row[\"invariants\"]), ...destination.invariants])].sort();\n\tawait driver.query(`UPDATE ${quoteIdentifier(MARKER_TABLE_NAME)} SET core_hash = ?, profile_hash = ?, updated_at = CURRENT_TIMESTAMP(3)${invariants === void 0 ? \"\" : \", invariants = ?\"} WHERE space = ? AND core_hash = ?`, [\n\t\tdestination.storageHash,\n\t\tdestination.profileHash,\n\t\t...invariants === void 0 ? [] : [JSON.stringify(invariants)],\n\t\tspace,\n\t\texpectedFrom\n\t]);\n\treturn true;\n}\n/** Appends a ledger entry for `space`. */\nasync function insertLedgerRow(driver, space, entry) {\n\tawait driver.query(`INSERT INTO ${quoteIdentifier(LEDGER_TABLE_NAME)} (space, migration_name, migration_hash, origin_core_hash, destination_core_hash, operations) VALUES (?, ?, ?, ?, ?, ?)`, [\n\t\tspace,\n\t\tentry.migrationName,\n\t\tentry.migrationHash,\n\t\tentry.from,\n\t\tentry.to,\n\t\tJSON.stringify(entry.operations)\n\t]);\n}\n//#endregion\n//#region src/core/migrations/control-adapter.ts\n/** A DDL node MySQL does not build, such as one another target's visitor accepts. */\nfunction unsupportedDdl(ast) {\n\treturn structuredError(\"RUNTIME.DDL_UNSUPPORTED\", `The MySQL control adapter cannot lower the DDL node \"${ast.kind}\".`, { meta: {\n\t\tsurface: \"control-adapter\",\n\t\tkind: ast.kind\n\t} });\n}\n/**\n* The MySQL control adapter, for MySQL or a target that extends it. It introspects the connection's database from `information_schema`, creates, reads and writes the marker and ledger tables, takes the marker lock, and runs work in a transaction. Query lowering refuses with `RUNTIME.AST_UNSUPPORTED`.\n*/\nvar MysqlControlAdapter = class {\n\tcodecRegistry;\n\tdeclaredDataTypes;\n\ttargetId;\n\treadCatalog;\n\tfamilyId = \"sql\";\n\tmarkerLocation = MARKER_TABLE_NAME;\n\t/** `declaredDataTypes` are the stack's data types, which introspection resolves each column's reported type over. */\n\tconstructor(codecRegistry, declaredDataTypes, targetId, readCatalog) {\n\t\tthis.codecRegistry = codecRegistry;\n\t\tthis.declaredDataTypes = declaredDataTypes;\n\t\tthis.targetId = targetId;\n\t\tthis.readCatalog = readCatalog;\n\t}\n\tbootstrapControlTableQueries() {\n\t\treturn buildControlTableBootstrapQueries();\n\t}\n\tbootstrapSignMarkerQueries() {\n\t\treturn buildSignMarkerBootstrapQueries();\n\t}\n\tlower(ast) {\n\t\tif (isDdlNode(ast)) throw structuredError(\"RUNTIME.DDL_UNSUPPORTED\", \"lower() cannot lower DDL: DDL default literals require inline codec encoding, which is async. Use lowerToExecuteRequest().\", { meta: { surface: \"control-adapter\" } });\n\t\tthrow mysqlQueryNotYetSupported(\"Lowering queries\");\n\t}\n\tasync lowerToExecuteRequest(ast) {\n\t\tif (!isDdlNode(ast)) throw mysqlQueryNotYetSupported(\"Lowering queries\");\n\t\tif (typeof ast.accept !== \"function\") throw unsupportedDdl(ast);\n\t\treturn ast.accept(new Proxy({ createTable: (node) => renderMysqlCreateTable(node, this.codecRegistry) }, { get: (target, method) => Reflect.get(target, method) ?? (() => Promise.reject(unsupportedDdl(ast))) }));\n\t}\n\tasync renderColumnDefault(column, table) {\n\t\tif (column.default === void 0) return \"\";\n\t\treturn renderMysqlColumnDefault(column.default, column.type, this.codecRegistry, column.codecRef, {\n\t\t\ttable,\n\t\t\tcolumn: column.name\n\t\t});\n\t}\n\tasync readMarker(driver, space) {\n\t\tconst result = await readMarkerResult(driver, space);\n\t\treturn result.kind === \"present\" ? result.record : null;\n\t}\n\tasync readAllMarkers(driver) {\n\t\treturn withMarkerReadErrorHandling(async () => {\n\t\t\tconst markers = /* @__PURE__ */ new Map();\n\t\t\tfor (const row of await readMarkerRows(driver, void 0) ?? []) {\n\t\t\t\tconst space = String(row[\"space\"]);\n\t\t\t\tmarkers.set(space, parseMarkerRowSafely(row, () => decodeMysqlMarkerRow(row), {\n\t\t\t\t\tspace,\n\t\t\t\t\tmarkerLocation: MARKER_TABLE_NAME\n\t\t\t\t}));\n\t\t\t}\n\t\t\treturn markers;\n\t\t}, {\n\t\t\tspace: APP_SPACE_ID,\n\t\t\tmarkerLocation: MARKER_TABLE_NAME\n\t\t});\n\t}\n\tasync readLedger(driver, space) {\n\t\treturn withMarkerReadErrorHandling(() => readLedgerEntries(driver, space), {\n\t\t\tspace: space ?? \"*\",\n\t\t\tmarkerLocation: LEDGER_TABLE_NAME\n\t\t});\n\t}\n\tasync insertMarker(driver, space, destination) {\n\t\tawait insertMarkerRow(driver, space, destination);\n\t}\n\tasync initMarker(driver, space, destination) {\n\t\tawait upsertMarkerRow(driver, space, destination);\n\t}\n\tasync updateMarker(driver, space, expectedFrom, destination) {\n\t\treturn compareAndSwapMarkerRow(driver, space, expectedFrom, destination);\n\t}\n\tasync writeLedgerEntry(driver, space, entry) {\n\t\tawait insertLedgerRow(driver, space, entry);\n\t}\n\t/** Takes no lock: MySQL's `GET_LOCK` lives for the session, not the transaction, so {@link holdMarkerLock} takes it around the transaction instead. */\n\tasync lockMarker(_driver) {}\n\t/** Takes `GET_LOCK` before `work` runs and releases it when `work` ends, so `db sign` creates the marker table, whose DDL would end a transaction, under the lock. */\n\tasync holdMarkerLock(driver, work) {\n\t\treturn withMarkerLock(driver, work);\n\t}\n\tasync withTransaction(driver, fn) {\n\t\treturn this.#inTransaction(driver, fn);\n\t}\n\tasync #inTransaction(driver, fn) {\n\t\tawait driver.query(\"START TRANSACTION\");\n\t\tlet result;\n\t\ttry {\n\t\t\tresult = await fn();\n\t\t} catch (error) {\n\t\t\ttry {\n\t\t\t\tawait driver.query(\"ROLLBACK\");\n\t\t\t} catch (rollbackError) {\n\t\t\t\tif (error instanceof Error && error.cause === void 0) error.cause = rollbackError;\n\t\t\t}\n\t\t\tthrow error;\n\t\t}\n\t\tawait driver.query(\"COMMIT\");\n\t\treturn result;\n\t}\n\tasync introspect(driver, contract) {\n\t\tconst columns = contractColumns(contract);\n\t\treturn buildMysqlSchemaIR(await this.readCatalog(driver), this.declaredDataTypes, async (tableName, columnName, rawDefault) => {\n\t\t\tconst column = columns.columnOf(void 0, tableName, columnName);\n\t\t\tconst codec = column === void 0 ? void 0 : codecForRef(this.codecRegistry, column.codecRef);\n\t\t\tif (codec === void 0) return {};\n\t\t\treturn readColumnDefault(codec, {\n\t\t\t\tliteral: {\n\t\t\t\t\tkind: \"value\",\n\t\t\t\t\tbody: rawDefault\n\t\t\t\t},\n\t\t\t\traw: rawDefault\n\t\t\t}, void 0);\n\t\t}, declaredIndexes(contract));\n\t}\n};\n/** The control adapter of MySQL, or of a target that extends it, for the stack the adapter descriptor is given. */\nfunction createMysqlControlAdapter(stack, options) {\n\treturn new MysqlControlAdapter(assembleMysqlCodecRegistry(stack.target, stack.extensions), stack.declaredDataTypes.map(({ type }) => type), stack.target.targetId, options.readCatalog);\n}\nconst MYSQL_CATALOG_QUERIES = {\n\ttables: `SELECT TABLE_NAME AS table_name\n FROM information_schema.TABLES\n WHERE TABLE_SCHEMA = DATABASE() AND TABLE_TYPE = 'BASE TABLE'\n ORDER BY TABLE_NAME`,\n\tcolumns: `SELECT TABLE_NAME AS table_name, COLUMN_NAME AS column_name,\n ORDINAL_POSITION AS ordinal_position, COLUMN_DEFAULT AS column_default,\n IS_NULLABLE AS is_nullable, COLUMN_TYPE AS column_type, EXTRA AS extra\n FROM information_schema.COLUMNS\n WHERE TABLE_SCHEMA = DATABASE()\n ORDER BY TABLE_NAME, ORDINAL_POSITION`,\n\tindexes: `SELECT TABLE_NAME AS table_name, INDEX_NAME AS index_name,\n NON_UNIQUE AS non_unique, SEQ_IN_INDEX AS seq_in_index,\n COLUMN_NAME AS column_name, EXPRESSION AS expression\n FROM information_schema.STATISTICS\n WHERE TABLE_SCHEMA = DATABASE()\n ORDER BY TABLE_NAME, INDEX_NAME, SEQ_IN_INDEX`,\n\tconstraints: `SELECT TABLE_NAME AS table_name, CONSTRAINT_NAME AS constraint_name,\n CONSTRAINT_TYPE AS constraint_type\n FROM information_schema.TABLE_CONSTRAINTS\n WHERE TABLE_SCHEMA = DATABASE()`,\n\tforeignKeys: `SELECT k.TABLE_NAME AS table_name, k.CONSTRAINT_NAME AS constraint_name,\n k.COLUMN_NAME AS column_name, k.ORDINAL_POSITION AS ordinal_position,\n NULLIF(k.REFERENCED_TABLE_SCHEMA, k.TABLE_SCHEMA) AS referenced_table_schema,\n k.REFERENCED_TABLE_NAME AS referenced_table_name,\n k.REFERENCED_COLUMN_NAME AS referenced_column_name,\n r.UPDATE_RULE AS update_rule, r.DELETE_RULE AS delete_rule\n FROM information_schema.KEY_COLUMN_USAGE k\n JOIN information_schema.REFERENTIAL_CONSTRAINTS r\n ON r.CONSTRAINT_SCHEMA = k.CONSTRAINT_SCHEMA\n AND r.TABLE_NAME = k.TABLE_NAME\n AND r.CONSTRAINT_NAME = k.CONSTRAINT_NAME\n WHERE k.TABLE_SCHEMA = DATABASE() AND k.REFERENCED_TABLE_NAME IS NOT NULL\n ORDER BY k.TABLE_NAME, k.CONSTRAINT_NAME, k.ORDINAL_POSITION`\n};\n/** Reads the catalog rows of the connection's database, leaving out the runner's control tables. */\nasync function readMysqlCatalog(driver, queries = MYSQL_CATALOG_QUERIES) {\n\tconst keep = (rows) => rows.filter((row) => !CONTROL_TABLE_NAMES.has(row.table_name));\n\tconst tables = await driver.query(queries.tables);\n\tconst columns = await driver.query(queries.columns);\n\tconst indexes = await driver.query(queries.indexes);\n\tconst constraints = await driver.query(queries.constraints);\n\tconst foreignKeys = await driver.query(queries.foreignKeys);\n\treturn {\n\t\ttables: keep(tables.rows).map((row) => row.table_name),\n\t\tcolumns: keep(columns.rows),\n\t\tindexes: keep(indexes.rows),\n\t\tconstraints: keep(constraints.rows),\n\t\tforeignKeys: keep(foreignKeys.rows)\n\t};\n}\n//#endregion\n//#region src/exports/control.ts\nconst mysqlAdapterDescriptor = {\n\t...mysqlAdapterDescriptorMeta,\n\tcontrolMutationDefaults: {\n\t\tdefaultFunctionRegistry: new Map(Object.entries(sqlDefaultFunctions())),\n\t\tgeneratorDescriptors: []\n\t},\n\tcreate(stack) {\n\t\treturn createMysqlControlAdapter(stack, { readCatalog: readMysqlCatalog });\n\t}\n};\n//#endregion\nexport { MYSQL_CATALOG_QUERIES, buildMysqlSchemaIR, createMysqlControlAdapter, mysqlAdapterDescriptor as default, readMysqlCatalog };\n\n//# sourceMappingURL=control.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAsBA,MAAM,0BAA0B;AAChC,MAAM,qBAAqB;AAC3B,SAAS,eAAe,OAAO,KAAK;CACnC,MAAM,gBAAgB,4BAA4B,WAAW,MAAM,MAAM,KAAK,MAAM,OAAO,sCAAsC,OAAO,EAAE,MAAM;EAC/I,OAAO,MAAM;EACb,QAAQ,MAAM;CACf,EAAE,CAAC;AACJ;;AAEA,SAAS,mBAAmB,MAAM,OAAO;CACxC,IAAI,SAAS,MAAM,OAAO;CAC1B,IAAI,OAAO,SAAS,WAAW,OAAO,OAAO,MAAM;CACnD,IAAI,OAAO,SAAS,UAAU;E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U;EACrD,SAAS,KAAK,QAAQ,IAAI;EAC1B,SAAS,KAAK,QAAQ,IAAI;EAC1B,aAAa,KAAK,YAAY,IAAI;EAClC,aAAa,KAAK,YAAY,IAAI;CACnC;AACD;AAGA,MAAM,yBAAyB;CAC9B,GAAG;CACH,yBAAyB;EACxB,yBAAyB,IAAI,IAAI,OAAO,QAAQ,oBAAoB,CAAC,CAAC;EACtE,sBAAsB,CAAC;CACxB;CACA,OAAO,OAAO;EACb,OAAO,0BAA0B,OAAO,EAAE,aAAa,iBAAiB,CAAC;CAC1E;AACD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"runner-BIjAWX-E-BgTmrD8f.mjs","names":["#written","#migrationModule","#calls","#meta","#spaceId","#snapshotsImportPath","#destination","#lowerer","#operationsCache","#target","#planSql","#applySpaces","#applySpace","#checkDestination","#checkPolicy","#ensureControlTables","#checkOrigin","#applyOperations","#writeMarkerAndLedger","#allHold","#runChecks","#runSteps","#writeLedger"],"sources":["../../../../3-targets/mysql/1-mysql/1-target/dist/runner-BIjAWX-E.mjs"],"sourcesContent":["import { s as mysqlError } from \"./errors-Cng94tYg.mjs\";\nimport { n as quoteIdentifier } from \"./sql-utils-Cmv_TVa8.mjs\";\nimport { t as CONTROL_TABLE_NAMES } from \"./control-tables-CcQ77JE7.mjs\";\nimport { t as createTable } from \"./ddl-DDmMHyA_.mjs\";\nimport { t as mysqlResolveDefault } from \"./default-normalizer-C8pc7SbL.mjs\";\nimport { i as withMarkerLock } from \"./marker-lock-Bwew7cAs.mjs\";\nimport { dataTypeParams } from \"@internal/framework-components/codec\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { InternalError, isInternalError } from \"@internal/utils/internal-error\";\nimport { isStructuredError } from \"@internal/utils/structured-error\";\nimport { DdlColumn, FunctionColumnDefault, LiteralColumnDefault, PrimaryKeyConstraint, UniqueConstraint, opaqueSql } from \"@internal/sql-relational-core/ast\";\nimport { isSqlDataType, renderSqlTypeName } from \"@internal/sql-contract/data-type\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { contractSnapshotJsonSpecifier, contractSnapshotTypesSpecifier, diffSchemas, expectAbsent, expectPresent, failedPostcheckWhy, failedPrecheckWhy, issueOutcome, migrationRunnerFailure, orderIssuesByDependencies, schemaCheckWhy, withDatabaseUnchanged, withFailingSpace } from \"@internal/framework-components/control\";\nimport { NO_RENAMED_ORIGINS, contractToSchemaIR, createSqlTextSources, plannerFailure, runnerFailure, runnerSuccess, sqlTypeLookupsOf, subjectsOfCalls } from \"@internal/family-sql/control\";\nimport { RelationalSchemaNodeKind, SqlSchemaIR, sqlColumnTypesEqual } from \"@internal/sql-schema-ir/types\";\nimport { UNBOUND_NAMESPACE_ID, entityAt } from \"@internal/framework-components/ir\";\nimport { TsExpression, jsonToTsSource, renderImports } from \"@internal/ts-render\";\nimport { REFERENTIAL_ACTION_SQL } from \"@internal/sql-contract/referential-action-sql\";\nimport { notOk, ok, okVoid } from \"@internal/utils/result\";\nimport { Migration } from \"@internal/family-sql/migration\";\nimport { isThenable } from \"@internal/utils/promise\";\nimport { keepInternalSpecifiers, resolveRequirementSpecifiers } from \"@internal/framework-components/emission\";\nimport { detectScaffoldRuntime, shebangLineFor } from \"@internal/migration-tools/migration-ts\";\n//#region src/core/migrations/diff-database-schema.ts\n/**\n* The schema IR a contract describes on MySQL: one flat tree of tables, each column typed by the data type its codec represents. A MySQL database holds no schemas, so foreign keys name no referenced schema, as introspection reports them.\n*/\nfunction mysqlContractToSchema(contract, types) {\n\treturn contractToSchemaIR(contract, {\n\t\tannotationNamespace: \"mysql\",\n\t\tresolveDefault: mysqlResolveDefault,\n\t\tdataTypeLookup: types.dataTypeLookup,\n\t\tcodecLookup: types.codecLookup\n\t});\n}\n/** The control policy of the table an issue is about. The tree is flat, so the table's name is the second segment of the issue's path. */\nfunction resolveControlPolicy(issue, contract) {\n\tconst tableName = issue.path[1];\n\tif (tableName === void 0) return void 0;\n\tfor (const namespaceId of Object.keys(contract.storage.namespaces)) {\n\t\tconst table = entityAt(contract.storage, {\n\t\t\tnamespaceId,\n\t\t\tentityKind: \"table\",\n\t\t\tentityName: tableName\n\t\t});\n\t\tif (table !== void 0) return table.control;\n\t}\n}\n/** The full-tree diff `db verify` derives its verdict from: the contract's tree against the one introspection built. */\nfunction diffMysqlSchema(input) {\n\tif (!(input.schema instanceof SqlSchemaIR)) throw mysqlError(\"CONTRACT.TARGET_MISMATCH\", \"The MySQL schema diff received a schema tree that MySQL introspection did not build.\");\n\tconst expected = mysqlContractToSchema(input.contract, sqlTypeLookupsOf(input.frameworkComponents));\n\tconst actual = input.schema;\n\tconst namespacesWithTables = Object.values(input.contract.storage.namespaces).filter((ns) => Object.keys(ns.entries.table ?? {}).length > 0);\n\treturn {\n\t\tissues: diffSchemas(expected, actual),\n\t\tresolveControlPolicy: (issue) => resolveControlPolicy(issue, input.contract),\n\t\tnamespacePairs: namespacesWithTables.map(() => ({ actual }))\n\t};\n}\n//#endregion\n//#region src/core/migrations/operations.ts\nfunction step(description, sql, params, expectation) {\n\treturn {\n\t\tdescription,\n\t\tsql,\n\t\t...ifDefined(\"params\", params),\n\t\t...ifDefined(\"expectation\", expectation)\n\t};\n}\nconst IN_DATABASE = \"TABLE_SCHEMA = DATABASE()\";\nfunction count(from, where, params) {\n\treturn {\n\t\tsql: `SELECT COUNT(*) FROM information_schema.${from} WHERE ${IN_DATABASE} AND ${where}`,\n\t\tparams\n\t};\n}\nfunction present(query) {\n\treturn {\n\t\tsql: `SELECT (${query.sql}) > 0 AS result`,\n\t\tparams: query.params\n\t};\n}\nfunction absent(query) {\n\treturn {\n\t\tsql: `SELECT (${query.sql}) = 0 AS result`,\n\t\tparams: query.params\n\t};\n}\nconst tableQuery = (table) => count(\"TABLES\", \"TABLE_NAME = ?\", [table]);\nconst columnQuery = (table, column) => count(\"COLUMNS\", \"TABLE_NAME = ? AND COLUMN_NAME = ?\", [table, column]);\nconst indexQuery = (table, index) => count(\"STATISTICS\", \"TABLE_NAME = ? AND INDEX_NAME = ?\", [table, index]);\nconst constraintQuery = (table, name, type) => count(\"TABLE_CONSTRAINTS\", \"TABLE_NAME = ? AND CONSTRAINT_NAME = ? AND CONSTRAINT_TYPE = ?\", [\n\ttable,\n\tname,\n\ttype\n]);\n/** A step that holds when `query` finds the object, or finds none, as `holds` says. */\nfunction check(description, query, holds, object) {\n\tconst { sql, params } = holds === \"present\" ? present(query) : absent(query);\n\treturn step(description, sql, params, holds === \"present\" ? expectPresent(object) : expectAbsent(object));\n}\nconst tableChecks = (table) => ({\n\tpresent: (description) => check(description, tableQuery(table), \"present\", `table \"${table}\"`),\n\tabsent: (description) => check(description, tableQuery(table), \"absent\", `table \"${table}\"`)\n});\nconst columnChecks = (table, column) => ({\n\tpresent: (description) => check(description, columnQuery(table, column), \"present\", `column \"${column}\" on \"${table}\"`),\n\tabsent: (description) => check(description, columnQuery(table, column), \"absent\", `column \"${column}\" on \"${table}\"`)\n});\nconst indexChecks = (table, index) => ({\n\tpresent: (description) => check(description, indexQuery(table, index), \"present\", `index \"${index}\" on \"${table}\"`),\n\tabsent: (description) => check(description, indexQuery(table, index), \"absent\", `index \"${index}\" on \"${table}\"`)\n});\nconst constraintChecks = (table, name, type) => {\n\tconst object = `${type === \"UNIQUE\" ? \"unique constraint\" : \"foreign key\"} \"${name}\" on \"${table}\"`;\n\treturn {\n\t\tpresent: (description) => check(description, constraintQuery(table, name, type), \"present\", object),\n\t\tabsent: (description) => check(description, constraintQuery(table, name, type), \"absent\", object)\n\t};\n};\nfunction columnList(columns) {\n\treturn columns.map(quoteIdentifier).join(\", \");\n}\n/** The column definition `ALTER TABLE … ADD COLUMN` writes, with the default the adapter renders through the column's codec. */\nasync function columnDefinitionSql(column, table, lowerer) {\n\tconst defaultClause = await lowerer.renderColumnDefault(column, table);\n\treturn [\n\t\tquoteIdentifier(column.name),\n\t\tcolumn.type,\n\t\t...column.notNull ? [\"NOT NULL\"] : [],\n\t\t...defaultClause.length > 0 ? [defaultClause] : []\n\t].join(\" \");\n}\nfunction foreignKeyActionsSql(actions) {\n\treturn [...actions.onDelete === void 0 ? [] : [` ON DELETE ${REFERENTIAL_ACTION_SQL[actions.onDelete]}`], ...actions.onUpdate === void 0 ? [] : [` ON UPDATE ${REFERENTIAL_ACTION_SQL[actions.onUpdate]}`]].join(\"\");\n}\n/** An operation written out in full in `migration.ts`, such as a table rename made by hand. */\nfunction rawSql(op) {\n\treturn op;\n}\n//#endregion\n//#region src/core/migrations/planner-target-details.ts\nfunction buildTargetDetails(objectType, name, table) {\n\treturn {\n\t\tobjectType,\n\t\tname,\n\t\t...ifDefined(\"table\", table)\n\t};\n}\n//#endregion\n//#region src/core/migrations/op-factory-call.ts\n/** The module every MySQL `migration.ts` imports its base class and helpers from. */\nconst MYSQL_MIGRATION_MODULE = \"@internal/mysql/migration\";\n/** The module call nodes name in their import requirements. `renderCallsToTypeScript` replaces it with the migration module of the target the scaffold is for. */\nconst MIGRATION_MODULE_PLACEHOLDER = MYSQL_MIGRATION_MODULE;\n/** The refusal of a `MysqlMigration` operation that needs the control adapter, on an instance built without a control stack. */\nfunction mysqlMigrationStackMissing(operation) {\n\treturn mysqlError(\"MIGRATION.MYSQL_CONTROL_STACK_MISSING\", `MysqlMigration.${operation} requires a control adapter`, {\n\t\twhy: `MysqlMigration.${operation} was invoked on an instance constructed without a ControlStack, so it cannot render its DDL.`,\n\t\tfix: \"Construct the migration via the migration CLI entrypoint, which assembles a ControlStack from prisma.config.ts, or pass a ControlStack with a MySQL adapter to the migration constructor in test fixtures.\",\n\t\tmeta: { operation }\n\t});\n}\nvar MysqlOpFactoryCallNode = class extends TsExpression {\n\timportRequirements() {\n\t\treturn [];\n\t}\n\tfreeze() {\n\t\tObject.freeze(this);\n\t}\n\tlowererFor(lowerer) {\n\t\tif (lowerer === void 0) throw mysqlMigrationStackMissing(this.factoryName);\n\t\treturn lowerer;\n\t}\n\ttargetIdFor(targetId) {\n\t\tif (targetId === void 0) throw new InternalError(`${this.factoryName}: an operation cannot be built without a target id; pass the id of the target the migration is for.`);\n\t\treturn targetId;\n\t}\n};\n/** Whether `call` is one of this target's calls. */\nfunction isMysqlOpFactoryCall(call) {\n\treturn call instanceof MysqlOpFactoryCallNode;\n}\nfunction renderColumnDefault(def, sql) {\n\treturn def.kind === \"literal\" ? `lit(${jsonToTsSource(def.value)})` : `fn(${sql.source(def.expression.text)})`;\n}\nfunction renderColumn(column, sql) {\n\tconst options = [\n\t\t...column.notNull ? [\"notNull: true\"] : [],\n\t\t...column.default === void 0 ? [] : [`default: ${renderColumnDefault(column.default, sql)}`],\n\t\t...column.codecRef === void 0 ? [] : [`codecRef: ${jsonToTsSource(column.codecRef)}`]\n\t];\n\tconst optionsSource = options.length > 0 ? `, { ${options.join(\", \")} }` : \"\";\n\treturn `col(${jsonToTsSource(column.name)}, ${jsonToTsSource(column.type)}${optionsSource})`;\n}\nfunction renderConstraint(constraint) {\n\tconst named = constraint.name === void 0 ? \"\" : `, { name: ${jsonToTsSource(constraint.name)} }`;\n\tswitch (constraint.kind) {\n\t\tcase \"primary-key\": return `primaryKey(${jsonToTsSource(constraint.columns)}${named})`;\n\t\tcase \"unique\": return `unique(${jsonToTsSource(constraint.columns)}${named})`;\n\t\tcase \"foreign-key\":\n\t\tcase \"check-expression\": throw mysqlError(\"CONTRACT.CONSTRAINT_INVALID\", `The MySQL createTable call writes primary keys and unique constraints only; add ${constraint.kind === \"foreign-key\" ? \"a foreign key with addForeignKey\" : \"no CHECK constraint\"} (constraint \"${constraint.name ?? \"\"}\").`, { meta: { constraintKind: constraint.kind } });\n\t}\n}\nfunction columnImports(columns) {\n\tconst symbols = new Set(columns.length > 0 ? [\"col\"] : []);\n\tfor (const column of columns) {\n\t\tif (column.default?.kind === \"literal\") symbols.add(\"lit\");\n\t\tif (column.default?.kind === \"function\") symbols.add(\"fn\");\n\t}\n\treturn [...symbols].map((symbol) => ({\n\t\tmoduleSpecifier: MIGRATION_MODULE_PLACEHOLDER,\n\t\tsymbol\n\t}));\n}\nvar CreateTableCall = class extends MysqlOpFactoryCallNode {\n\ttableName;\n\tfactoryName = \"createTable\";\n\toperationClass = \"additive\";\n\tlabel;\n\tcolumns;\n\tconstraints;\n\tconstructor(tableName, columns, constraints) {\n\t\tsuper();\n\t\tthis.tableName = tableName;\n\t\tthis.columns = Object.freeze([...columns]);\n\t\tthis.constraints = Object.freeze([...constraints]);\n\t\tthis.label = `Create table ${tableName}`;\n\t\tthis.freeze();\n\t}\n\tasync toOp(lowerer, targetId) {\n\t\tconst statement = await this.lowererFor(lowerer).lowerToExecuteRequest(createTable({\n\t\t\ttable: this.tableName,\n\t\t\tcolumns: this.columns,\n\t\t\tconstraints: this.constraints\n\t\t}));\n\t\tconst table = tableChecks(this.tableName);\n\t\treturn {\n\t\t\tid: `table.${this.tableName}`,\n\t\t\tlabel: this.label,\n\t\t\tsummary: `Creates table ${this.tableName} with its columns, primary key and unique constraints`,\n\t\t\toperationClass: \"additive\",\n\t\t\ttarget: {\n\t\t\t\tid: this.targetIdFor(targetId),\n\t\t\t\tdetails: buildTargetDetails(\"table\", this.tableName)\n\t\t\t},\n\t\t\tprecheck: [table.absent(`ensure table \"${this.tableName}\" does not exist`)],\n\t\t\texecute: [step(`create table \"${this.tableName}\"`, statement.sql, statement.params)],\n\t\t\tpostcheck: [table.present(`verify table \"${this.tableName}\" exists`)]\n\t\t};\n\t}\n\trenderTypeScript() {\n\t\treturn this.#written().source;\n\t}\n\timportRequirements() {\n\t\treturn this.#written().imports;\n\t}\n\t#written() {\n\t\tconst sql = createSqlTextSources(MIGRATION_MODULE_PLACEHOLDER);\n\t\tconst columns = this.columns.map((column) => renderColumn(column, sql)).join(\", \");\n\t\tconst constraints = this.constraints.map(renderConstraint);\n\t\tconst source = `this.createTable({ table: ${jsonToTsSource(this.tableName)}, columns: [${columns}]${constraints.length > 0 ? `, constraints: [${constraints.join(\", \")}]` : \"\"} })`;\n\t\tconst constraintImports = [...new Set(this.constraints.map((c) => c.kind === \"primary-key\" ? \"primaryKey\" : \"unique\"))].map((symbol) => ({\n\t\t\tmoduleSpecifier: MIGRATION_MODULE_PLACEHOLDER,\n\t\t\tsymbol\n\t\t}));\n\t\treturn {\n\t\t\tsource,\n\t\t\timports: [\n\t\t\t\t...columnImports(this.columns),\n\t\t\t\t...constraintImports,\n\t\t\t\t...sql.imports()\n\t\t\t]\n\t\t};\n\t}\n};\nvar DropTableCall = class extends MysqlOpFactoryCallNode {\n\ttableName;\n\tfactoryName = \"dropTable\";\n\toperationClass = \"destructive\";\n\tlabel;\n\tconstructor(tableName) {\n\t\tsuper();\n\t\tthis.tableName = tableName;\n\t\tthis.label = `Drop table ${tableName}`;\n\t\tthis.freeze();\n\t}\n\ttoOp(_lowerer, targetId) {\n\t\tconst table = tableChecks(this.tableName);\n\t\treturn {\n\t\t\tid: `dropTable.${this.tableName}`,\n\t\t\tlabel: this.label,\n\t\t\tsummary: `Drops table ${this.tableName} which is not in the contract`,\n\t\t\toperationClass: \"destructive\",\n\t\t\ttarget: {\n\t\t\t\tid: this.targetIdFor(targetId),\n\t\t\t\tdetails: buildTargetDetails(\"table\", this.tableName)\n\t\t\t},\n\t\t\tprecheck: [table.present(`ensure table \"${this.tableName}\" exists`)],\n\t\t\texecute: [step(`drop table \"${this.tableName}\"`, `DROP TABLE ${quoteIdentifier(this.tableName)}`)],\n\t\t\tpostcheck: [table.absent(`verify table \"${this.tableName}\" is gone`)]\n\t\t};\n\t}\n\trenderTypeScript() {\n\t\treturn `this.dropTable({ table: ${jsonToTsSource(this.tableName)} })`;\n\t}\n};\nvar AddColumnCall = class extends MysqlOpFactoryCallNode {\n\ttableName;\n\tcolumn;\n\tfactoryName = \"addColumn\";\n\toperationClass = \"additive\";\n\tlabel;\n\tcolumnName;\n\tconstructor(tableName, column) {\n\t\tsuper();\n\t\tthis.tableName = tableName;\n\t\tthis.column = column;\n\t\tthis.columnName = column.name;\n\t\tthis.label = `Add column ${column.name} on ${tableName}`;\n\t\tthis.freeze();\n\t}\n\tasync toOp(lowerer, targetId) {\n\t\tconst definition = await columnDefinitionSql(this.column, this.tableName, this.lowererFor(lowerer));\n\t\tconst column = columnChecks(this.tableName, this.columnName);\n\t\treturn {\n\t\t\tid: `column.${this.tableName}.${this.columnName}`,\n\t\t\tlabel: this.label,\n\t\t\tsummary: `Adds column ${this.columnName} to ${this.tableName}`,\n\t\t\toperationClass: \"additive\",\n\t\t\ttarget: {\n\t\t\t\tid: this.targetIdFor(targetId),\n\t\t\t\tdetails: buildTargetDetails(\"column\", this.columnName, this.tableName)\n\t\t\t},\n\t\t\tprecheck: [tableChecks(this.tableName).present(`ensure table \"${this.tableName}\" exists`), column.absent(`ensure column \"${this.columnName}\" is missing on \"${this.tableName}\"`)],\n\t\t\texecute: [step(`add column \"${this.columnName}\" to \"${this.tableName}\"`, `ALTER TABLE ${quoteIdentifier(this.tableName)} ADD COLUMN ${definition}`)],\n\t\t\tpostcheck: [column.present(`verify column \"${this.columnName}\" exists on \"${this.tableName}\"`)]\n\t\t};\n\t}\n\trenderTypeScript() {\n\t\treturn this.#written().source;\n\t}\n\timportRequirements() {\n\t\treturn this.#written().imports;\n\t}\n\t#written() {\n\t\tconst sql = createSqlTextSources(MIGRATION_MODULE_PLACEHOLDER);\n\t\treturn {\n\t\t\tsource: `this.addColumn({ table: ${jsonToTsSource(this.tableName)}, column: ${renderColumn(this.column, sql)} })`,\n\t\t\timports: [...columnImports([this.column]), ...sql.imports()]\n\t\t};\n\t}\n};\nvar DropColumnCall = class extends MysqlOpFactoryCallNode {\n\ttableName;\n\tcolumnName;\n\tfactoryName = \"dropColumn\";\n\toperationClass = \"destructive\";\n\tlabel;\n\tconstructor(tableName, columnName) {\n\t\tsuper();\n\t\tthis.tableName = tableName;\n\t\tthis.columnName = columnName;\n\t\tthis.label = `Drop column ${columnName} on ${tableName}`;\n\t\tthis.freeze();\n\t}\n\ttoOp(_lowerer, targetId) {\n\t\tconst column = columnChecks(this.tableName, this.columnName);\n\t\treturn {\n\t\t\tid: `dropColumn.${this.tableName}.${this.columnName}`,\n\t\t\tlabel: this.label,\n\t\t\tsummary: `Drops column ${this.columnName} on ${this.tableName} which is not in the contract`,\n\t\t\toperationClass: \"destructive\",\n\t\t\ttarget: {\n\t\t\t\tid: this.targetIdFor(targetId),\n\t\t\t\tdetails: buildTargetDetails(\"column\", this.columnName, this.tableName)\n\t\t\t},\n\t\t\tprecheck: [column.present(`ensure column \"${this.columnName}\" exists on \"${this.tableName}\"`)],\n\t\t\texecute: [step(`drop column \"${this.columnName}\" from \"${this.tableName}\"`, `ALTER TABLE ${quoteIdentifier(this.tableName)} DROP COLUMN ${quoteIdentifier(this.columnName)}`)],\n\t\t\tpostcheck: [column.absent(`verify column \"${this.columnName}\" is gone from \"${this.tableName}\"`)]\n\t\t};\n\t}\n\trenderTypeScript() {\n\t\treturn `this.dropColumn({ table: ${jsonToTsSource(this.tableName)}, column: ${jsonToTsSource(this.columnName)} })`;\n\t}\n};\nvar CreateIndexCall = class extends MysqlOpFactoryCallNode {\n\ttableName;\n\tindexName;\n\tcolumns;\n\tunique;\n\tfactoryName = \"createIndex\";\n\toperationClass = \"additive\";\n\tlabel;\n\tconstructor(tableName, indexName, columns, unique) {\n\t\tsuper();\n\t\tthis.tableName = tableName;\n\t\tthis.indexName = indexName;\n\t\tthis.columns = columns;\n\t\tthis.unique = unique;\n\t\tthis.label = `Create ${unique ? \"unique \" : \"\"}index ${indexName} on ${tableName}`;\n\t\tthis.freeze();\n\t}\n\ttoOp(_lowerer, targetId) {\n\t\tconst index = indexChecks(this.tableName, this.indexName);\n\t\treturn {\n\t\t\tid: `index.${this.tableName}.${this.indexName}`,\n\t\t\tlabel: this.label,\n\t\t\tsummary: `Creates ${this.unique ? \"unique \" : \"\"}index ${this.indexName} on ${this.tableName}`,\n\t\t\toperationClass: \"additive\",\n\t\t\ttarget: {\n\t\t\t\tid: this.targetIdFor(targetId),\n\t\t\t\tdetails: buildTargetDetails(\"index\", this.indexName, this.tableName)\n\t\t\t},\n\t\t\tprecheck: [index.absent(`ensure index \"${this.indexName}\" is missing`)],\n\t\t\texecute: [step(`create index \"${this.indexName}\"`, `CREATE ${this.unique ? \"UNIQUE \" : \"\"}INDEX ${quoteIdentifier(this.indexName)} ON ${quoteIdentifier(this.tableName)} (${columnList(this.columns)})`)],\n\t\t\tpostcheck: [index.present(`verify index \"${this.indexName}\" exists`)]\n\t\t};\n\t}\n\trenderTypeScript() {\n\t\treturn `this.createIndex({ table: ${jsonToTsSource(this.tableName)}, index: ${jsonToTsSource(this.indexName)}, columns: ${jsonToTsSource(this.columns)}${this.unique ? \", unique: true\" : \"\"} })`;\n\t}\n};\nvar DropIndexCall = class extends MysqlOpFactoryCallNode {\n\ttableName;\n\tindexName;\n\tfactoryName = \"dropIndex\";\n\toperationClass = \"widening\";\n\tlabel;\n\tconstructor(tableName, indexName) {\n\t\tsuper();\n\t\tthis.tableName = tableName;\n\t\tthis.indexName = indexName;\n\t\tthis.label = `Drop index ${indexName} on ${tableName}`;\n\t\tthis.freeze();\n\t}\n\ttoOp(_lowerer, targetId) {\n\t\tconst index = indexChecks(this.tableName, this.indexName);\n\t\treturn {\n\t\t\tid: `dropIndex.${this.tableName}.${this.indexName}`,\n\t\t\tlabel: this.label,\n\t\t\tsummary: `Drops index ${this.indexName} on ${this.tableName} which is not in the contract`,\n\t\t\toperationClass: \"widening\",\n\t\t\ttarget: {\n\t\t\t\tid: this.targetIdFor(targetId),\n\t\t\t\tdetails: buildTargetDetails(\"index\", this.indexName, this.tableName)\n\t\t\t},\n\t\t\tprecheck: [index.present(`ensure index \"${this.indexName}\" exists`)],\n\t\t\texecute: [step(`drop index \"${this.indexName}\"`, `DROP INDEX ${quoteIdentifier(this.indexName)} ON ${quoteIdentifier(this.tableName)}`)],\n\t\t\tpostcheck: [index.absent(`verify index \"${this.indexName}\" is gone`)]\n\t\t};\n\t}\n\trenderTypeScript() {\n\t\treturn `this.dropIndex({ table: ${jsonToTsSource(this.tableName)}, index: ${jsonToTsSource(this.indexName)} })`;\n\t}\n};\nvar AddUniqueCall = class extends MysqlOpFactoryCallNode {\n\ttableName;\n\tconstraintName;\n\tcolumns;\n\tfactoryName = \"addUnique\";\n\toperationClass = \"additive\";\n\tlabel;\n\tconstructor(tableName, constraintName, columns) {\n\t\tsuper();\n\t\tthis.tableName = tableName;\n\t\tthis.constraintName = constraintName;\n\t\tthis.columns = columns;\n\t\tthis.label = `Add unique constraint ${constraintName} on ${tableName}`;\n\t\tthis.freeze();\n\t}\n\ttoOp(_lowerer, targetId) {\n\t\tconst constraint = constraintChecks(this.tableName, this.constraintName, \"UNIQUE\");\n\t\treturn {\n\t\t\tid: `unique.${this.tableName}.${this.constraintName}`,\n\t\t\tlabel: this.label,\n\t\t\tsummary: `Adds unique constraint ${this.constraintName} on ${this.tableName}`,\n\t\t\toperationClass: \"additive\",\n\t\t\ttarget: {\n\t\t\t\tid: this.targetIdFor(targetId),\n\t\t\t\tdetails: buildTargetDetails(\"unique\", this.constraintName, this.tableName)\n\t\t\t},\n\t\t\tprecheck: [constraint.absent(`ensure unique constraint \"${this.constraintName}\" is missing`)],\n\t\t\texecute: [step(`add unique constraint \"${this.constraintName}\"`, `ALTER TABLE ${quoteIdentifier(this.tableName)} ADD CONSTRAINT ${quoteIdentifier(this.constraintName)} UNIQUE (${columnList(this.columns)})`)],\n\t\t\tpostcheck: [constraint.present(`verify unique constraint \"${this.constraintName}\" exists`)]\n\t\t};\n\t}\n\trenderTypeScript() {\n\t\treturn `this.addUnique({ table: ${jsonToTsSource(this.tableName)}, name: ${jsonToTsSource(this.constraintName)}, columns: ${jsonToTsSource(this.columns)} })`;\n\t}\n};\nvar DropUniqueCall = class extends MysqlOpFactoryCallNode {\n\ttableName;\n\tconstraintName;\n\tfactoryName = \"dropUnique\";\n\toperationClass = \"widening\";\n\tlabel;\n\tconstructor(tableName, constraintName) {\n\t\tsuper();\n\t\tthis.tableName = tableName;\n\t\tthis.constraintName = constraintName;\n\t\tthis.label = `Drop unique constraint ${constraintName} on ${tableName}`;\n\t\tthis.freeze();\n\t}\n\ttoOp(_lowerer, targetId) {\n\t\tconst constraint = constraintChecks(this.tableName, this.constraintName, \"UNIQUE\");\n\t\treturn {\n\t\t\tid: `dropUnique.${this.tableName}.${this.constraintName}`,\n\t\t\tlabel: this.label,\n\t\t\tsummary: `Drops unique constraint ${this.constraintName} on ${this.tableName} which is not in the contract`,\n\t\t\toperationClass: \"widening\",\n\t\t\ttarget: {\n\t\t\t\tid: this.targetIdFor(targetId),\n\t\t\t\tdetails: buildTargetDetails(\"unique\", this.constraintName, this.tableName)\n\t\t\t},\n\t\t\tprecheck: [constraint.present(`ensure unique constraint \"${this.constraintName}\" exists`)],\n\t\t\texecute: [step(`drop unique constraint \"${this.constraintName}\"`, `ALTER TABLE ${quoteIdentifier(this.tableName)} DROP INDEX ${quoteIdentifier(this.constraintName)}`)],\n\t\t\tpostcheck: [constraint.absent(`verify unique constraint \"${this.constraintName}\" is gone`)]\n\t\t};\n\t}\n\trenderTypeScript() {\n\t\treturn `this.dropUnique({ table: ${jsonToTsSource(this.tableName)}, name: ${jsonToTsSource(this.constraintName)} })`;\n\t}\n};\nvar AddForeignKeyCall = class extends MysqlOpFactoryCallNode {\n\ttableName;\n\tforeignKey;\n\tfactoryName = \"addForeignKey\";\n\toperationClass = \"additive\";\n\tlabel;\n\tconstructor(tableName, foreignKey) {\n\t\tsuper();\n\t\tthis.tableName = tableName;\n\t\tthis.foreignKey = foreignKey;\n\t\tthis.label = `Add foreign key ${foreignKey.name} on ${tableName}`;\n\t\tthis.freeze();\n\t}\n\ttoOp(_lowerer, targetId) {\n\t\tconst { name, columns, references } = this.foreignKey;\n\t\tconst constraint = constraintChecks(this.tableName, name, \"FOREIGN KEY\");\n\t\treturn {\n\t\t\tid: `foreignKey.${this.tableName}.${name}`,\n\t\t\tlabel: this.label,\n\t\t\tsummary: `Adds foreign key ${name} on ${this.tableName} referencing ${references.table}`,\n\t\t\toperationClass: \"additive\",\n\t\t\ttarget: {\n\t\t\t\tid: this.targetIdFor(targetId),\n\t\t\t\tdetails: buildTargetDetails(\"foreignKey\", name, this.tableName)\n\t\t\t},\n\t\t\tprecheck: [constraint.absent(`ensure foreign key \"${name}\" is missing`)],\n\t\t\texecute: [step(`add foreign key \"${name}\"`, `ALTER TABLE ${quoteIdentifier(this.tableName)} ADD CONSTRAINT ${quoteIdentifier(name)} FOREIGN KEY (${columnList(columns)}) REFERENCES ${quoteIdentifier(references.table)} (${columnList(references.columns)})${foreignKeyActionsSql(this.foreignKey)}`)],\n\t\t\tpostcheck: [constraint.present(`verify foreign key \"${name}\" exists`)]\n\t\t};\n\t}\n\trenderTypeScript() {\n\t\tconst { name, columns, references, onDelete, onUpdate } = this.foreignKey;\n\t\treturn `this.addForeignKey({ ${[\n\t\t\t`table: ${jsonToTsSource(this.tableName)}`,\n\t\t\t`name: ${jsonToTsSource(name)}`,\n\t\t\t`columns: ${jsonToTsSource(columns)}`,\n\t\t\t`references: ${jsonToTsSource(references)}`,\n\t\t\t...onDelete === void 0 ? [] : [`onDelete: ${jsonToTsSource(onDelete)}`],\n\t\t\t...onUpdate === void 0 ? [] : [`onUpdate: ${jsonToTsSource(onUpdate)}`]\n\t\t].join(\", \")} })`;\n\t}\n};\nvar DropForeignKeyCall = class extends MysqlOpFactoryCallNode {\n\ttableName;\n\tconstraintName;\n\tfactoryName = \"dropForeignKey\";\n\toperationClass = \"widening\";\n\tlabel;\n\tconstructor(tableName, constraintName) {\n\t\tsuper();\n\t\tthis.tableName = tableName;\n\t\tthis.constraintName = constraintName;\n\t\tthis.label = `Drop foreign key ${constraintName} on ${tableName}`;\n\t\tthis.freeze();\n\t}\n\ttoOp(_lowerer, targetId) {\n\t\tconst constraint = constraintChecks(this.tableName, this.constraintName, \"FOREIGN KEY\");\n\t\treturn {\n\t\t\tid: `dropForeignKey.${this.tableName}.${this.constraintName}`,\n\t\t\tlabel: this.label,\n\t\t\tsummary: `Drops foreign key ${this.constraintName} on ${this.tableName} which is not in the contract`,\n\t\t\toperationClass: \"widening\",\n\t\t\ttarget: {\n\t\t\t\tid: this.targetIdFor(targetId),\n\t\t\t\tdetails: buildTargetDetails(\"foreignKey\", this.constraintName, this.tableName)\n\t\t\t},\n\t\t\tprecheck: [constraint.present(`ensure foreign key \"${this.constraintName}\" exists`)],\n\t\t\texecute: [step(`drop foreign key \"${this.constraintName}\"`, `ALTER TABLE ${quoteIdentifier(this.tableName)} DROP FOREIGN KEY ${quoteIdentifier(this.constraintName)}`)],\n\t\t\tpostcheck: [constraint.absent(`verify foreign key \"${this.constraintName}\" is gone`)]\n\t\t};\n\t}\n\trenderTypeScript() {\n\t\treturn `this.dropForeignKey({ table: ${jsonToTsSource(this.tableName)}, name: ${jsonToTsSource(this.constraintName)} })`;\n\t}\n};\n/** An operation built elsewhere, such as the table rename a user writes by hand, carried as it is and written as `rawSql({...})`. */\nvar RawSqlCall = class extends MysqlOpFactoryCallNode {\n\top;\n\tfactoryName = \"rawSql\";\n\toperationClass;\n\tlabel;\n\tconstructor(op) {\n\t\tsuper();\n\t\tthis.op = op;\n\t\tthis.label = op.label;\n\t\tthis.operationClass = op.operationClass;\n\t\tthis.freeze();\n\t}\n\ttoOp() {\n\t\treturn this.op;\n\t}\n\trenderTypeScript() {\n\t\treturn `rawSql(${jsonToTsSource(this.op)})`;\n\t}\n\timportRequirements() {\n\t\treturn [{\n\t\t\tmoduleSpecifier: MIGRATION_MODULE_PLACEHOLDER,\n\t\t\tsymbol: \"rawSql\"\n\t\t}];\n\t}\n};\n/** The table rename a user writes by hand on MySQL, which the planner does not plan yet. */\nfunction renameTableByHandOp(from, to, targetId) {\n\tconst fromTable = tableChecks(from);\n\tconst toTable = tableChecks(to);\n\treturn {\n\t\tid: `renameTable.${from}`,\n\t\tlabel: `Rename table ${from} to ${to}`,\n\t\toperationClass: \"widening\",\n\t\ttarget: {\n\t\t\tid: targetId,\n\t\t\tdetails: buildTargetDetails(\"table\", to)\n\t\t},\n\t\tprecheck: [fromTable.present(`ensure table \"${from}\" exists`), toTable.absent(`ensure table \"${to}\" does not exist`)],\n\t\texecute: [step(`rename table \"${from}\" to \"${to}\"`, `RENAME TABLE ${quoteIdentifier(from)} TO ${quoteIdentifier(to)}`)],\n\t\tpostcheck: [toTable.present(`verify table \"${to}\" exists`), fromTable.absent(`verify table \"${from}\" no longer exists`)]\n\t};\n}\nfunction foreignKeySpecOf(fk, table) {\n\treturn {\n\t\tname: fk.name ?? `${table}_${fk.columns.join(\"_\")}_fkey`,\n\t\tcolumns: fk.columns,\n\t\treferences: {\n\t\t\ttable: fk.referencedTable,\n\t\t\tcolumns: fk.referencedColumns\n\t\t},\n\t\t...ifDefined(\"onDelete\", fk.onDelete),\n\t\t...ifDefined(\"onUpdate\", fk.onUpdate)\n\t};\n}\n//#endregion\n//#region src/core/migrations/column-ddl.ts\n/** The type DDL writes for a column node: the type it is stored as, with the parameters the contract writes, as MySQL reports it in `COLUMN_TYPE`. */\nfunction columnTypeSql(column) {\n\tconst type = column.storedType;\n\tif (type === void 0 || !isSqlDataType(type)) throw new InternalError(`column \"${column.name}\" has no data type; the expected tree must be derived via contractToSchemaIR for planning`);\n\treturn renderSqlTypeName(type, dataTypeParams(type, column.codecRef?.typeParams));\n}\nfunction ddlDefaultOf(columnDefault) {\n\tif (columnDefault === void 0) return void 0;\n\treturn columnDefault.kind === \"literal\" ? new LiteralColumnDefault(columnDefault.value) : new FunctionColumnDefault(opaqueSql(columnDefault.expression));\n}\n/** The default a column node's DDL writes: the one the contract authored, which `resolvedDefault` normalises for the diff. */\nfunction columnDefaultOf(column) {\n\treturn column.authoredDefault ?? column.resolvedDefault;\n}\n/** The `DdlColumn` of a column node. An `autoincrement()` default stays a function default, which the adapter writes as `AUTO_INCREMENT`. */\nfunction ddlColumnFromNode(column) {\n\tconst columnDefault = ddlDefaultOf(columnDefaultOf(column));\n\treturn new DdlColumn({\n\t\tname: column.name,\n\t\ttype: columnTypeSql(column),\n\t\t...column.nullable ? {} : { notNull: true },\n\t\t...columnDefault === void 0 ? {} : { default: columnDefault },\n\t\t...column.codecRef === void 0 ? {} : { codecRef: column.codecRef }\n\t});\n}\n/** The name a unique constraint is created and dropped by; MySQL names an unnamed one after its first column, which the contract never leaves to it. */\nfunction uniqueName(table, unique) {\n\treturn unique.name ?? `${table}_${unique.columns.join(\"_\")}_key`;\n}\n/** The constraints `CREATE TABLE` writes for a table node: its primary key and unique constraints. Foreign keys are added after every table exists, so tables can reference each other. */\nfunction tableConstraintsFromNode(table) {\n\treturn [...table.primaryKey === void 0 ? [] : [new PrimaryKeyConstraint({ columns: table.primaryKey.columns })], ...table.uniques.map((unique) => new UniqueConstraint({\n\t\tcolumns: unique.columns,\n\t\tname: uniqueName(table.name, unique)\n\t}))];\n}\n//#endregion\n//#region src/core/migrations/issue-planner.ts\n/**\n* Drops each issue under a missing or extra node: the call for a table or column accounts for everything beneath it.\n*/\nfunction coalesceSubtreeIssues(issues) {\n\tconst collapsing = issues.filter((issue) => {\n\t\tconst outcome = issueOutcome(issue);\n\t\treturn outcome === \"not-found\" || outcome === \"not-expected\";\n\t}).map((issue) => issue.path);\n\treturn issues.filter((issue) => !collapsing.some((ancestor) => issue.path.length > ancestor.length && ancestor.every((segment, index) => issue.path[index] === segment)));\n}\nfunction issueNode(issue) {\n\tconst node = issue.expected ?? issue.actual;\n\treturn node === void 0 ? void 0 : blindCast(node);\n}\nfunction expectedNode(issue) {\n\treturn blindCast(issue.expected);\n}\nfunction actualNode(issue) {\n\treturn blindCast(issue.actual);\n}\nfunction location(table, column) {\n\treturn {\n\t\tentityKind: \"table\",\n\t\t...table === void 0 ? {} : { entityName: table },\n\t\t...column === void 0 ? {} : { column }\n\t};\n}\nfunction placeOf(issue, at) {\n\tif (at?.entityName === void 0) return issue.path.slice(1).join(\".\");\n\treturn at.column === void 0 ? at.entityName : `${at.entityName}.${at.column}`;\n}\n/** The conflict for a change the MySQL planner does not plan yet. */\nfunction notYetSupported(kind, change, issue, conflictLocation) {\n\treturn {\n\t\tkind,\n\t\tsummary: `${change} is not yet supported by the migration planner (${placeOf(issue, conflictLocation)})`,\n\t\twhy: \"The migration planner creates and drops tables, columns, indexes, unique constraints and foreign keys; it does not change a column, a default, a primary key or a CHECK constraint yet. Use `migration new` to write this change by hand.\",\n\t\t...conflictLocation === void 0 ? {} : { location: conflictLocation }\n\t};\n}\nfunction createTableCalls(table) {\n\treturn [\n\t\tnew CreateTableCall(table.name, Object.values(table.columns).map(ddlColumnFromNode), tableConstraintsFromNode(table)),\n\t\t...table.indexes.flatMap((index) => index.columns === void 0 ? [] : [new CreateIndexCall(table.name, index.name, index.columns, index.unique)]),\n\t\t...table.foreignKeys.map((fk) => new AddForeignKeyCall(table.name, foreignKeySpecOf(fk, table.name)))\n\t];\n}\nfunction mapTableIssue(issue) {\n\tswitch (issueOutcome(issue)) {\n\t\tcase \"not-found\": {\n\t\t\tconst table = expectedNode(issue);\n\t\t\treturn table.indexes.find((index) => index.columns === void 0) === void 0 ? ok(createTableCalls(table)) : notOk(notYetSupported(\"indexIncompatible\", \"An expression index\", issue, location(table.name)));\n\t\t}\n\t\tcase \"not-expected\": {\n\t\t\tconst table = actualNode(issue);\n\t\t\treturn ok(CONTROL_TABLE_NAMES.has(table.name) ? [] : [new DropTableCall(table.name)]);\n\t\t}\n\t\tdefault: return notOk(notYetSupported(\"unsupportedOperation\", \"Changing a table\", issue));\n\t}\n}\nfunction mapColumnIssue(issue, table) {\n\tswitch (issueOutcome(issue)) {\n\t\tcase \"not-found\": {\n\t\t\tconst column = expectedNode(issue);\n\t\t\tconst columnDefault = columnDefaultOf(column);\n\t\t\treturn column.nullable || columnDefault !== void 0 && !(columnDefault.kind === \"function\" && columnDefault.expression === \"autoincrement()\") ? ok([new AddColumnCall(table, ddlColumnFromNode(column))]) : notOk(notYetSupported(\"nullabilityConflict\", \"Adding a required column without a default\", issue, location(table, column.name)));\n\t\t}\n\t\tcase \"not-expected\": return ok([new DropColumnCall(table, actualNode(issue).name)]);\n\t\tdefault: {\n\t\t\tconst expected = expectedNode(issue);\n\t\t\tconst typesEqual = sqlColumnTypesEqual(expected, actualNode(issue));\n\t\t\treturn notOk(notYetSupported(typesEqual ? \"nullabilityConflict\" : \"typeMismatch\", typesEqual ? \"Changing a column's nullability\" : \"Changing a column's type\", issue, location(table, expected.name)));\n\t\t}\n\t}\n}\nfunction mapIndexIssue(issue, table) {\n\tswitch (issueOutcome(issue)) {\n\t\tcase \"not-found\": {\n\t\t\tconst index = expectedNode(issue);\n\t\t\treturn index.columns === void 0 ? notOk(notYetSupported(\"indexIncompatible\", \"An expression index\", issue, location(table))) : ok([new CreateIndexCall(table, index.name, index.columns, index.unique)]);\n\t\t}\n\t\tcase \"not-expected\": return ok([new DropIndexCall(table, actualNode(issue).name)]);\n\t\tdefault: return notOk(notYetSupported(\"indexIncompatible\", \"Changing an index\", issue, location(table)));\n\t}\n}\nfunction mapUniqueIssue(issue, table) {\n\tswitch (issueOutcome(issue)) {\n\t\tcase \"not-found\": {\n\t\t\tconst unique = expectedNode(issue);\n\t\t\treturn ok([new AddUniqueCall(table, uniqueName(table, unique), unique.columns)]);\n\t\t}\n\t\tcase \"not-expected\": return ok([new DropUniqueCall(table, uniqueName(table, actualNode(issue)))]);\n\t\tdefault: return notOk(notYetSupported(\"indexIncompatible\", \"Changing a unique constraint\", issue, location(table)));\n\t}\n}\nfunction mapForeignKeyIssue(issue, table) {\n\tswitch (issueOutcome(issue)) {\n\t\tcase \"not-found\": return ok([new AddForeignKeyCall(table, foreignKeySpecOf(expectedNode(issue), table))]);\n\t\tcase \"not-expected\": return ok([new DropForeignKeyCall(table, foreignKeySpecOf(actualNode(issue), table).name)]);\n\t\tdefault: return notOk(notYetSupported(\"foreignKeyConflict\", \"Changing a foreign key\", issue, location(table)));\n\t}\n}\nfunction mapIssueToCalls(issue) {\n\tconst node = issueNode(issue);\n\tconst table = issue.path[1];\n\tif (node === void 0) return notOk(notYetSupported(\"unsupportedOperation\", \"A change with no node\", issue));\n\tif (node.nodeKind === RelationalSchemaNodeKind.table) return mapTableIssue(issue);\n\tif (table === void 0) return notOk(notYetSupported(\"unsupportedOperation\", `A ${node.nodeKind} change`, issue));\n\tswitch (node.nodeKind) {\n\t\tcase RelationalSchemaNodeKind.column: return mapColumnIssue(issue, table);\n\t\tcase RelationalSchemaNodeKind.index: return mapIndexIssue(issue, table);\n\t\tcase RelationalSchemaNodeKind.unique: return mapUniqueIssue(issue, table);\n\t\tcase RelationalSchemaNodeKind.foreignKey: return mapForeignKeyIssue(issue, table);\n\t\tcase RelationalSchemaNodeKind.columnDefault: return notOk(notYetSupported(\"unsupportedOperation\", \"Changing a column's default\", issue, location(table)));\n\t\tcase RelationalSchemaNodeKind.primaryKey: return notOk(notYetSupported(\"indexIncompatible\", \"Changing a primary key\", issue, location(table)));\n\t\tcase RelationalSchemaNodeKind.check: return notOk(notYetSupported(\"unsupportedOperation\", \"A CHECK constraint\", issue, location(table)));\n\t\tdefault: return notOk(notYetSupported(\"unsupportedOperation\", `A ${node.nodeKind} change`, issue));\n\t}\n}\n/**\n* The order calls run in: foreign keys are dropped before the tables, columns and indexes they use, and added after every table, column and index they need exists. The index InnoDB made for a dropped key is dropped right after the key, before any key is added, so a new key on the same columns makes its own.\n*/\nconst CALL_ORDER = [\n\t\"dropForeignKey\",\n\t\"createTable\",\n\t\"addColumn\",\n\t\"addUnique\",\n\t\"createIndex\",\n\t\"addForeignKey\",\n\t\"dropUnique\",\n\t\"dropIndex\",\n\t\"dropColumn\",\n\t\"dropTable\",\n\t\"rawSql\"\n];\nfunction locationOfCall(call) {\n\treturn \"tableName\" in call ? {\n\t\tentityKind: \"table\",\n\t\tentityName: call.tableName,\n\t\t...\"columnName\" in call ? { column: call.columnName } : {},\n\t\t...\"indexName\" in call ? { index: call.indexName } : {}\n\t} : void 0;\n}\nfunction conflictForDisallowedCall(call, allowed) {\n\tconst callLocation = locationOfCall(call);\n\treturn {\n\t\tkind: call instanceof CreateIndexCall || call instanceof DropIndexCall ? \"indexIncompatible\" : \"missingButNonAdditive\",\n\t\tsummary: `Operation \"${call.label}\" requires class \"${call.operationClass}\", but policy allows only: ${allowed.join(\", \")}`,\n\t\twhy: \"Use `migration new` to author a custom migration for this change.\",\n\t\trefusedOperationClass: call.operationClass,\n\t\t...callLocation === void 0 ? {} : { location: callLocation }\n\t};\n}\nconst MAX_IDENTIFIER_CHARACTERS = 64;\n/** The names a call gives new objects, each with where the conflict that refuses it points. */\nfunction namesGiven(call) {\n\tif (call instanceof CreateTableCall) return [\n\t\t{\n\t\t\tname: call.tableName,\n\t\t\tat: location(call.tableName)\n\t\t},\n\t\t...call.columns.map((column) => ({\n\t\t\tname: column.name,\n\t\t\tat: location(call.tableName, column.name)\n\t\t})),\n\t\t...call.constraints.flatMap((constraint) => constraint.name === void 0 ? [] : [{\n\t\t\tname: constraint.name,\n\t\t\tat: {\n\t\t\t\t...location(call.tableName),\n\t\t\t\tconstraint: constraint.name\n\t\t\t}\n\t\t}])\n\t];\n\tif (call instanceof AddColumnCall) return [{\n\t\tname: call.column.name,\n\t\tat: location(call.tableName, call.column.name)\n\t}];\n\tif (call instanceof CreateIndexCall) return [{\n\t\tname: call.indexName,\n\t\tat: {\n\t\t\t...location(call.tableName),\n\t\t\tindex: call.indexName\n\t\t}\n\t}];\n\tif (call instanceof AddUniqueCall) return [{\n\t\tname: call.constraintName,\n\t\tat: {\n\t\t\t...location(call.tableName),\n\t\t\tconstraint: call.constraintName\n\t\t}\n\t}];\n\tif (call instanceof AddForeignKeyCall) return [{\n\t\tname: call.foreignKey.name,\n\t\tat: {\n\t\t\t...location(call.tableName),\n\t\t\tconstraint: call.foreignKey.name\n\t\t}\n\t}];\n\treturn [];\n}\nfunction placeText(at) {\n\treturn at.column === void 0 ? `${at.entityName}` : `${at.entityName}.${at.column}`;\n}\n/** MySQL refuses a name longer than 64 characters only when the statement runs, after the statements before it committed, so the planner refuses it first. */\nfunction longNameConflicts(call) {\n\treturn namesGiven(call).filter(({ name }) => Array.from(name).length > MAX_IDENTIFIER_CHARACTERS).map(({ name, at }) => ({\n\t\tkind: \"unsupportedOperation\",\n\t\tsummary: `The name ${name} is longer than the ${MAX_IDENTIFIER_CHARACTERS} characters the database allows (${placeText(at)})`,\n\t\twhy: `The database refuses a table, column, index or constraint name longer than ${MAX_IDENTIFIER_CHARACTERS} characters. Give it a shorter name in the contract.`,\n\t\tlocation: at\n\t}));\n}\nfunction isAutoincrement(column) {\n\treturn column.default?.kind === \"function\" && column.default.expression.text === \"autoincrement()\";\n}\n/** MySQL refuses a table whose `AUTO_INCREMENT` column does not lead a key, so the planner refuses it first. */\nfunction autoincrementKeyConflicts(call) {\n\tif (!(call instanceof CreateTableCall)) return [];\n\tconst keyLeaders = new Set(call.constraints.flatMap((constraint) => constraint.kind === \"primary-key\" || constraint.kind === \"unique\" ? constraint.columns.slice(0, 1) : []));\n\treturn call.columns.filter((column) => isAutoincrement(column) && !column.primaryKey && !keyLeaders.has(column.name)).map((column) => ({\n\t\tkind: \"unsupportedOperation\",\n\t\tsummary: `An autoincrement column that is not the first column of the primary key or a unique constraint is not supported by the database (${call.tableName}.${column.name})`,\n\t\twhy: \"The database requires an AUTO_INCREMENT column to be the first column of a key, and refuses the table otherwise.\",\n\t\tlocation: location(call.tableName, column.name)\n\t}));\n}\n/** Whether an index on `indexColumns` can serve a foreign key on `keyColumns`: InnoDB needs the key's columns first, in order. */\nfunction servesKey(indexColumns, keyColumns) {\n\treturn keyColumns.length <= indexColumns.length && keyColumns.every((column, position) => indexColumns[position] === column);\n}\nfunction indexColumnLists(table, leaving) {\n\treturn [\n\t\t...table.primaryKey === void 0 ? [] : [table.primaryKey.columns],\n\t\t...table.uniques.flatMap((unique) => uniqueName(table.name, unique) === leaving ? [] : [unique.columns]),\n\t\t...table.indexes.flatMap((index) => index.name === leaving || index.columns === void 0 ? [] : [index.columns])\n\t];\n}\nfunction isKeyServed(table, keyColumns, leaving) {\n\treturn indexColumnLists(table, leaving).some((columns) => servesKey(columns, keyColumns));\n}\n/**\n* When a foreign key is dropped and no other index served it, InnoDB made an index of its own, with the key's name, and keeps it after the key is gone. Introspection leaves that index out while the key exists, so it is dropped with the key unless the destination keeps an index of that name.\n*/\nfunction innoDbIndexDrops(calls, expected, actual) {\n\treturn calls.flatMap((call) => {\n\t\tif (!(call instanceof DropForeignKeyCall)) return [];\n\t\tconst before = actual.tables[call.tableName];\n\t\tconst after = expected.tables[call.tableName];\n\t\tconst key = before?.foreignKeys.find((fk) => foreignKeySpecOf(fk, call.tableName).name === call.constraintName);\n\t\tif (before === void 0 || after === void 0 || key === void 0) return [];\n\t\tif (isKeyServed(before, key.columns)) return [];\n\t\tif (after.indexes.some((index) => index.name === call.constraintName)) return [];\n\t\treturn [{\n\t\t\tcall: new DropIndexCall(call.tableName, call.constraintName),\n\t\t\tindexName: call.constraintName,\n\t\t\tcolumns: key.columns\n\t\t}];\n\t});\n}\nfunction droppedIndexes(calls, actual) {\n\treturn calls.flatMap((call) => {\n\t\tconst table = \"tableName\" in call ? actual.tables[call.tableName] : void 0;\n\t\tif (table === void 0) return [];\n\t\tif (call instanceof DropIndexCall) {\n\t\t\tconst index = table.indexes.find(({ name }) => name === call.indexName);\n\t\t\treturn index?.columns === void 0 ? [] : [{\n\t\t\t\tcall,\n\t\t\t\tindexName: call.indexName,\n\t\t\t\tcolumns: index.columns\n\t\t\t}];\n\t\t}\n\t\tif (call instanceof DropUniqueCall) {\n\t\t\tconst unique = table.uniques.find((candidate) => uniqueName(table.name, candidate) === call.constraintName);\n\t\t\treturn unique === void 0 ? [] : [{\n\t\t\t\tcall,\n\t\t\t\tindexName: call.constraintName,\n\t\t\t\tcolumns: unique.columns\n\t\t\t}];\n\t\t}\n\t\treturn [];\n\t});\n}\n/**\n* A dropped index that one of `protectedKeys` uses, when no index the destination keeps can take over: MySQL refuses that drop.\n*/\nfunction conflictForIndexAKeyUses(dropped, expected, protectedKeys) {\n\tconst tableName = dropped.call.tableName;\n\tconst table = expected.tables[tableName];\n\tconst key = table?.foreignKeys.find((fk) => protectedKeys(tableName, fk) && servesKey(dropped.columns, fk.columns) && !isKeyServed(table, fk.columns, dropped.indexName));\n\tif (key === void 0) return void 0;\n\treturn {\n\t\tkind: \"indexIncompatible\",\n\t\tsummary: `Dropping index ${dropped.indexName}, which foreign key ${foreignKeySpecOf(key, tableName).name} uses, is not yet supported by the migration planner (${tableName})`,\n\t\twhy: \"The database refuses to drop an index a foreign key uses. Keep an index whose first columns are the foreign key's columns, or use `migration new` to drop the foreign key, drop the index and add the foreign key again.\",\n\t\tlocation: {\n\t\t\tentityKind: \"table\",\n\t\t\tentityName: tableName,\n\t\t\tindex: dropped.indexName\n\t\t}\n\t};\n}\n/** The calls that turn `actual` into `expected` for `issues`, in the order they run, or the conflicts that stop the plan. */\nfunction planIssues(input) {\n\tconst calls = [];\n\tconst conflicts = [];\n\tconst allowed = input.policy.allowedOperationClasses;\n\tfor (const issue of orderIssuesByDependencies(input.issues)) {\n\t\tconst mapped = mapIssueToCalls(issue);\n\t\tif (!mapped.ok) {\n\t\t\tconflicts.push(mapped.failure);\n\t\t\tcontinue;\n\t\t}\n\t\tfor (const call of mapped.value) {\n\t\t\tconflicts.push(...longNameConflicts(call), ...autoincrementKeyConflicts(call));\n\t\t\tif (allowed.includes(call.operationClass)) calls.push(call);\n\t\t\telse conflicts.push(conflictForDisallowedCall(call, allowed));\n\t\t}\n\t}\n\tconst droppedKeys = new Set(calls.flatMap((call) => call instanceof DropForeignKeyCall ? [`${call.tableName}.${call.constraintName}`] : []));\n\tconst isKeptKey = (tableName, fk) => !droppedKeys.has(`${tableName}.${foreignKeySpecOf(fk, tableName).name}`);\n\tfor (const dropped of droppedIndexes(calls, input.actual)) {\n\t\tconst conflict = conflictForIndexAKeyUses(dropped, input.expected, () => true);\n\t\tif (conflict !== void 0) conflicts.push(conflict);\n\t}\n\tconst innoDbIndexes = innoDbIndexDrops(calls, input.expected, input.actual);\n\tfor (const dropped of innoDbIndexes) {\n\t\tconst conflict = conflictForIndexAKeyUses(dropped, input.expected, isKeptKey);\n\t\tif (conflict !== void 0) conflicts.push(conflict);\n\t\tif (!allowed.includes(dropped.call.operationClass)) conflicts.push(conflictForDisallowedCall(dropped.call, allowed));\n\t}\n\tif (conflicts.length > 0) return notOk(conflicts);\n\tconst inOrder = (factoryName) => calls.filter((call) => call.factoryName === factoryName);\n\treturn ok([\n\t\t...inOrder(\"dropForeignKey\"),\n\t\t...innoDbIndexes.map(({ call }) => call),\n\t\t...CALL_ORDER.filter((factoryName) => factoryName !== \"dropForeignKey\").flatMap(inOrder)\n\t]);\n}\n//#endregion\n//#region src/core/migrations/mysql-migration.ts\n/**\n* The base class of a `migration.ts` for MySQL or a target that extends it, such as MariaDB. Each protected method returns the operation its name says, for the target `targetId` names, rendered through the control adapter the migration CLI builds from `prisma.config.ts`.\n*/\nvar MysqlMigrationBase = class extends Migration {\n\tcontrolAdapter;\n\tconstructor(stack) {\n\t\tsuper(stack);\n\t\tthis.controlAdapter = stack?.adapter === void 0 ? void 0 : blindCast(stack.adapter.create(stack));\n\t}\n\tadapterFor(operation) {\n\t\tif (this.controlAdapter === void 0) throw mysqlMigrationStackMissing(operation);\n\t\treturn this.controlAdapter;\n\t}\n\tcreateTable(options) {\n\t\treturn new CreateTableCall(options.table, options.columns, options.constraints ?? []).toOp(this.adapterFor(\"createTable\"), this.targetId);\n\t}\n\tdropTable(options) {\n\t\treturn new DropTableCall(options.table).toOp(void 0, this.targetId);\n\t}\n\taddColumn(options) {\n\t\treturn new AddColumnCall(options.table, options.column).toOp(this.adapterFor(\"addColumn\"), this.targetId);\n\t}\n\tdropColumn(options) {\n\t\treturn new DropColumnCall(options.table, options.column).toOp(void 0, this.targetId);\n\t}\n\tcreateIndex(options) {\n\t\treturn new CreateIndexCall(options.table, options.index, options.columns, options.unique === true).toOp(void 0, this.targetId);\n\t}\n\tdropIndex(options) {\n\t\treturn new DropIndexCall(options.table, options.index).toOp(void 0, this.targetId);\n\t}\n\taddUnique(options) {\n\t\treturn new AddUniqueCall(options.table, options.name, options.columns).toOp(void 0, this.targetId);\n\t}\n\tdropUnique(options) {\n\t\treturn new DropUniqueCall(options.table, options.name).toOp(void 0, this.targetId);\n\t}\n\taddForeignKey(options) {\n\t\treturn new AddForeignKeyCall(options.table, {\n\t\t\tname: options.name,\n\t\t\tcolumns: options.columns,\n\t\t\treferences: options.references,\n\t\t\t...ifDefined(\"onDelete\", options.onDelete),\n\t\t\t...ifDefined(\"onUpdate\", options.onUpdate)\n\t\t}).toOp(void 0, this.targetId);\n\t}\n\tdropForeignKey(options) {\n\t\treturn new DropForeignKeyCall(options.table, options.name).toOp(void 0, this.targetId);\n\t}\n};\n/** The base class of a MySQL `migration.ts`. */\nvar MysqlMigration = class extends MysqlMigrationBase {\n\ttargetId = \"mysql\";\n};\n//#endregion\n//#region src/core/migrations/render-ops.ts\nfunction assertTargetOp(op, factoryName, expectedTargetId) {\n\tconst targetId = blindCast(op).target?.id;\n\tif (targetId !== expectedTargetId) throw new InternalError(`renderOps: expected a ${expectedTargetId} operation but got target.id=\"${String(targetId)}\" for op.id=\"${op.id}\" (factoryName=\"${factoryName}\").`);\n}\nfunction checkedOp(opOrPromise, factoryName, targetId) {\n\tif (isThenable(opOrPromise)) {\n\t\tconst checked = opOrPromise.then((op) => {\n\t\t\tassertTargetOp(op, factoryName, targetId);\n\t\t\treturn op;\n\t\t});\n\t\tchecked.catch(() => void 0);\n\t\treturn checked;\n\t}\n\tassertTargetOp(opOrPromise, factoryName, targetId);\n\treturn opOrPromise;\n}\n/** The operations `calls` lower to, in order, each checked to be an operation of the target `targetId` names. */\nfunction renderOps(calls, lowerer, targetId) {\n\treturn calls.map((call) => checkedOp(isMysqlOpFactoryCall(call) ? call.toOp(lowerer, targetId) : blindCast(call).toOp(lowerer), call.factoryName, targetId));\n}\n//#endregion\n//#region src/core/migrations/render-typescript.ts\n/** The base class and the CLI entrypoint every scaffold imports, both from the facade's `migration` module. */\nconst BASE_IMPORTS = [{\n\tmoduleSpecifier: MIGRATION_MODULE_PLACEHOLDER,\n\tsymbol: \"Migration\"\n}, {\n\tmoduleSpecifier: MIGRATION_MODULE_PLACEHOLDER,\n\tsymbol: \"MigrationCLI\"\n}];\nfunction renderCallsToTypeScript(calls, meta) {\n\tconst imports = buildImports(calls, meta);\n\tconst operationsBody = calls.map((c) => c.renderTypeScript()).join(\",\\n\");\n\tconst hasStart = meta.from !== null;\n\tconst startField = hasStart ? [\" override readonly startContractJson = startContract;\"] : [];\n\treturn [\n\t\tshebangLineFor(detectScaffoldRuntime()),\n\t\timports,\n\t\t\"\",\n\t\t`export default class M extends Migration<${hasStart ? \"Start\" : \"never\"}, End> {`,\n\t\t...startField,\n\t\t\" override readonly endContractJson = endContract;\",\n\t\t\"\",\n\t\t\" override get operations() {\",\n\t\t\" return [\",\n\t\tindent(operationsBody, 6),\n\t\t\" ];\",\n\t\t\" }\",\n\t\t\"}\",\n\t\t\"\",\n\t\t\"MigrationCLI.run(import.meta.url, M);\",\n\t\t\"\"\n\t].join(\"\\n\");\n}\nfunction buildImports(calls, meta) {\n\tconst requirements = [...BASE_IMPORTS, ...contractImports(meta)];\n\tfor (const call of calls) for (const req of call.importRequirements()) requirements.push(req);\n\tconst resolve = meta.resolveImportSpecifier ?? keepInternalSpecifiers;\n\treturn renderImports(resolveRequirementSpecifiers(requirements, (specifier) => resolve(specifier === \"@internal/mysql/migration\" ? meta.migrationModule : specifier)));\n}\nfunction contractImports(meta) {\n\tconst reqs = [{\n\t\tmoduleSpecifier: contractSnapshotJsonSpecifier(meta.snapshotsImportPath, meta.to),\n\t\tsymbol: \"endContract\",\n\t\tkind: \"default\",\n\t\tattributes: { type: \"json\" }\n\t}, {\n\t\tmoduleSpecifier: contractSnapshotTypesSpecifier(meta.snapshotsImportPath, meta.to),\n\t\tsymbol: \"Contract\",\n\t\talias: \"End\",\n\t\ttypeOnly: true\n\t}];\n\tif (meta.from !== null) {\n\t\treqs.push({\n\t\t\tmoduleSpecifier: contractSnapshotJsonSpecifier(meta.snapshotsImportPath, meta.from),\n\t\t\tsymbol: \"startContract\",\n\t\t\tkind: \"default\",\n\t\t\tattributes: { type: \"json\" }\n\t\t});\n\t\treqs.push({\n\t\t\tmoduleSpecifier: contractSnapshotTypesSpecifier(meta.snapshotsImportPath, meta.from),\n\t\t\tsymbol: \"Contract\",\n\t\t\talias: \"Start\",\n\t\t\ttypeOnly: true\n\t\t});\n\t}\n\treturn reqs;\n}\nfunction indent(text, spaces) {\n\tconst pad = \" \".repeat(spaces);\n\treturn text.split(\"\\n\").map((line) => line.trim() ? `${pad}${line}` : line).join(\"\\n\");\n}\n//#endregion\n//#region src/core/migrations/planner-produced-mysql-migration.ts\n/** The plan the MySQL planner produces: its operations, and the `migration.ts` that writes them. */\nvar TypeScriptRenderableMysqlMigration = class extends MysqlMigrationBase {\n\ttargetId;\n\t#migrationModule;\n\t#calls;\n\t#meta;\n\t#destination;\n\t#spaceId;\n\t#snapshotsImportPath;\n\t#lowerer;\n\t#operationsCache;\n\tconstructor(options) {\n\t\tsuper();\n\t\tthis.targetId = options.target.targetId;\n\t\tthis.#migrationModule = options.target.migrationModule;\n\t\tthis.#calls = options.calls;\n\t\tthis.#meta = options.meta;\n\t\tthis.#spaceId = options.spaceId;\n\t\tthis.#snapshotsImportPath = options.snapshotsImportPath;\n\t\tthis.#destination = options.destination ?? { storageHash: options.meta.to };\n\t\tthis.#lowerer = options.lowerer;\n\t}\n\tget operations() {\n\t\tthis.#operationsCache ??= renderOps(this.#calls, this.#lowerer, this.targetId);\n\t\treturn this.#operationsCache;\n\t}\n\tdescribe() {\n\t\treturn this.#meta;\n\t}\n\tget destination() {\n\t\treturn this.#destination;\n\t}\n\tget spaceId() {\n\t\treturn this.#spaceId;\n\t}\n\trenderTypeScript(resolveImportSpecifier) {\n\t\treturn renderCallsToTypeScript(this.#calls, {\n\t\t\tfrom: this.#meta.from,\n\t\t\tto: this.#meta.to,\n\t\t\tsnapshotsImportPath: this.#snapshotsImportPath,\n\t\t\tresolveImportSpecifier,\n\t\t\tmigrationModule: this.#migrationModule\n\t\t});\n\t}\n};\n//#endregion\n//#region src/core/migrations/planner.ts\nfunction tableRenameByHand(targetId) {\n\treturn {\n\t\trenderTableRename: (rename) => new RawSqlCall(renameTableByHandOp(rename.from, rename.to, targetId)).renderTypeScript(),\n\t\ttableRenameByHand: (rename) => [`RENAME TABLE ${quoteIdentifier(rename.from)} TO ${quoteIdentifier(rename.to)}`]\n\t};\n}\nfunction tableTarget(table, column) {\n\treturn {\n\t\tstorageName: column === void 0 ? table : `${table}.${column}`,\n\t\ttable: {\n\t\t\tnamespaceId: UNBOUND_NAMESPACE_ID,\n\t\t\ttable,\n\t\t\tcolumn\n\t\t}\n\t};\n}\nfunction callSubjects(call) {\n\tconst dataLoss = call instanceof DropTableCall ? [{\n\t\t...tableTarget(call.tableName),\n\t\tloss: \"drop\"\n\t}] : call instanceof DropColumnCall ? [{\n\t\t...tableTarget(call.tableName, call.columnName),\n\t\tloss: \"drop\"\n\t}] : [];\n\treturn {\n\t\toperationCount: 1,\n\t\tlabel: call.label,\n\t\tdataLoss,\n\t\taccessChanges: [],\n\t\ttemporaryValues: []\n\t};\n}\n/** Whether `issue` is an extra table some contract space owns, which this space must leave alone. */\nfunction isTableOwnedElsewhere(issue, ownership) {\n\tif (issueOutcome(issue) !== \"not-expected\") return false;\n\tif (issueNode(issue)?.nodeKind !== RelationalSchemaNodeKind.table) return false;\n\tconst table = issue.path[1];\n\treturn table !== void 0 && ownership.declaresEntity({\n\t\tnamespaceId: UNBOUND_NAMESPACE_ID,\n\t\tentityKind: \"table\",\n\t\tentityName: table\n\t});\n}\n/**\n* The MySQL migration planner, for MySQL or a target that extends it. It diffs the contract's schema against the live one and plans creating and dropping tables, columns, indexes, unique constraints and foreign keys. Every other change, and every statement such as a rename, is refused with a conflict that says it is not yet supported on MySQL.\n*/\nvar MysqlMigrationPlanner = class {\n\t#lowerer;\n\t#target;\n\tconstructor(lowerer, target) {\n\t\tthis.#lowerer = lowerer;\n\t\tthis.#target = target;\n\t}\n\tplan(options) {\n\t\treturn this.#planSql(blindCast(options));\n\t}\n\temptyMigration(context, spaceId) {\n\t\treturn new TypeScriptRenderableMysqlMigration({\n\t\t\tcalls: [],\n\t\t\tmeta: {\n\t\t\t\tfrom: context.fromHash,\n\t\t\t\tto: context.toHash\n\t\t\t},\n\t\t\tspaceId,\n\t\t\tsnapshotsImportPath: context.snapshotsImportPath,\n\t\t\tlowerer: this.#lowerer,\n\t\t\ttarget: this.#target\n\t\t});\n\t}\n\t#planSql(options) {\n\t\tif (!options.policy.allowedOperationClasses.includes(\"additive\")) return plannerFailure([{\n\t\t\tkind: \"unsupportedOperation\",\n\t\t\tsummary: \"Migration planner requires additive operations be allowed\",\n\t\t\twhy: \"The planner requires the \\\"additive\\\" operation class to be allowed in the policy.\"\n\t\t}]);\n\t\tconst [statement] = options.statements;\n\t\tif (statement !== void 0) return plannerFailure([statementNotYetSupported(statement)]);\n\t\tif (!(options.schema instanceof SqlSchemaIR)) throw mysqlError(\"CONTRACT.TARGET_MISMATCH\", \"The MySQL planner received a schema tree that neither MySQL introspection nor contractToSchema built.\");\n\t\tconst expected = mysqlContractToSchema(options.contract, sqlTypeLookupsOf(options.frameworkComponents));\n\t\tconst actual = options.schema;\n\t\tconst allowed = options.policy.allowedOperationClasses;\n\t\tconst strict = allowed.includes(\"widening\") || allowed.includes(\"destructive\");\n\t\tconst { ownership } = options;\n\t\tconst planned = planIssues({\n\t\t\tissues: coalesceSubtreeIssues(diffSchemas(expected, actual)).filter((issue) => (strict || issueOutcome(issue) !== \"not-expected\") && (ownership === void 0 || !isTableOwnedElsewhere(issue, ownership))),\n\t\t\texpected,\n\t\t\tactual,\n\t\t\tpolicy: options.policy\n\t\t});\n\t\tif (!planned.ok) return plannerFailure(planned.failure);\n\t\tconst calls = planned.value;\n\t\treturn {\n\t\t\tkind: \"success\",\n\t\t\tplan: new TypeScriptRenderableMysqlMigration({\n\t\t\t\tcalls,\n\t\t\t\tmeta: {\n\t\t\t\t\tfrom: options.origin?.storageHash ?? null,\n\t\t\t\t\tto: options.contract.storage.storageHash\n\t\t\t\t},\n\t\t\t\tspaceId: options.spaceId,\n\t\t\t\tsnapshotsImportPath: options.snapshotsImportPath,\n\t\t\t\tdestination: {\n\t\t\t\t\tstorageHash: options.contract.storage.storageHash,\n\t\t\t\t\t...options.contract.profileHash === void 0 ? {} : { profileHash: options.contract.profileHash }\n\t\t\t\t},\n\t\t\t\tlowerer: this.#lowerer,\n\t\t\t\ttarget: this.#target\n\t\t\t}),\n\t\t\tappliedStatements: [],\n\t\t\t...subjectsOfCalls(calls.map(callSubjects), {\n\t\t\t\tfromContract: options.fromContract,\n\t\t\t\tcontract: options.contract,\n\t\t\t\torigins: NO_RENAMED_ORIGINS,\n\t\t\t\tbyHand: tableRenameByHand(this.#target.targetId),\n\t\t\t\tremovedVariants: []\n\t\t\t})\n\t\t};\n\t}\n};\nfunction statementNotYetSupported(statement) {\n\treturn {\n\t\tkind: \"statementRefused\",\n\t\tsummary: `A ${statement.kind} statement is not yet supported by the migration planner`,\n\t\twhy: \"The migration planner plans no rename, conversion or backfill yet. Plan the change without the statement, or write it by hand in a migration of its own with `migration new`.\",\n\t\trefusedStatement: statement\n\t};\n}\nfunction createMysqlMigrationPlanner(lowerer, target) {\n\treturn new MysqlMigrationPlanner(lowerer, target);\n}\n//#endregion\n//#region src/core/migrations/runner.ts\n/** An error without a structured code, such as a driver's socket error, thrown while a space applied: reported as `MIGRATION.EXECUTION_FAILED`, with its own code, when it has one, in `errorCode`. */\nfunction failureFromThrown(error) {\n\tconst errorCode = typeof error === \"object\" && error !== null ? Reflect.get(error, \"code\") : void 0;\n\treturn migrationRunnerFailure(\"MIGRATION.EXECUTION_FAILED\", error instanceof Error ? error.message : String(error), {\n\t\tmeta: typeof errorCode === \"string\" ? { errorCode } : {},\n\t\tcause: error\n\t});\n}\n/** The structured error thrown while a space applied, keeping its code, advice and docs link, with the space and whether the database changed added to its facts. */\nfunction withSpaceFacts(error, failingSpace, databaseUnchanged) {\n\treturn Object.assign(error, { meta: {\n\t\t...error.meta ?? {},\n\t\tfailingSpace,\n\t\tdatabaseUnchanged\n\t} });\n}\nfunction stepHolds(rows) {\n\tconst value = rows[0] === void 0 ? void 0 : Object.values(rows[0])[0];\n\tif (typeof value === \"string\") return value !== \"0\" && value.length > 0;\n\treturn Boolean(value);\n}\nfunction skipRecord(operation) {\n\treturn Object.freeze({\n\t\tid: operation.id,\n\t\tlabel: operation.label,\n\t\t...ifDefined(\"summary\", operation.summary),\n\t\toperationClass: operation.operationClass,\n\t\ttarget: operation.target,\n\t\tprecheck: Object.freeze([]),\n\t\texecute: Object.freeze([]),\n\t\tpostcheck: Object.freeze([...operation.postcheck]),\n\t\tmeta: Object.freeze({\n\t\t\t...operation.meta ?? {},\n\t\t\trunner: Object.freeze({\n\t\t\t\tskipped: true,\n\t\t\t\treason: \"postcheck_pre_satisfied\"\n\t\t\t})\n\t\t})\n\t});\n}\n/**\n* The MySQL migration runner. MySQL commits every DDL statement as it runs, so no transaction can undo an apply: the runner applies one space at a time, checks each operation before and after it runs, verifies the space's schema with the caller's strictness (every space, not only the app space), and only then writes the space's marker and ledger entries, in one transaction. A failure leaves the spaces before it applied, and running the apply again skips what already holds. The whole apply holds the marker lock, which MySQL keeps for the session, so it is released on the same connection when the apply ends.\n*/\nvar MysqlMigrationRunner = class {\n\tfamily;\n\tconstructor(family) {\n\t\tthis.family = family;\n\t}\n\tasync execute(options) {\n\t\tconst { driver, perSpaceOptions } = options;\n\t\tif (perSpaceOptions.length === 0) return ok({ perSpaceResults: [] });\n\t\treturn withMarkerLock(driver, () => this.#applySpaces(driver, perSpaceOptions), (result) => result.ok);\n\t}\n\tasync executeOnConnection(options) {\n\t\treturn this.#applySpace(options, { changedDatabase: false });\n\t}\n\tasync #applySpaces(driver, perSpaceOptions) {\n\t\tconst perSpaceResults = [];\n\t\tlet changedBefore = false;\n\t\tfor (const spaceOptions of perSpaceOptions) {\n\t\t\tconst space = spaceOptions.space ?? spaceOptions.plan.spaceId;\n\t\t\tconst progress = { changedDatabase: false };\n\t\t\tlet result;\n\t\t\ttry {\n\t\t\t\tresult = await this.#applySpace({\n\t\t\t\t\t...spaceOptions,\n\t\t\t\t\tdriver,\n\t\t\t\t\tspace\n\t\t\t\t}, progress);\n\t\t\t} catch (error) {\n\t\t\t\tif (isInternalError(error)) throw error;\n\t\t\t\tconst databaseUnchanged = !changedBefore && !progress.changedDatabase;\n\t\t\t\tif (isStructuredError(error)) throw withSpaceFacts(error, space, databaseUnchanged);\n\t\t\t\tresult = notOk(failureFromThrown(error));\n\t\t\t}\n\t\t\tif (!result.ok) return notOk(withFailingSpace(withDatabaseUnchanged(result.failure, !changedBefore && !progress.changedDatabase), space));\n\t\t\tchangedBefore ||= progress.changedDatabase;\n\t\t\tperSpaceResults.push({\n\t\t\t\tspace,\n\t\t\t\tvalue: result.value\n\t\t\t});\n\t\t}\n\t\treturn ok({ perSpaceResults });\n\t}\n\tasync #applySpace(options, progress) {\n\t\tconst { driver } = options;\n\t\tif (options.space !== void 0 && options.space !== options.plan.spaceId) throw mysqlError(\"MIGRATION.CONTRACT_SPACE_VIOLATION\", `SqlMigrationRunner: options.space (${options.space}) does not match plan.spaceId (${options.plan.spaceId})`, { meta: {\n\t\t\tspace: options.space,\n\t\t\tplanSpaceId: options.plan.spaceId\n\t\t} });\n\t\tconst space = options.plan.spaceId;\n\t\tconst operations = blindCast(await Promise.all(options.plan.operations));\n\t\tconst destinationCheck = this.#checkDestination(options.plan.destination, options.destinationContract);\n\t\tif (!destinationCheck.ok) return destinationCheck;\n\t\tconst policyCheck = this.#checkPolicy(options.policy, operations);\n\t\tif (!policyCheck.ok) return policyCheck;\n\t\tawait this.#ensureControlTables(driver, options);\n\t\tconst existingMarker = await this.family.readMarker({\n\t\t\tdriver,\n\t\t\tspace\n\t\t});\n\t\tconst originCheck = this.#checkOrigin(existingMarker, options.plan.origin ?? null);\n\t\tif (!originCheck.ok) return originCheck;\n\t\tconst isSelfEdge = options.plan.origin?.storageHash === options.plan.destination.storageHash;\n\t\tconst applied = existingMarker !== null && existingMarker.storageHash === options.plan.destination.storageHash && (options.plan.destination.profileHash === void 0 || existingMarker.profileHash === options.plan.destination.profileHash) && options.plan.origin != null && !isSelfEdge ? {\n\t\t\tresult: okVoid(),\n\t\t\texecuted: [],\n\t\t\texecutedCount: 0\n\t\t} : await this.#applyOperations(driver, options, operations, progress);\n\t\tif (!applied.result.ok) return applied.result;\n\t\tconst schema = await this.family.introspect({\n\t\t\tdriver,\n\t\t\tcontract: options.destinationContract\n\t\t});\n\t\tconst verified = this.family.verifySchema({\n\t\t\tcontract: options.destinationContract,\n\t\t\tschema,\n\t\t\tstrict: options.strictVerification ?? true,\n\t\t\tframeworkComponents: options.frameworkComponents\n\t\t});\n\t\tif (!verified.ok) return runnerFailure(\"MIGRATION.SCHEMA_VERIFY_FAILED\", verified.summary, {\n\t\t\twhy: schemaCheckWhy(verified.schema.issues),\n\t\t\tmeta: { schemaIssues: verified.schema.issues }\n\t\t});\n\t\tconst existingInvariants = new Set(existingMarker?.invariants ?? []);\n\t\tif (!(isSelfEdge && applied.executedCount === 0 && options.plan.providedInvariants.every((id) => existingInvariants.has(id)))) {\n\t\t\tconst written = await this.#writeMarkerAndLedger(driver, options, existingMarker, applied.executed, progress);\n\t\t\tif (!written.ok) return written;\n\t\t}\n\t\treturn runnerSuccess({\n\t\t\toperationsPlanned: operations.length,\n\t\t\toperationsExecuted: applied.executedCount\n\t\t});\n\t}\n\tasync #ensureControlTables(driver, options) {\n\t\tfor (const query of this.family.bootstrapControlTableQueries()) {\n\t\t\tconst statement = await this.family.lowerAst(query, { contract: options.destinationContract });\n\t\t\tawait driver.query(statement.sql, statement.params);\n\t\t}\n\t}\n\tasync #applyOperations(driver, options, operations, progress) {\n\t\tconst checks = options.executionChecks;\n\t\tconst runPrechecks = checks?.prechecks !== false;\n\t\tconst runPostchecks = checks?.postchecks !== false;\n\t\tconst runIdempotency = checks?.idempotencyChecks !== false;\n\t\tconst executed = [];\n\t\tlet executedCount = 0;\n\t\tconst stop = (result) => ({\n\t\t\tresult,\n\t\t\texecuted,\n\t\t\texecutedCount\n\t\t});\n\t\tfor (const operation of operations) {\n\t\t\toptions.callbacks?.onOperationStart?.(operation);\n\t\t\ttry {\n\t\t\t\tif (runPostchecks && runIdempotency && await this.#allHold(driver, operation.postcheck)) {\n\t\t\t\t\texecuted.push(skipRecord(operation));\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (runPrechecks) {\n\t\t\t\t\tconst precheck = await this.#runChecks(driver, operation, \"precheck\");\n\t\t\t\t\tif (!precheck.ok) return stop(precheck);\n\t\t\t\t}\n\t\t\t\tconst execution = await this.#runSteps(driver, operation, progress);\n\t\t\t\tif (!execution.ok) return stop(execution);\n\t\t\t\texecutedCount += 1;\n\t\t\t\tif (runPostchecks) {\n\t\t\t\t\tconst postcheck = await this.#runChecks(driver, operation, \"postcheck\");\n\t\t\t\t\tif (!postcheck.ok) return stop(postcheck);\n\t\t\t\t}\n\t\t\t\texecuted.push(operation);\n\t\t\t} finally {\n\t\t\t\toptions.callbacks?.onOperationComplete?.(operation);\n\t\t\t}\n\t\t}\n\t\treturn stop(okVoid());\n\t}\n\tasync #allHold(driver, steps) {\n\t\tif (steps.length === 0) return false;\n\t\tfor (const step of steps) if (!stepHolds((await driver.query(step.sql, step.params ?? [])).rows)) return false;\n\t\treturn true;\n\t}\n\tasync #runChecks(driver, operation, phase) {\n\t\tfor (const step of operation[phase]) {\n\t\t\tif (stepHolds((await driver.query(step.sql, step.params ?? [])).rows)) continue;\n\t\t\tconst failedCheck = {\n\t\t\t\toperationId: operation.id,\n\t\t\t\tphase,\n\t\t\t\tdescription: step.description,\n\t\t\t\t...ifDefined(\"expectation\", step.expectation)\n\t\t\t};\n\t\t\treturn runnerFailure(phase === \"precheck\" ? \"MIGRATION.PRECHECK_FAILED\" : \"MIGRATION.POSTCHECK_FAILED\", `Operation ${operation.id} failed during ${phase}: ${step.description}`, {\n\t\t\t\twhy: phase === \"precheck\" ? failedPrecheckWhy(failedCheck) : failedPostcheckWhy(failedCheck),\n\t\t\t\tmeta: { failedCheck }\n\t\t\t});\n\t\t}\n\t\treturn okVoid();\n\t}\n\t/** Runs an operation's steps, and records in `progress` each one that reached the database, which a DDL statement changes for good. */\n\tasync #runSteps(driver, operation, progress) {\n\t\tfor (const step of operation.execute) try {\n\t\t\tawait driver.query(step.sql, step.params ?? []);\n\t\t\tprogress.changedDatabase = true;\n\t\t} catch (error) {\n\t\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\t\treturn runnerFailure(\"MIGRATION.EXECUTION_FAILED\", `Operation ${operation.id} failed during execution: ${step.description}`, {\n\t\t\t\twhy: message,\n\t\t\t\tmeta: {\n\t\t\t\t\toperationId: operation.id,\n\t\t\t\t\tstepDescription: step.description,\n\t\t\t\t\tsql: step.sql\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t\treturn okVoid();\n\t}\n\tasync #writeMarkerAndLedger(driver, options, existingMarker, executed, progress) {\n\t\tconst { plan } = options;\n\t\tconst destination = {\n\t\t\tstorageHash: plan.destination.storageHash,\n\t\t\tprofileHash: plan.destination.profileHash ?? options.destinationContract.profileHash ?? plan.destination.storageHash,\n\t\t\tinvariants: plan.providedInvariants\n\t\t};\n\t\tawait driver.query(\"START TRANSACTION\");\n\t\ttry {\n\t\t\tif (existingMarker === null) await this.family.initMarker({\n\t\t\t\tdriver,\n\t\t\t\tspace: plan.spaceId,\n\t\t\t\tdestination\n\t\t\t});\n\t\t\telse if (!await this.family.updateMarker({\n\t\t\t\tdriver,\n\t\t\t\tspace: plan.spaceId,\n\t\t\t\texpectedFrom: existingMarker.storageHash,\n\t\t\t\tdestination\n\t\t\t})) {\n\t\t\t\tawait driver.query(\"ROLLBACK\");\n\t\t\t\tconst found = await this.family.readMarker({\n\t\t\t\t\tdriver,\n\t\t\t\t\tspace: plan.spaceId\n\t\t\t\t});\n\t\t\t\treturn runnerFailure(\"MIGRATION.MARKER_CAS_FAILURE\", \"Marker was modified by another process during migration execution.\", { meta: {\n\t\t\t\t\tspace: plan.spaceId,\n\t\t\t\t\texpectedStorageHash: existingMarker.storageHash,\n\t\t\t\t\tfoundStorageHash: found?.storageHash ?? null,\n\t\t\t\t\tdestinationStorageHash: plan.destination.storageHash\n\t\t\t\t} });\n\t\t\t}\n\t\t\tawait this.#writeLedger(driver, options, executed);\n\t\t} catch (error) {\n\t\t\tawait driver.query(\"ROLLBACK\").catch(() => void 0);\n\t\t\tthrow error;\n\t\t}\n\t\tprogress.changedDatabase = true;\n\t\tawait driver.query(\"COMMIT\");\n\t\treturn okVoid();\n\t}\n\tasync #writeLedger(driver, options, executed) {\n\t\tconst { plan, migrationEdges } = options;\n\t\tconst edgeOperations = migrationEdges.reduce((sum, edge) => sum + edge.operationCount, 0);\n\t\tif (edgeOperations !== plan.operations.length) throw new InternalError(`Ledger write: plan.operations length (${plan.operations.length}) does not match sum of migrationEdges operationCount (${edgeOperations})`);\n\t\tlet offset = 0;\n\t\tfor (const edge of migrationEdges) {\n\t\t\tconst operations = executed.slice(offset, offset + edge.operationCount);\n\t\t\toffset += edge.operationCount;\n\t\t\tawait this.family.writeLedgerEntry({\n\t\t\t\tdriver,\n\t\t\t\tspace: plan.spaceId,\n\t\t\t\tentry: {\n\t\t\t\t\tedgeId: `${edge.from}->${edge.to}`,\n\t\t\t\t\tfrom: edge.from,\n\t\t\t\t\tto: edge.to,\n\t\t\t\t\tmigrationName: edge.dirName,\n\t\t\t\t\tmigrationHash: edge.migrationHash,\n\t\t\t\t\toperations\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\t#checkDestination(destination, contract) {\n\t\tif (destination.storageHash !== contract.storage.storageHash) return runnerFailure(\"MIGRATION.DESTINATION_CONTRACT_MISMATCH\", `Plan destination storage hash (${destination.storageHash}) does not match provided contract storage hash (${contract.storage.storageHash}).`, { meta: {\n\t\t\tplanStorageHash: destination.storageHash,\n\t\t\tcontractStorageHash: contract.storage.storageHash\n\t\t} });\n\t\tif (destination.profileHash !== void 0 && contract.profileHash !== void 0 && destination.profileHash !== contract.profileHash) return runnerFailure(\"MIGRATION.DESTINATION_CONTRACT_MISMATCH\", `Plan destination profile hash (${destination.profileHash}) does not match provided contract profile hash (${contract.profileHash}).`, { meta: {\n\t\t\tplanProfileHash: destination.profileHash,\n\t\t\tcontractProfileHash: contract.profileHash\n\t\t} });\n\t\treturn okVoid();\n\t}\n\t#checkPolicy(policy, operations) {\n\t\tconst allowed = new Set(policy.allowedOperationClasses);\n\t\tconst refused = operations.find((operation) => !allowed.has(operation.operationClass));\n\t\tif (refused === void 0) return okVoid();\n\t\treturn runnerFailure(\"MIGRATION.POLICY_VIOLATION\", `Operation ${refused.id} has class \"${refused.operationClass}\" which is not allowed by policy.`, {\n\t\t\twhy: `Policy only allows: ${policy.allowedOperationClasses.join(\", \")}.`,\n\t\t\tmeta: {\n\t\t\t\toperationId: refused.id,\n\t\t\t\toperationClass: refused.operationClass,\n\t\t\t\tallowedClasses: policy.allowedOperationClasses\n\t\t\t}\n\t\t});\n\t}\n\t#checkOrigin(marker, origin) {\n\t\tif (origin === null) return okVoid();\n\t\tif (marker === null) return runnerFailure(\"MIGRATION.MARKER_ORIGIN_MISMATCH\", `Missing contract marker: expected origin storage hash ${origin.storageHash}.`, { meta: { expectedOriginStorageHash: origin.storageHash } });\n\t\tif (marker.storageHash !== origin.storageHash) return runnerFailure(\"MIGRATION.MARKER_ORIGIN_MISMATCH\", `Existing contract marker (${marker.storageHash}) does not match plan origin (${origin.storageHash}).`, { meta: {\n\t\t\tmarkerStorageHash: marker.storageHash,\n\t\t\texpectedOriginStorageHash: origin.storageHash\n\t\t} });\n\t\tif (origin.profileHash !== void 0 && marker.profileHash !== origin.profileHash) return runnerFailure(\"MIGRATION.MARKER_ORIGIN_MISMATCH\", `Existing contract marker profile hash (${marker.profileHash}) does not match plan origin profile hash (${origin.profileHash}).`, { meta: {\n\t\t\tmarkerProfileHash: marker.profileHash,\n\t\t\texpectedOriginProfileHash: origin.profileHash\n\t\t} });\n\t\treturn okVoid();\n\t}\n};\nfunction createMysqlMigrationRunner(family) {\n\treturn new MysqlMigrationRunner(family);\n}\n//#endregion\nexport { MYSQL_MIGRATION_MODULE as _, MysqlMigration as a, diffMysqlSchema as b, AddForeignKeyCall as c, CreateTableCall as d, DropColumnCall as f, DropUniqueCall as g, DropTableCall as h, TypeScriptRenderableMysqlMigration as i, AddUniqueCall as l, DropIndexCall as m, MysqlMigrationPlanner as n, MysqlMigrationBase as o, DropForeignKeyCall as p, createMysqlMigrationPlanner as r, AddColumnCall as s, createMysqlMigrationRunner as t, CreateIndexCall as u, RawSqlCall as v, mysqlContractToSchema as x, rawSql as y };\n\n//# sourceMappingURL=runner-BIjAWX-E.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,SAAS,sBAAsB,UAAU,OAAO;CAC/C,OAAO,mBAAmB,UAAU;EACnC,qBAAqB;EACrB,gBAAgB;EAChB,gBAAgB,MAAM;EACtB,aAAa,MAAM;CACpB,CAAC;AACF;;AAEA,SAAS,qBAAqB,OAAO,UAAU;CAC9C,MAAM,YAAY,MAAM,KAAK;CAC7B,IAAI,cAAc,KAAK,GAAG,OAAO,KAAK;CACtC,KAAK,MAAM,eAAe,OAAO,KAAK,SAAS,QAAQ,UAAU,GAAG;EACnE,MAAM,QAAQ,SAAS,SAAS,SAAS;GACxC;GACA,YAAY;GACZ,YAAY;EACb,CAAC;EACD,IAAI,UAAU,KAAK,GAAG,OAAO,MAAM;CACpC;AACD;;AAEA,SAAS,gBAAgB,OAAO;CAC/B,IAAI,EAAE,MAAM,kBAAkB,cAAc,MAAM,WAAW,4BAA4B,sFAAsF;CAC/K,MAAM,WAAW,sBAAsB,MAAM,UAAU,iBAAiB,MAAM,mBAAmB,CAAC;CAClG,MAAM,SAAS,MAAM;CACrB,MAAM,uBAAuB,OAAO,OAAO,MAAM,SAAS,QAAQ,UAAU,CAAC,CAAC,QAAQ,OAAO,OAAO,KAAK,GA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