turbine-orm 0.93.1 → 0.94.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +49 -23
- package/dist/adapters/cockroachdb.d.ts +3 -3
- package/dist/adapters/cockroachdb.js +7 -11
- package/dist/adapters/index.d.ts +1 -1
- package/dist/adapters/yugabytedb.js +1 -1
- package/dist/better-sqlite3.d.ts +132 -0
- package/dist/better-sqlite3.js +303 -0
- package/dist/catalog-metadata.d.ts +250 -0
- package/dist/catalog-metadata.js +730 -0
- package/dist/cjs/adapters/cockroachdb.d.ts +3 -3
- package/dist/cjs/adapters/cockroachdb.js +7 -11
- package/dist/cjs/adapters/index.d.ts +1 -1
- package/dist/cjs/adapters/yugabytedb.js +1 -1
- package/dist/cjs/better-sqlite3.d.ts +132 -0
- package/dist/cjs/better-sqlite3.js +311 -0
- package/dist/cjs/catalog-metadata.d.ts +250 -0
- package/dist/cjs/catalog-metadata.js +747 -0
- package/dist/cjs/cli/compile-query.d.ts +6 -3
- package/dist/cjs/cli/compile-query.js +24 -3
- package/dist/cjs/cli/config.d.ts +35 -10
- package/dist/cjs/cli/config.js +173 -42
- package/dist/cjs/cli/d1-config.d.ts +14 -0
- package/dist/cjs/cli/d1-config.js +9 -0
- package/dist/cjs/cli/d1-local.d.ts +31 -0
- package/dist/cjs/cli/d1-local.js +298 -0
- package/dist/cjs/cli/d1-migrations.d.ts +16 -0
- package/dist/cjs/cli/d1-migrations.js +156 -0
- package/dist/cjs/cli/d1-project.d.ts +23 -0
- package/dist/cjs/cli/d1-project.js +314 -0
- package/dist/cjs/cli/d1-seed.d.ts +35 -0
- package/dist/cjs/cli/d1-seed.js +220 -0
- package/dist/cjs/cli/destructive.js +1 -2
- package/dist/cjs/cli/error-catalog.d.ts +3 -3
- package/dist/cjs/cli/error-catalog.js +21 -3
- package/dist/cjs/cli/index.d.ts +13 -8
- package/dist/cjs/cli/index.js +503 -71
- package/dist/cjs/cli/libsql-migrate-command.d.ts +5 -0
- package/dist/cjs/cli/libsql-migrate-command.js +82 -0
- package/dist/cjs/cli/libsql-migrate-status.d.ts +33 -0
- package/dist/cjs/cli/libsql-migrate-status.js +189 -0
- package/dist/cjs/cli/libsql-migrate.d.ts +14 -0
- package/dist/cjs/cli/libsql-migrate.js +522 -0
- package/dist/cjs/cli/libsql-project-config.d.ts +11 -0
- package/dist/cjs/cli/libsql-project-config.js +59 -0
- package/dist/cjs/cli/libsql-project.d.ts +52 -0
- package/dist/cjs/cli/libsql-project.js +409 -0
- package/dist/cjs/cli/libsql-seed-command.d.ts +29 -0
- package/dist/cjs/cli/libsql-seed-command.js +93 -0
- package/dist/cjs/cli/loader.d.ts +6 -5
- package/dist/cjs/cli/loader.js +53 -9
- package/dist/cjs/cli/mcp.d.ts +16 -1
- package/dist/cjs/cli/mcp.js +219 -125
- package/dist/cjs/cli/migrate.d.ts +2 -2
- package/dist/cjs/cli/migrate.js +29 -14
- package/dist/cjs/cli/mssql-doctor.d.ts +44 -0
- package/dist/cjs/cli/mssql-doctor.js +277 -0
- package/dist/cjs/cli/mssql-migrate-command.d.ts +9 -0
- package/dist/cjs/cli/mssql-migrate-command.js +230 -0
- package/dist/cjs/cli/mssql-migrate-connection.d.ts +51 -0
- package/dist/cjs/cli/mssql-migrate-connection.js +255 -0
- package/dist/cjs/cli/mssql-migrate-sql.d.ts +12 -0
- package/dist/cjs/cli/mssql-migrate-sql.js +282 -0
- package/dist/cjs/cli/mssql-migrate.d.ts +45 -0
- package/dist/cjs/cli/mssql-migrate.js +296 -0
- package/dist/cjs/cli/mssql-project.d.ts +34 -0
- package/dist/cjs/cli/mssql-project.js +171 -0
- package/dist/cjs/cli/mssql-seed.d.ts +7 -0
- package/dist/cjs/cli/mssql-seed.js +78 -0
- package/dist/cjs/cli/mssql-tools.d.ts +37 -0
- package/dist/cjs/cli/mssql-tools.js +354 -0
- package/dist/cjs/cli/mysql-doctor.d.ts +48 -0
- package/dist/cjs/cli/mysql-doctor.js +323 -0
- package/dist/cjs/cli/mysql-migrate-command.d.ts +7 -0
- package/dist/cjs/cli/mysql-migrate-command.js +290 -0
- package/dist/cjs/cli/mysql-migrate-sql.d.ts +18 -0
- package/dist/cjs/cli/mysql-migrate-sql.js +166 -0
- package/dist/cjs/cli/mysql-migrate.d.ts +77 -0
- package/dist/cjs/cli/mysql-migrate.js +619 -0
- package/dist/cjs/cli/mysql-project.d.ts +49 -0
- package/dist/cjs/cli/mysql-project.js +284 -0
- package/dist/cjs/cli/mysql-push-command.d.ts +7 -0
- package/dist/cjs/cli/mysql-push-command.js +94 -0
- package/dist/cjs/cli/mysql-push.d.ts +15 -0
- package/dist/cjs/cli/mysql-push.js +98 -0
- package/dist/cjs/cli/mysql-schema-command.d.ts +5 -0
- package/dist/cjs/cli/mysql-schema-command.js +58 -0
- package/dist/cjs/cli/mysql-schema-ddl.d.ts +37 -0
- package/dist/cjs/cli/mysql-schema-ddl.js +234 -0
- package/dist/cjs/cli/mysql-schema-snapshot.d.ts +21 -0
- package/dist/cjs/cli/mysql-schema-snapshot.js +127 -0
- package/dist/cjs/cli/mysql-schema.d.ts +27 -0
- package/dist/cjs/cli/mysql-schema.js +206 -0
- package/dist/cjs/cli/mysql-seed-loader.cjs +58 -0
- package/dist/cjs/cli/mysql-seed-loader.d.cts +3 -0
- package/dist/cjs/cli/mysql-seed.d.ts +6 -0
- package/dist/cjs/cli/mysql-seed.js +83 -0
- package/dist/cjs/cli/mysql-tools.d.ts +44 -0
- package/dist/cjs/cli/mysql-tools.js +336 -0
- package/dist/cjs/cli/no-follow.d.ts +29 -0
- package/dist/cjs/cli/no-follow.js +73 -0
- package/dist/cjs/cli/pii-predicate-guard.d.ts +1 -1
- package/dist/cjs/cli/pii-predicate-guard.js +2 -2
- package/dist/cjs/cli/pii-tags.d.ts +2 -2
- package/dist/cjs/cli/pii-tags.js +1 -1
- package/dist/cjs/cli/prisma-schema.js +2 -2
- package/dist/cjs/cli/sql-statements.d.ts +1 -1
- package/dist/cjs/cli/sql-statements.js +1 -1
- package/dist/cjs/cli/sqlite-doctor.d.ts +35 -0
- package/dist/cjs/cli/sqlite-doctor.js +400 -0
- package/dist/cjs/cli/sqlite-migrate-command.d.ts +4 -0
- package/dist/cjs/cli/sqlite-migrate-command.js +175 -0
- package/dist/cjs/cli/sqlite-migrate.d.ts +61 -0
- package/dist/cjs/cli/sqlite-migrate.js +692 -0
- package/dist/cjs/cli/sqlite-project.d.ts +42 -0
- package/dist/cjs/cli/sqlite-project.js +254 -0
- package/dist/cjs/cli/sqlite-schema-command.d.ts +4 -0
- package/dist/cjs/cli/sqlite-schema-command.js +82 -0
- package/dist/cjs/cli/sqlite-schema-ddl.d.ts +25 -0
- package/dist/cjs/cli/sqlite-schema-ddl.js +252 -0
- package/dist/cjs/cli/sqlite-schema.d.ts +25 -0
- package/dist/cjs/cli/sqlite-schema.js +334 -0
- package/dist/cjs/cli/sqlite-seed.d.ts +4 -0
- package/dist/cjs/cli/sqlite-seed.js +94 -0
- package/dist/cjs/cli/sqlite-tools.d.ts +24 -0
- package/dist/cjs/cli/sqlite-tools.js +169 -0
- package/dist/cjs/cli/studio.js +9 -9
- package/dist/cjs/cli/tool-capabilities.d.ts +72 -0
- package/dist/cjs/cli/tool-capabilities.js +120 -0
- package/dist/cjs/cli/tool-command.d.ts +11 -0
- package/dist/cjs/cli/tool-command.js +49 -0
- package/dist/cjs/cli/ui.d.ts +1 -1
- package/dist/cjs/cli/ui.js +1 -1
- package/dist/cjs/client.d.ts +20 -20
- package/dist/cjs/client.js +65 -344
- package/dist/cjs/connection-url.d.ts +1 -1
- package/dist/cjs/connection-url.js +1 -1
- package/dist/cjs/core.d.ts +58 -0
- package/dist/cjs/core.js +225 -0
- package/dist/cjs/d1/catalog-metadata.d.ts +5 -0
- package/dist/cjs/d1/catalog-metadata.js +230 -0
- package/dist/cjs/d1/catalog.d.ts +15 -0
- package/dist/cjs/d1/catalog.js +88 -0
- package/dist/cjs/d1/generate.d.ts +8 -0
- package/dist/cjs/d1/generate.js +163 -0
- package/dist/cjs/d1/introspect.d.ts +21 -0
- package/dist/cjs/d1/introspect.js +74 -0
- package/dist/cjs/d1/migrate.d.ts +29 -0
- package/dist/cjs/d1/migrate.js +222 -0
- package/dist/cjs/d1/migrations/sql.d.ts +2 -0
- package/dist/cjs/d1/migrations/sql.js +109 -0
- package/dist/cjs/d1/pool.d.ts +14 -0
- package/dist/cjs/d1/pool.js +90 -0
- package/dist/cjs/d1/sql.d.ts +5 -0
- package/dist/cjs/d1/sql.js +140 -0
- package/dist/cjs/d1/sqlite-dialect.d.ts +16 -0
- package/dist/cjs/d1/sqlite-dialect.js +579 -0
- package/dist/cjs/d1/types.d.ts +29 -0
- package/dist/cjs/d1/types.js +2 -0
- package/dist/cjs/d1.d.ts +53 -0
- package/dist/cjs/d1.js +220 -0
- package/dist/cjs/dialect.d.ts +33 -5
- package/dist/cjs/dialect.js +8 -6
- package/dist/cjs/errors.d.ts +38 -1
- package/dist/cjs/errors.js +72 -18
- package/dist/cjs/generate.d.ts +19 -3
- package/dist/cjs/generate.js +330 -97
- package/dist/cjs/global-filters-config.js +4 -4
- package/dist/cjs/index-advisor.js +6 -6
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/index.js +3 -2
- package/dist/cjs/introspect.d.ts +59 -356
- package/dist/cjs/introspect.js +158 -984
- package/dist/cjs/libsql/bindings.d.ts +2 -0
- package/dist/cjs/libsql/bindings.js +78 -0
- package/dist/cjs/libsql/dialect.d.ts +3 -0
- package/dist/cjs/libsql/dialect.js +48 -0
- package/dist/cjs/libsql/generate.d.ts +4 -0
- package/dist/cjs/libsql/generate.js +56 -0
- package/dist/cjs/libsql/introspect.d.ts +16 -0
- package/dist/cjs/libsql/introspect.js +295 -0
- package/dist/cjs/libsql/pool.d.ts +42 -0
- package/dist/cjs/libsql/pool.js +275 -0
- package/dist/cjs/libsql/seed-cleanup.d.ts +2 -0
- package/dist/cjs/libsql/seed-cleanup.js +19 -0
- package/dist/cjs/libsql/values.d.ts +20 -0
- package/dist/cjs/libsql/values.js +75 -0
- package/dist/cjs/libsql-seed.d.ts +19 -0
- package/dist/cjs/libsql-seed.js +50 -0
- package/dist/cjs/libsql.d.ts +28 -0
- package/dist/cjs/libsql.js +88 -0
- package/dist/cjs/live-query.d.ts +33 -0
- package/dist/cjs/live-query.js +172 -0
- package/dist/cjs/log-codes.d.ts +1 -1
- package/dist/cjs/log-codes.js +4 -0
- package/dist/cjs/mssql-seed.d.ts +27 -0
- package/dist/cjs/mssql-seed.js +118 -0
- package/dist/cjs/mssql.d.ts +7 -7
- package/dist/cjs/mssql.js +365 -53
- package/dist/cjs/mysql-seed.d.ts +25 -0
- package/dist/cjs/mysql-seed.js +169 -0
- package/dist/cjs/mysql.d.ts +18 -6
- package/dist/cjs/mysql.js +602 -94
- package/dist/cjs/neon-http/client.d.ts +95 -0
- package/dist/cjs/neon-http/client.js +291 -0
- package/dist/cjs/neon-http/sql.d.ts +3 -0
- package/dist/cjs/neon-http/sql.js +116 -0
- package/dist/cjs/neon-http.d.ts +5 -0
- package/dist/cjs/neon-http.js +8 -0
- package/dist/cjs/neon-ws/load-driver.cjs +44 -0
- package/dist/cjs/neon-ws/load-driver.d.cts +9 -0
- package/dist/cjs/neon-ws/recovery.d.ts +14 -0
- package/dist/cjs/neon-ws/recovery.js +69 -0
- package/dist/cjs/neon-ws/snapshot.d.ts +3 -0
- package/dist/cjs/neon-ws/snapshot.js +17 -0
- package/dist/cjs/neon-ws/transport.d.ts +112 -0
- package/dist/cjs/neon-ws/transport.js +290 -0
- package/dist/cjs/neon-ws.d.ts +26 -0
- package/dist/cjs/neon-ws.js +189 -0
- package/dist/cjs/nested-write.d.ts +34 -3
- package/dist/cjs/nested-write.js +117 -24
- package/dist/cjs/notification-hub/consumer.d.ts +22 -0
- package/dist/cjs/notification-hub/consumer.js +111 -0
- package/dist/cjs/notification-hub.d.ts +41 -0
- package/dist/cjs/notification-hub.js +373 -0
- package/dist/cjs/pg-catalog-text.d.ts +96 -0
- package/dist/cjs/pg-catalog-text.js +213 -0
- package/dist/cjs/pg-types.d.ts +46 -2
- package/dist/cjs/pipeline-submittable.d.ts +15 -5
- package/dist/cjs/pipeline-submittable.js +103 -48
- package/dist/cjs/pipeline.d.ts +5 -2
- package/dist/cjs/pipeline.js +111 -41
- package/dist/cjs/plan-divergence.d.ts +1 -1
- package/dist/cjs/plan-divergence.js +1 -1
- package/dist/cjs/powdb-introspect.d.ts +1 -1
- package/dist/cjs/powdb-introspect.js +5 -5
- package/dist/cjs/powdb-shared.d.ts +5 -5
- package/dist/cjs/powdb-shared.js +6 -5
- package/dist/cjs/powdb.d.ts +28 -10
- package/dist/cjs/powdb.js +80 -28
- package/dist/cjs/powql.d.ts +50 -28
- package/dist/cjs/powql.js +47 -33
- package/dist/cjs/prisma-compat.js +4 -5
- package/dist/cjs/prisma-schema-fingerprint.d.ts +1 -1
- package/dist/cjs/prisma-schema-fingerprint.js +1 -1
- package/dist/cjs/query/aggregates.d.ts +0 -13
- package/dist/cjs/query/aggregates.js +105 -238
- package/dist/cjs/query/batched-loader.d.ts +1 -1
- package/dist/cjs/query/batched-loader.js +18 -20
- package/dist/cjs/query/builder.d.ts +108 -144
- package/dist/cjs/query/builder.js +592 -893
- package/dist/cjs/query/compound-unique.d.ts +18 -3
- package/dist/cjs/query/compound-unique.js +110 -43
- package/dist/cjs/query/cursor-tuple.d.ts +17 -0
- package/dist/cjs/query/cursor-tuple.js +121 -0
- package/dist/cjs/query/expr.d.ts +2 -0
- package/dist/cjs/query/expr.js +40 -23
- package/dist/cjs/query/filters.d.ts +39 -7
- package/dist/cjs/query/filters.js +77 -19
- package/dist/cjs/query/normalize-args.d.ts +1 -1
- package/dist/cjs/query/normalize-args.js +7 -5
- package/dist/cjs/query/option-surface.d.ts +1 -1
- package/dist/cjs/query/option-surface.js +5 -3
- package/dist/cjs/query/pg-type-parsers.d.ts +126 -0
- package/dist/cjs/query/pg-type-parsers.js +306 -0
- package/dist/cjs/query/relation-names.d.ts +4 -2
- package/dist/cjs/query/relation-names.js +21 -12
- package/dist/cjs/query/relations.d.ts +19 -7
- package/dist/cjs/query/relations.js +329 -260
- package/dist/cjs/query/row-lock.js +3 -3
- package/dist/cjs/query/sql-comment.js +3 -3
- package/dist/cjs/query/stream-idle.d.ts +11 -1
- package/dist/cjs/query/stream-idle.js +53 -13
- package/dist/cjs/query/stream-signal.d.ts +21 -0
- package/dist/cjs/query/stream-signal.js +132 -0
- package/dist/cjs/query/temporal-parsers.d.ts +101 -0
- package/dist/cjs/query/temporal-parsers.js +362 -0
- package/dist/cjs/query/types.d.ts +67 -20
- package/dist/cjs/query/utils.d.ts +2 -878
- package/dist/cjs/query/utils.js +25 -2058
- package/dist/cjs/query/warn-registry.d.ts +1 -1
- package/dist/cjs/query/warn-registry.js +1 -1
- package/dist/cjs/query/where-compile.d.ts +4 -1
- package/dist/cjs/query/where-compile.js +18 -14
- package/dist/cjs/query/where.d.ts +14 -7
- package/dist/cjs/query/where.js +244 -436
- package/dist/cjs/query/writes.d.ts +33 -2
- package/dist/cjs/query/writes.js +104 -77
- package/dist/cjs/query-utils.d.ts +687 -0
- package/dist/cjs/query-utils.js +1444 -0
- package/dist/cjs/realtime.d.ts +1 -1
- package/dist/cjs/realtime.js +3 -3
- package/dist/cjs/schema-builder.js +2 -2
- package/dist/cjs/schema-metadata.d.ts +13 -3
- package/dist/cjs/schema-metadata.js +33 -5
- package/dist/cjs/schema-sql.d.ts +15 -24
- package/dist/cjs/schema-sql.js +53 -63
- package/dist/cjs/schema.d.ts +37 -2
- package/dist/cjs/schema.js +29 -2
- package/dist/cjs/seed.js +5 -5
- package/dist/cjs/serverless.d.ts +24 -71
- package/dist/cjs/serverless.js +24 -71
- package/dist/cjs/sql.d.ts +111 -0
- package/dist/cjs/sql.js +335 -0
- package/dist/cjs/sqlite-seed.d.ts +17 -0
- package/dist/cjs/sqlite-seed.js +31 -0
- package/dist/cjs/sqlite.d.ts +32 -19
- package/dist/cjs/sqlite.js +865 -652
- package/dist/cjs/supplied-pool-types.js +10 -9
- package/dist/cjs/transaction-control.js +6 -1
- package/dist/cjs/transaction-outcome.d.ts +61 -0
- package/dist/cjs/transaction-outcome.js +239 -0
- package/dist/cjs/transaction-state.d.ts +82 -13
- package/dist/cjs/transaction-state.js +222 -56
- package/dist/cjs/transaction-transport.d.ts +38 -0
- package/dist/cjs/transaction-transport.js +157 -0
- package/dist/cjs/typed-sql.d.ts +1 -1
- package/dist/cjs/typed-sql.js +1 -1
- package/dist/cli/compile-query.d.ts +6 -3
- package/dist/cli/compile-query.js +25 -4
- package/dist/cli/config.d.ts +35 -10
- package/dist/cli/config.js +170 -43
- package/dist/cli/d1-config.d.ts +14 -0
- package/dist/cli/d1-config.js +6 -0
- package/dist/cli/d1-local.d.ts +31 -0
- package/dist/cli/d1-local.js +285 -0
- package/dist/cli/d1-migrations.d.ts +16 -0
- package/dist/cli/d1-migrations.js +151 -0
- package/dist/cli/d1-project.d.ts +23 -0
- package/dist/cli/d1-project.js +304 -0
- package/dist/cli/d1-seed.d.ts +35 -0
- package/dist/cli/d1-seed.js +213 -0
- package/dist/cli/destructive.js +1 -2
- package/dist/cli/error-catalog.d.ts +3 -3
- package/dist/cli/error-catalog.js +21 -3
- package/dist/cli/index.d.ts +13 -8
- package/dist/cli/index.js +500 -71
- package/dist/cli/libsql-migrate-command.d.ts +5 -0
- package/dist/cli/libsql-migrate-command.js +77 -0
- package/dist/cli/libsql-migrate-status.d.ts +33 -0
- package/dist/cli/libsql-migrate-status.js +182 -0
- package/dist/cli/libsql-migrate.d.ts +14 -0
- package/dist/cli/libsql-migrate.js +516 -0
- package/dist/cli/libsql-project-config.d.ts +11 -0
- package/dist/cli/libsql-project-config.js +55 -0
- package/dist/cli/libsql-project.d.ts +52 -0
- package/dist/cli/libsql-project.js +391 -0
- package/dist/cli/libsql-seed-command.d.ts +29 -0
- package/dist/cli/libsql-seed-command.js +85 -0
- package/dist/cli/loader.d.ts +6 -5
- package/dist/cli/loader.js +50 -9
- package/dist/cli/mcp.d.ts +16 -1
- package/dist/cli/mcp.js +220 -127
- package/dist/cli/migrate.d.ts +2 -2
- package/dist/cli/migrate.js +29 -14
- package/dist/cli/mssql-doctor.d.ts +44 -0
- package/dist/cli/mssql-doctor.js +237 -0
- package/dist/cli/mssql-migrate-command.d.ts +9 -0
- package/dist/cli/mssql-migrate-command.js +192 -0
- package/dist/cli/mssql-migrate-connection.d.ts +51 -0
- package/dist/cli/mssql-migrate-connection.js +245 -0
- package/dist/cli/mssql-migrate-sql.d.ts +12 -0
- package/dist/cli/mssql-migrate-sql.js +275 -0
- package/dist/cli/mssql-migrate.d.ts +45 -0
- package/dist/cli/mssql-migrate.js +290 -0
- package/dist/cli/mssql-project.d.ts +34 -0
- package/dist/cli/mssql-project.js +160 -0
- package/dist/cli/mssql-seed.d.ts +7 -0
- package/dist/cli/mssql-seed.js +73 -0
- package/dist/cli/mssql-tools.d.ts +37 -0
- package/dist/cli/mssql-tools.js +341 -0
- package/dist/cli/mysql-doctor.d.ts +48 -0
- package/dist/cli/mysql-doctor.js +316 -0
- package/dist/cli/mysql-migrate-command.d.ts +7 -0
- package/dist/cli/mysql-migrate-command.js +285 -0
- package/dist/cli/mysql-migrate-sql.d.ts +18 -0
- package/dist/cli/mysql-migrate-sql.js +162 -0
- package/dist/cli/mysql-migrate.d.ts +77 -0
- package/dist/cli/mysql-migrate.js +606 -0
- package/dist/cli/mysql-project.d.ts +49 -0
- package/dist/cli/mysql-project.js +272 -0
- package/dist/cli/mysql-push-command.d.ts +7 -0
- package/dist/cli/mysql-push-command.js +89 -0
- package/dist/cli/mysql-push.d.ts +15 -0
- package/dist/cli/mysql-push.js +95 -0
- package/dist/cli/mysql-schema-command.d.ts +5 -0
- package/dist/cli/mysql-schema-command.js +54 -0
- package/dist/cli/mysql-schema-ddl.d.ts +37 -0
- package/dist/cli/mysql-schema-ddl.js +227 -0
- package/dist/cli/mysql-schema-snapshot.d.ts +21 -0
- package/dist/cli/mysql-schema-snapshot.js +119 -0
- package/dist/cli/mysql-schema.d.ts +27 -0
- package/dist/cli/mysql-schema.js +200 -0
- package/dist/cli/mysql-seed-loader.cjs +25 -0
- package/dist/cli/mysql-seed-loader.d.cts +3 -0
- package/dist/cli/mysql-seed.d.ts +6 -0
- package/dist/cli/mysql-seed.js +75 -0
- package/dist/cli/mysql-tools.d.ts +44 -0
- package/dist/cli/mysql-tools.js +290 -0
- package/dist/cli/no-follow.d.ts +29 -0
- package/dist/cli/no-follow.js +67 -0
- package/dist/cli/pii-predicate-guard.d.ts +1 -1
- package/dist/cli/pii-predicate-guard.js +2 -2
- package/dist/cli/pii-tags.d.ts +2 -2
- package/dist/cli/pii-tags.js +1 -1
- package/dist/cli/prisma-schema.js +2 -2
- package/dist/cli/sql-statements.d.ts +1 -1
- package/dist/cli/sql-statements.js +1 -1
- package/dist/cli/sqlite-doctor.d.ts +35 -0
- package/dist/cli/sqlite-doctor.js +392 -0
- package/dist/cli/sqlite-migrate-command.d.ts +4 -0
- package/dist/cli/sqlite-migrate-command.js +171 -0
- package/dist/cli/sqlite-migrate.d.ts +61 -0
- package/dist/cli/sqlite-migrate.js +681 -0
- package/dist/cli/sqlite-project.d.ts +42 -0
- package/dist/cli/sqlite-project.js +244 -0
- package/dist/cli/sqlite-schema-command.d.ts +4 -0
- package/dist/cli/sqlite-schema-command.js +79 -0
- package/dist/cli/sqlite-schema-ddl.d.ts +25 -0
- package/dist/cli/sqlite-schema-ddl.js +248 -0
- package/dist/cli/sqlite-schema.d.ts +25 -0
- package/dist/cli/sqlite-schema.js +330 -0
- package/dist/cli/sqlite-seed.d.ts +4 -0
- package/dist/cli/sqlite-seed.js +57 -0
- package/dist/cli/sqlite-tools.d.ts +24 -0
- package/dist/cli/sqlite-tools.js +163 -0
- package/dist/cli/studio.js +9 -9
- package/dist/cli/tool-capabilities.d.ts +72 -0
- package/dist/cli/tool-capabilities.js +114 -0
- package/dist/cli/tool-command.d.ts +11 -0
- package/dist/cli/tool-command.js +45 -0
- package/dist/cli/ui.d.ts +1 -1
- package/dist/cli/ui.js +1 -1
- package/dist/client.d.ts +20 -20
- package/dist/client.js +62 -341
- package/dist/connection-url.d.ts +1 -1
- package/dist/connection-url.js +1 -1
- package/dist/core.d.ts +58 -0
- package/dist/core.js +220 -0
- package/dist/d1/catalog-metadata.d.ts +5 -0
- package/dist/d1/catalog-metadata.js +227 -0
- package/dist/d1/catalog.d.ts +15 -0
- package/dist/d1/catalog.js +82 -0
- package/dist/d1/generate.d.ts +8 -0
- package/dist/d1/generate.js +160 -0
- package/dist/d1/introspect.d.ts +21 -0
- package/dist/d1/introspect.js +71 -0
- package/dist/d1/migrate.d.ts +29 -0
- package/dist/d1/migrate.js +217 -0
- package/dist/d1/migrations/sql.d.ts +2 -0
- package/dist/d1/migrations/sql.js +106 -0
- package/dist/d1/pool.d.ts +14 -0
- package/dist/d1/pool.js +86 -0
- package/dist/d1/sql.d.ts +5 -0
- package/dist/d1/sql.js +135 -0
- package/dist/d1/sqlite-dialect.d.ts +16 -0
- package/dist/d1/sqlite-dialect.js +572 -0
- package/dist/d1/types.d.ts +29 -0
- package/dist/d1/types.js +1 -0
- package/dist/d1.d.ts +53 -0
- package/dist/d1.js +215 -0
- package/dist/dialect.d.ts +33 -5
- package/dist/dialect.js +6 -4
- package/dist/errors.d.ts +38 -1
- package/dist/errors.js +68 -17
- package/dist/generate.d.ts +19 -3
- package/dist/generate.js +330 -97
- package/dist/global-filters-config.js +2 -2
- package/dist/index-advisor.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/introspect.d.ts +59 -356
- package/dist/introspect.js +116 -943
- package/dist/libsql/bindings.d.ts +2 -0
- package/dist/libsql/bindings.js +75 -0
- package/dist/libsql/dialect.d.ts +3 -0
- package/dist/libsql/dialect.js +45 -0
- package/dist/libsql/generate.d.ts +4 -0
- package/dist/libsql/generate.js +53 -0
- package/dist/libsql/introspect.d.ts +16 -0
- package/dist/libsql/introspect.js +289 -0
- package/dist/libsql/pool.d.ts +42 -0
- package/dist/libsql/pool.js +270 -0
- package/dist/libsql/seed-cleanup.d.ts +2 -0
- package/dist/libsql/seed-cleanup.js +15 -0
- package/dist/libsql/values.d.ts +20 -0
- package/dist/libsql/values.js +68 -0
- package/dist/libsql-seed.d.ts +19 -0
- package/dist/libsql-seed.js +46 -0
- package/dist/libsql.d.ts +28 -0
- package/dist/libsql.js +79 -0
- package/dist/live-query.d.ts +33 -0
- package/dist/live-query.js +169 -0
- package/dist/log-codes.d.ts +1 -1
- package/dist/log-codes.js +4 -0
- package/dist/mssql-seed.d.ts +27 -0
- package/dist/mssql-seed.js +114 -0
- package/dist/mssql.d.ts +7 -7
- package/dist/mssql.js +366 -54
- package/dist/mysql-seed.d.ts +25 -0
- package/dist/mysql-seed.js +165 -0
- package/dist/mysql.d.ts +18 -6
- package/dist/mysql.js +603 -95
- package/dist/neon-http/client.d.ts +95 -0
- package/dist/neon-http/client.js +286 -0
- package/dist/neon-http/sql.d.ts +3 -0
- package/dist/neon-http/sql.js +112 -0
- package/dist/neon-http.d.ts +5 -0
- package/dist/neon-http.js +2 -0
- package/dist/neon-ws/load-driver.cjs +11 -0
- package/dist/neon-ws/load-driver.d.cts +9 -0
- package/dist/neon-ws/recovery.d.ts +14 -0
- package/dist/neon-ws/recovery.js +66 -0
- package/dist/neon-ws/snapshot.d.ts +3 -0
- package/dist/neon-ws/snapshot.js +15 -0
- package/dist/neon-ws/transport.d.ts +112 -0
- package/dist/neon-ws/transport.js +286 -0
- package/dist/neon-ws.d.ts +26 -0
- package/dist/neon-ws.js +182 -0
- package/dist/nested-write.d.ts +34 -3
- package/dist/nested-write.js +114 -22
- package/dist/notification-hub/consumer.d.ts +22 -0
- package/dist/notification-hub/consumer.js +106 -0
- package/dist/notification-hub.d.ts +41 -0
- package/dist/notification-hub.js +370 -0
- package/dist/pg-catalog-text.d.ts +96 -0
- package/dist/pg-catalog-text.js +208 -0
- package/dist/pg-types.d.ts +46 -2
- package/dist/pipeline-submittable.d.ts +15 -5
- package/dist/pipeline-submittable.js +105 -50
- package/dist/pipeline.d.ts +5 -2
- package/dist/pipeline.js +113 -43
- package/dist/plan-divergence.d.ts +1 -1
- package/dist/plan-divergence.js +1 -1
- package/dist/powdb-introspect.d.ts +1 -1
- package/dist/powdb-introspect.js +5 -5
- package/dist/powdb-shared.d.ts +5 -5
- package/dist/powdb-shared.js +6 -5
- package/dist/powdb.d.ts +28 -10
- package/dist/powdb.js +80 -28
- package/dist/powql.d.ts +50 -28
- package/dist/powql.js +49 -35
- package/dist/prisma-compat.js +4 -5
- package/dist/prisma-schema-fingerprint.d.ts +1 -1
- package/dist/prisma-schema-fingerprint.js +1 -1
- package/dist/query/aggregates.d.ts +0 -13
- package/dist/query/aggregates.js +97 -230
- package/dist/query/batched-loader.d.ts +1 -1
- package/dist/query/batched-loader.js +5 -7
- package/dist/query/builder.d.ts +108 -144
- package/dist/query/builder.js +563 -864
- package/dist/query/compound-unique.d.ts +18 -3
- package/dist/query/compound-unique.js +99 -33
- package/dist/query/cursor-tuple.d.ts +17 -0
- package/dist/query/cursor-tuple.js +114 -0
- package/dist/query/expr.d.ts +2 -0
- package/dist/query/expr.js +32 -16
- package/dist/query/filters.d.ts +39 -7
- package/dist/query/filters.js +69 -14
- package/dist/query/normalize-args.d.ts +1 -1
- package/dist/query/normalize-args.js +4 -2
- package/dist/query/option-surface.d.ts +1 -1
- package/dist/query/option-surface.js +4 -2
- package/dist/query/pg-type-parsers.d.ts +126 -0
- package/dist/query/pg-type-parsers.js +296 -0
- package/dist/query/relation-names.d.ts +4 -2
- package/dist/query/relation-names.js +15 -7
- package/dist/query/relations.d.ts +19 -7
- package/dist/query/relations.js +293 -227
- package/dist/query/row-lock.js +1 -1
- package/dist/query/sql-comment.js +1 -1
- package/dist/query/stream-idle.d.ts +11 -1
- package/dist/query/stream-idle.js +51 -13
- package/dist/query/stream-signal.d.ts +21 -0
- package/dist/query/stream-signal.js +125 -0
- package/dist/query/temporal-parsers.d.ts +101 -0
- package/dist/query/temporal-parsers.js +354 -0
- package/dist/query/types.d.ts +67 -20
- package/dist/query/utils.d.ts +2 -878
- package/dist/query/utils.js +5 -2003
- package/dist/query/warn-registry.d.ts +1 -1
- package/dist/query/warn-registry.js +1 -1
- package/dist/query/where-compile.d.ts +4 -1
- package/dist/query/where-compile.js +14 -10
- package/dist/query/where.d.ts +14 -7
- package/dist/query/where.js +236 -430
- package/dist/query/writes.d.ts +33 -2
- package/dist/query/writes.js +90 -65
- package/dist/query-utils.d.ts +687 -0
- package/dist/query-utils.js +1390 -0
- package/dist/realtime.d.ts +1 -1
- package/dist/realtime.js +3 -3
- package/dist/schema-builder.js +2 -2
- package/dist/schema-metadata.d.ts +13 -3
- package/dist/schema-metadata.js +33 -5
- package/dist/schema-sql.d.ts +15 -24
- package/dist/schema-sql.js +50 -60
- package/dist/schema.d.ts +37 -2
- package/dist/schema.js +29 -2
- package/dist/seed.js +5 -5
- package/dist/serverless.d.ts +24 -71
- package/dist/serverless.js +24 -71
- package/dist/sql.d.ts +111 -0
- package/dist/sql.js +321 -0
- package/dist/sqlite-seed.d.ts +17 -0
- package/dist/sqlite-seed.js +27 -0
- package/dist/sqlite.d.ts +32 -19
- package/dist/sqlite.js +859 -648
- package/dist/supplied-pool-types.js +2 -1
- package/dist/transaction-control.js +6 -1
- package/dist/transaction-outcome.d.ts +61 -0
- package/dist/transaction-outcome.js +234 -0
- package/dist/transaction-state.d.ts +82 -13
- package/dist/transaction-state.js +220 -57
- package/dist/transaction-transport.d.ts +38 -0
- package/dist/transaction-transport.js +153 -0
- package/dist/typed-sql.d.ts +1 -1
- package/dist/typed-sql.js +1 -1
- package/package.json +239 -13
- package/skills/turbine-orm/SKILL.md +6 -5
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.showMysqlMigrateHelp = showMysqlMigrateHelp;
|
|
4
|
+
exports.assertMysqlMigrationArguments = assertMysqlMigrationArguments;
|
|
5
|
+
exports.cmdMysqlMigrate = cmdMysqlMigrate;
|
|
6
|
+
/** MySQL SQL-first CLI adapter. Native DDL effects are never represented as transactional. */
|
|
7
|
+
const node_fs_1 = require("node:fs");
|
|
8
|
+
const errors_js_1 = require("../errors.js");
|
|
9
|
+
const introspect_js_1 = require("../introspect.js");
|
|
10
|
+
const config_js_1 = require("./config.js");
|
|
11
|
+
const migrate_js_1 = require("./migrate.js");
|
|
12
|
+
const mysql_migrate_js_1 = require("./mysql-migrate.js");
|
|
13
|
+
const mysql_schema_js_1 = require("./mysql-schema.js");
|
|
14
|
+
const mysql_schema_command_js_1 = require("./mysql-schema-command.js");
|
|
15
|
+
const ui_js_1 = require("./ui.js");
|
|
16
|
+
function showMysqlMigrateHelp() {
|
|
17
|
+
(0, ui_js_1.info)(`MySQL SQL-first migrations (optional mysql2 peer, direct MySQL 8.0.17+):
|
|
18
|
+
turbine migrate create <name> --engine mysql [--from-diff --schema-file path]
|
|
19
|
+
turbine migrate up --engine mysql [--step N] [--allow-destructive] [--allow-drift]
|
|
20
|
+
turbine migrate deploy --engine mysql [--wait[=seconds]]
|
|
21
|
+
turbine migrate down --engine mysql [--step N] [--allow-destructive] [--allow-drift]
|
|
22
|
+
turbine migrate status --engine mysql [--exit-code] (list is an alias)
|
|
23
|
+
turbine migrate recover <name> <checksum> <applied|rolled-back> --engine mysql --acknowledge-partial-ddl
|
|
24
|
+
|
|
25
|
+
Config/.env/--url select the database; default migrations: ./turbine/migrations.
|
|
26
|
+
Files use YYYYMMDDHHMMSS_name.sql with -- UP / -- DOWN sections.
|
|
27
|
+
up/down/deploy accept --dry-run: read-only inspection, not an execution guarantee.
|
|
28
|
+
Deploy permits destructive SQL without prompting, applies all pending files and always refuses drift.
|
|
29
|
+
MySQL DDL implicitly commits; failures can leave partial effects and block all ordinary writes.
|
|
30
|
+
Recovery requires manual reconciliation and exact dirty name/checksum/outcome; it never replays SQL.
|
|
31
|
+
Status --exit-code returns 2 for dirty, pending, drift, missing or ignored files; errors return 1.
|
|
32
|
+
create --from-diff compares a conservative SchemaDef subset and writes SQL for review, without applying it.
|
|
33
|
+
No --force, --auto, recipes, adapters, --allow-pending or --allow-pooler.
|
|
34
|
+
A configured schemaFile is used only by create --from-diff; ordinary SQL execution does not import it.`);
|
|
35
|
+
}
|
|
36
|
+
/** Check original tokens too: the shared legacy parser can swallow a safety flag as an operand. */
|
|
37
|
+
function assertMysqlMigrationArguments(args, argv) {
|
|
38
|
+
const keys = new Set([
|
|
39
|
+
'command',
|
|
40
|
+
'engine',
|
|
41
|
+
'subcommand',
|
|
42
|
+
'positional',
|
|
43
|
+
'url',
|
|
44
|
+
'schema',
|
|
45
|
+
'step',
|
|
46
|
+
'dryRun',
|
|
47
|
+
'force',
|
|
48
|
+
'help',
|
|
49
|
+
'auto',
|
|
50
|
+
'fromDiff',
|
|
51
|
+
'recipe',
|
|
52
|
+
'allowDrift',
|
|
53
|
+
'allowDestructive',
|
|
54
|
+
'allowPending',
|
|
55
|
+
'allowPooler',
|
|
56
|
+
'exitCode',
|
|
57
|
+
'wait',
|
|
58
|
+
'schemaFile',
|
|
59
|
+
'acknowledgePartialDdl',
|
|
60
|
+
]);
|
|
61
|
+
for (const [key, value] of Object.entries(args)) {
|
|
62
|
+
if (value !== undefined && !keys.has(key))
|
|
63
|
+
throw new errors_js_1.ValidationError(`Unsupported MySQL migration option: ${key}.`);
|
|
64
|
+
}
|
|
65
|
+
if (!argv)
|
|
66
|
+
return;
|
|
67
|
+
const operands = new Set(['--engine', '--url', '-u', '--schema', '-s', '--step', '-n', '--recipe', '--schema-file']);
|
|
68
|
+
const flags = new Set([
|
|
69
|
+
'--dry-run',
|
|
70
|
+
'--force',
|
|
71
|
+
'-f',
|
|
72
|
+
'--help',
|
|
73
|
+
'-h',
|
|
74
|
+
'--auto',
|
|
75
|
+
'--from-diff',
|
|
76
|
+
'--allow-drift',
|
|
77
|
+
'--allow-destructive',
|
|
78
|
+
'--allow-pending',
|
|
79
|
+
'--allow-pooler',
|
|
80
|
+
'--exit-code',
|
|
81
|
+
'--acknowledge-partial-ddl',
|
|
82
|
+
]);
|
|
83
|
+
for (let i = 1; i < argv.length; i++) {
|
|
84
|
+
const token = argv[i];
|
|
85
|
+
if (operands.has(token)) {
|
|
86
|
+
const value = argv[++i];
|
|
87
|
+
if (!value?.trim() || value.startsWith('-'))
|
|
88
|
+
throw new errors_js_1.ValidationError(`MySQL ${token} requires an explicit non-flag operand.`);
|
|
89
|
+
}
|
|
90
|
+
else if (token === '--wait') {
|
|
91
|
+
const value = argv[i + 1];
|
|
92
|
+
if (value && /^\d+$/.test(value))
|
|
93
|
+
i++;
|
|
94
|
+
}
|
|
95
|
+
else if (token.startsWith('--wait=')) {
|
|
96
|
+
if (!/^\d+$/.test(token.slice(7)))
|
|
97
|
+
throw new errors_js_1.ValidationError('Invalid MySQL --wait operand.');
|
|
98
|
+
}
|
|
99
|
+
else if (token.startsWith('-') && !flags.has(token)) {
|
|
100
|
+
throw new errors_js_1.ValidationError(`Unsupported MySQL migration flag: ${(0, introspect_js_1.printableCatalogName)(token)}.`);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
function validate(args, config, sub) {
|
|
105
|
+
assertMysqlMigrationArguments(args);
|
|
106
|
+
if (config.engine !== 'mysql' || config.adapter !== undefined)
|
|
107
|
+
throw new errors_js_1.ValidationError('MySQL migrations require engine "mysql" and no PostgreSQL adapter.');
|
|
108
|
+
if (typeof config.migrationsDir !== 'string' || !config.migrationsDir.trim() || config.migrationsDir.includes('\0'))
|
|
109
|
+
throw new errors_js_1.ValidationError('MySQL migrationsDir must be a nonempty path.');
|
|
110
|
+
if (args.auto ||
|
|
111
|
+
args.recipe ||
|
|
112
|
+
args.allowPending ||
|
|
113
|
+
args.allowPooler ||
|
|
114
|
+
(args.fromDiff && sub !== 'create') ||
|
|
115
|
+
(args.schemaFile !== undefined && !(sub === 'create' && args.fromDiff)))
|
|
116
|
+
throw new errors_js_1.ValidationError('MySQL migrations require explicit SQL files; --from-diff and --schema-file only apply to create, and --auto, recipes, --allow-pending and --allow-pooler are unsupported.');
|
|
117
|
+
if (sub === 'create' && args.fromDiff)
|
|
118
|
+
(0, mysql_schema_command_js_1.assertMysqlSchemaConfig)(config);
|
|
119
|
+
if (args.force)
|
|
120
|
+
throw new errors_js_1.ValidationError('MySQL migrations refuse --force; create a new migration.');
|
|
121
|
+
if (args.exitCode && !['status', 'list'].includes(sub))
|
|
122
|
+
throw new errors_js_1.ValidationError('--exit-code only applies to MySQL migrate status/list.');
|
|
123
|
+
if (args.step !== undefined && (!['up', 'down'].includes(sub) || !Number.isSafeInteger(args.step) || args.step < 1))
|
|
124
|
+
throw new errors_js_1.ValidationError('--step requires a positive integer and only applies to MySQL migrate up/down.');
|
|
125
|
+
if (args.wait !== undefined &&
|
|
126
|
+
(sub !== 'deploy' || !Number.isSafeInteger(args.wait) || args.wait < 1 || args.wait * 1000 > 2147483647))
|
|
127
|
+
throw new errors_js_1.ValidationError('--wait requires 1..2147483 seconds and only applies to MySQL migrate deploy.');
|
|
128
|
+
if (args.dryRun && !['up', 'down', 'deploy'].includes(sub))
|
|
129
|
+
throw new errors_js_1.ValidationError('--dry-run only applies to MySQL migrate up/down/deploy.');
|
|
130
|
+
if (args.allowDrift && !['up', 'down'].includes(sub))
|
|
131
|
+
throw new errors_js_1.ValidationError('--allow-drift only applies to MySQL migrate up/down; deploy always refuses drift.');
|
|
132
|
+
if (args.allowDestructive && !['up', 'down'].includes(sub))
|
|
133
|
+
throw new errors_js_1.ValidationError('--allow-destructive only applies to MySQL migrate up/down; deploy supplies consent.');
|
|
134
|
+
if (args.acknowledgePartialDdl && sub !== 'recover')
|
|
135
|
+
throw new errors_js_1.ValidationError('--acknowledge-partial-ddl only applies to MySQL migrate recover.');
|
|
136
|
+
if (sub === 'create') {
|
|
137
|
+
if (args.positional.length !== 1)
|
|
138
|
+
throw new errors_js_1.ValidationError('Usage: turbine migrate create <name> --engine mysql');
|
|
139
|
+
}
|
|
140
|
+
else if (sub === 'recover') {
|
|
141
|
+
const [name, checksum, outcome] = args.positional;
|
|
142
|
+
if (args.positional.length !== 3 ||
|
|
143
|
+
!name ||
|
|
144
|
+
!/^[a-f0-9]{64}$/.test(checksum ?? '') ||
|
|
145
|
+
!['applied', 'rolled-back'].includes(outcome ?? '') ||
|
|
146
|
+
args.acknowledgePartialDdl !== true)
|
|
147
|
+
throw new errors_js_1.ValidationError('Usage: turbine migrate recover <exact-name> <sha256> <applied|rolled-back> --engine mysql --acknowledge-partial-ddl. Manually reconcile schema/data first.');
|
|
148
|
+
}
|
|
149
|
+
else if (args.positional.length)
|
|
150
|
+
throw new errors_js_1.ValidationError(`Unexpected arguments for MySQL migrate ${sub}.`);
|
|
151
|
+
if (config.url) {
|
|
152
|
+
const database = (0, config_js_1.mysqlDatabaseFromUrl)(config.url);
|
|
153
|
+
if (config.schema !== database)
|
|
154
|
+
throw new errors_js_1.ValidationError('MySQL migration schema must match the URL database.');
|
|
155
|
+
}
|
|
156
|
+
else if (sub !== 'create') {
|
|
157
|
+
throw new errors_js_1.ValidationError('MySQL migrations need --url, config.url, or DATABASE_URL selecting an existing database.');
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
async function cmdMysqlMigrate(args, config, loadSchema) {
|
|
161
|
+
const sub = args.subcommand;
|
|
162
|
+
if (!sub || sub === 'help') {
|
|
163
|
+
showMysqlMigrateHelp();
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
if (!['create', 'up', 'deploy', 'down', 'status', 'list', 'recover'].includes(sub))
|
|
167
|
+
throw new errors_js_1.ValidationError(`Unknown MySQL migrate subcommand: ${(0, introspect_js_1.printableCatalogName)(sub)}`);
|
|
168
|
+
validate(args, config, sub);
|
|
169
|
+
(0, ui_js_1.banner)();
|
|
170
|
+
if (sub === 'create') {
|
|
171
|
+
if (args.fromDiff) {
|
|
172
|
+
if (!loadSchema)
|
|
173
|
+
throw new errors_js_1.ValidationError('MySQL create --from-diff requires the CLI schema loader integration.');
|
|
174
|
+
const schema = await loadSchema(config.schemaFile);
|
|
175
|
+
const result = await (0, mysql_schema_js_1.createMysqlSchemaMigration)(config.url, config.migrationsDir, args.positional[0], schema);
|
|
176
|
+
if (!result.file)
|
|
177
|
+
(0, ui_js_1.success)('No supported schema changes; no migration file created.');
|
|
178
|
+
else {
|
|
179
|
+
(0, ui_js_1.success)(`Created ${(0, introspect_js_1.printableCatalogName)(result.file.path)}`);
|
|
180
|
+
(0, ui_js_1.warn)('Review UP and destructive DOWN. MySQL DDL implicitly commits; every ALTER requires --allow-destructive.');
|
|
181
|
+
}
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
const file = (0, migrate_js_1.createMigration)(config.migrationsDir, args.positional[0]);
|
|
185
|
+
(0, ui_js_1.success)(`Created ${(0, introspect_js_1.printableCatalogName)(file.path)}`);
|
|
186
|
+
(0, ui_js_1.info)('Edit its UP/DOWN MySQL SQL, then run turbine migrate up --engine mysql.');
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
(0, ui_js_1.label)('MySQL database', (0, ui_js_1.redactUrl)(config.url));
|
|
190
|
+
(0, ui_js_1.label)('Migrations', (0, introspect_js_1.printableCatalogName)(config.migrationsDir));
|
|
191
|
+
const options = { schema: config.schema };
|
|
192
|
+
const ignored = (0, migrate_js_1.listIgnoredSqlFiles)(config.migrationsDir);
|
|
193
|
+
for (const file of ignored)
|
|
194
|
+
(0, ui_js_1.warn)(`Not a migration (expected YYYYMMDDHHMMSS_name.sql): ${(0, introspect_js_1.printableCatalogName)(file)}`);
|
|
195
|
+
if (sub === 'status' || sub === 'list') {
|
|
196
|
+
const statuses = await (0, mysql_migrate_js_1.migrateMysqlStatus)(config.url, config.migrationsDir, options);
|
|
197
|
+
console.log((0, ui_js_1.table)(['Status', 'Migration', 'Applied at'], statuses.map((s) => [
|
|
198
|
+
s.dirty
|
|
199
|
+
? 'Dirty'
|
|
200
|
+
: s.missingFile
|
|
201
|
+
? 'Missing file'
|
|
202
|
+
: s.checksumValid === false
|
|
203
|
+
? 'Drifted'
|
|
204
|
+
: s.applied
|
|
205
|
+
? 'Applied'
|
|
206
|
+
: 'Pending',
|
|
207
|
+
(0, introspect_js_1.printableCatalogName)(s.file.filename),
|
|
208
|
+
s.appliedAt?.toISOString() ?? '-',
|
|
209
|
+
])));
|
|
210
|
+
const problems = (0, migrate_js_1.statusGateProblems)((0, migrate_js_1.summarizeMigrationStatus)(statuses), ignored.map(introspect_js_1.printableCatalogName));
|
|
211
|
+
for (const status of statuses) {
|
|
212
|
+
if (!status.dirty)
|
|
213
|
+
continue;
|
|
214
|
+
const dirty = status.dirty;
|
|
215
|
+
problems.push(`dirty: ${(0, introspect_js_1.printableCatalogName)(dirty.name)}`);
|
|
216
|
+
(0, ui_js_1.warn)(`Dirty ${(0, introspect_js_1.printableCatalogName)(dirty.name)}: checksum ${dirty.checksum}, ${dirty.direction}, ${dirty.completedStatements}/${dirty.totalStatements} confirmed statement responses.`);
|
|
217
|
+
(0, ui_js_1.warn)('Counts are lower bounds; later SQL may have effects. Autocommitted DDL is not rolled back. Reconcile manually before recover.');
|
|
218
|
+
}
|
|
219
|
+
(0, ui_js_1.info)(`${statuses.filter((s) => s.applied).length} applied, ${statuses.filter((s) => !s.applied).length} pending`);
|
|
220
|
+
if (problems.length)
|
|
221
|
+
(0, ui_js_1.warn)(`Migration history is not clean: ${problems.join(', ')}`);
|
|
222
|
+
if (args.exitCode && problems.length)
|
|
223
|
+
process.exitCode = 2;
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
if (sub === 'recover') {
|
|
227
|
+
await (0, mysql_migrate_js_1.recoverMysqlMigration)(config.url, config.migrationsDir, {
|
|
228
|
+
...options,
|
|
229
|
+
name: args.positional[0],
|
|
230
|
+
checksum: args.positional[1],
|
|
231
|
+
outcome: args.positional[2],
|
|
232
|
+
acknowledgePartialDdl: true,
|
|
233
|
+
});
|
|
234
|
+
(0, ui_js_1.success)('Recorded manually reconciled MySQL migration outcome; no migration SQL was executed.');
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
if (args.allowDrift)
|
|
238
|
+
(0, ui_js_1.warn)('--allow-drift records modified checksums without replaying applied UP SQL; missing files still block.');
|
|
239
|
+
if (args.dryRun) {
|
|
240
|
+
const plan = await (0, mysql_migrate_js_1.inspectMysqlMigrationDeploy)(config.url, config.migrationsDir, options);
|
|
241
|
+
if (plan.dirty)
|
|
242
|
+
throw new errors_js_1.MigrationError(`MySQL migration ${(0, introspect_js_1.printableCatalogName)(plan.dirty.name)} is dirty; reconcile and recover before continuing. Autocommitted DDL is not rolled back.`);
|
|
243
|
+
const blocking = plan.mismatches.filter((m) => m.type === 'missing' || !args.allowDrift);
|
|
244
|
+
if (blocking.length)
|
|
245
|
+
throw new errors_js_1.MigrationError((0, migrate_js_1.formatChecksumMismatchError)(blocking));
|
|
246
|
+
const files = sub === 'down'
|
|
247
|
+
? await (0, mysql_migrate_js_1.planMysqlMigrationRollback)(config.url, config.migrationsDir, { ...options, step: args.step })
|
|
248
|
+
: sub === 'up'
|
|
249
|
+
? plan.pending.slice(0, args.step)
|
|
250
|
+
: plan.pending;
|
|
251
|
+
for (const file of files) {
|
|
252
|
+
(0, ui_js_1.label)('Migration', (0, introspect_js_1.printableCatalogName)(file.filename));
|
|
253
|
+
console.log((0, migrate_js_1.parseMigrationContent)((0, node_fs_1.readFileSync)(file.path, 'utf8'), file.path)[sub === 'down' ? 'down' : 'up']);
|
|
254
|
+
}
|
|
255
|
+
for (const order of plan.outOfOrder)
|
|
256
|
+
(0, ui_js_1.warn)(`Out of order: ${(0, introspect_js_1.printableCatalogName)(order.applied)} predates ${(0, introspect_js_1.printableCatalogName)(order.newestPrior)}.`);
|
|
257
|
+
(0, ui_js_1.info)(`Dry run: ${files.length} migration(s); no database or history changes made.`);
|
|
258
|
+
(0, ui_js_1.warn)('SQL is displayed, not executed or certified. Native SQL mode/policy, executable SQL, authorization, destructive consent and concurrent state are checked again at execution; this inspection does not guarantee success.');
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
(0, ui_js_1.warn)('MySQL DDL implicitly commits. Partial effects may remain on failure; no transactional rollback is promised.');
|
|
262
|
+
if (sub === 'deploy')
|
|
263
|
+
(0, ui_js_1.warn)('Deploy permits destructive MySQL SQL without prompting.');
|
|
264
|
+
const writeOptions = {
|
|
265
|
+
...options,
|
|
266
|
+
step: args.step,
|
|
267
|
+
allowDrift: args.allowDrift,
|
|
268
|
+
allowDestructive: args.allowDestructive,
|
|
269
|
+
};
|
|
270
|
+
const result = sub === 'down'
|
|
271
|
+
? await (0, mysql_migrate_js_1.migrateMysqlDown)(config.url, config.migrationsDir, writeOptions)
|
|
272
|
+
: sub === 'deploy'
|
|
273
|
+
? await (0, mysql_migrate_js_1.migrateMysqlDeploy)(config.url, config.migrationsDir, {
|
|
274
|
+
...options,
|
|
275
|
+
lockWaitMs: args.wait === undefined ? undefined : args.wait * 1000,
|
|
276
|
+
onLockWait: () => (0, ui_js_1.warn)(`Another runner holds the MySQL migration lock; waiting up to ${args.wait}s.`),
|
|
277
|
+
})
|
|
278
|
+
: await (0, mysql_migrate_js_1.migrateMysqlUp)(config.url, config.migrationsDir, writeOptions);
|
|
279
|
+
const files = 'applied' in result ? result.applied : result.rolledBack;
|
|
280
|
+
for (const file of files)
|
|
281
|
+
(0, ui_js_1.info)(`${sub === 'down' ? 'DOWN completed' : 'Applied'}: ${(0, introspect_js_1.printableCatalogName)(file.filename)}`);
|
|
282
|
+
for (const baseline of result.rebaselined)
|
|
283
|
+
(0, ui_js_1.warn)(`Re-baselined ${(0, introspect_js_1.printableCatalogName)(baseline.name)}: ${baseline.from} -> ${baseline.to}`);
|
|
284
|
+
if ('outOfOrder' in result)
|
|
285
|
+
for (const order of result.outOfOrder)
|
|
286
|
+
(0, ui_js_1.warn)(`Applied ${(0, introspect_js_1.printableCatalogName)(order.applied)} out of order, before ${(0, introspect_js_1.printableCatalogName)(order.newestPrior)}.`);
|
|
287
|
+
if (result.errors.length)
|
|
288
|
+
throw new errors_js_1.MigrationError(result.errors.map((e) => `${(0, introspect_js_1.printableCatalogName)(e.file.filename)}: ${e.error}`).join('\n'));
|
|
289
|
+
(0, ui_js_1.success)(`${files.length} migration(s) ${sub === 'down' ? 'DOWN completed' : 'applied'}`);
|
|
290
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { DestructiveStatement } from './destructive.js';
|
|
2
|
+
export interface MysqlMigrationSqlMode {
|
|
3
|
+
noBackslashEscapes: boolean;
|
|
4
|
+
ansiQuotes: boolean;
|
|
5
|
+
}
|
|
6
|
+
export interface MysqlMigrationStatement {
|
|
7
|
+
/** Original SQL, including literal spelling. */
|
|
8
|
+
sql: string;
|
|
9
|
+
/** Comments removed, literals masked, identifiers in scanner-compatible quotes. */
|
|
10
|
+
normalized: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Split MySQL SQL without applying PostgreSQL dollar-quote or comment rules.
|
|
14
|
+
* Mode comes from the dedicated connection; this function never changes it.
|
|
15
|
+
*/
|
|
16
|
+
export declare function parseMysqlMigrationStatements(sql: string, mode: MysqlMigrationSqlMode): MysqlMigrationStatement[];
|
|
17
|
+
/** Apply the shared destructive policy with MySQL-specific rewrite detection. */
|
|
18
|
+
export declare function scanMysqlMigrationDestructive(statements: readonly MysqlMigrationStatement[]): DestructiveStatement[];
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseMysqlMigrationStatements = parseMysqlMigrationStatements;
|
|
4
|
+
exports.scanMysqlMigrationDestructive = scanMysqlMigrationDestructive;
|
|
5
|
+
/** MySQL lexical rules for native migration files; shared PG parsing stays untouched. */
|
|
6
|
+
const errors_js_1 = require("../errors.js");
|
|
7
|
+
const migrate_js_1 = require("./migrate.js");
|
|
8
|
+
/**
|
|
9
|
+
* Split MySQL SQL without applying PostgreSQL dollar-quote or comment rules.
|
|
10
|
+
* Mode comes from the dedicated connection; this function never changes it.
|
|
11
|
+
*/
|
|
12
|
+
function parseMysqlMigrationStatements(sql, mode) {
|
|
13
|
+
const statements = [];
|
|
14
|
+
let start = 0;
|
|
15
|
+
let normalized = '';
|
|
16
|
+
let tokens = [];
|
|
17
|
+
const finish = (end) => {
|
|
18
|
+
if (tokens.length) {
|
|
19
|
+
assertStatement(tokens);
|
|
20
|
+
statements.push({ sql: sql.slice(start, end).trim(), normalized: normalized.trim() });
|
|
21
|
+
}
|
|
22
|
+
normalized = '';
|
|
23
|
+
tokens = [];
|
|
24
|
+
start = end + 1;
|
|
25
|
+
};
|
|
26
|
+
for (let i = 0; i < sql.length;) {
|
|
27
|
+
const ch = sql[i];
|
|
28
|
+
const afterDash = sql.charCodeAt(i + 2);
|
|
29
|
+
if (ch === '#' || (sql.startsWith('--', i) && (i + 2 === sql.length || afterDash <= 32 || afterDash === 127))) {
|
|
30
|
+
const end = sql.indexOf('\n', i);
|
|
31
|
+
i = end < 0 ? sql.length : end;
|
|
32
|
+
normalized += ' ';
|
|
33
|
+
}
|
|
34
|
+
else if (sql.startsWith('/*', i)) {
|
|
35
|
+
if (/^\/\*(?:!|M!|\+)/i.test(sql.slice(i))) {
|
|
36
|
+
throw new errors_js_1.MigrationError('MySQL migration executable comments and optimizer hints are unsupported.');
|
|
37
|
+
}
|
|
38
|
+
const end = sql.indexOf('*/', i + 2);
|
|
39
|
+
if (end < 0)
|
|
40
|
+
throw new errors_js_1.MigrationError('Unterminated MySQL migration comment.');
|
|
41
|
+
i = end + 2;
|
|
42
|
+
normalized += ' ';
|
|
43
|
+
}
|
|
44
|
+
else if (ch === "'" || ch === '"' || ch === '`') {
|
|
45
|
+
const identifier = ch === '`' || (ch === '"' && mode.ansiQuotes);
|
|
46
|
+
let value = '';
|
|
47
|
+
let closed = false;
|
|
48
|
+
for (i++; i < sql.length; i++) {
|
|
49
|
+
if (!identifier && sql[i] === '\\' && !mode.noBackslashEscapes) {
|
|
50
|
+
if (++i >= sql.length)
|
|
51
|
+
break;
|
|
52
|
+
value += sql[i];
|
|
53
|
+
}
|
|
54
|
+
else if (sql[i] === ch) {
|
|
55
|
+
if (sql[i + 1] === ch) {
|
|
56
|
+
value += ch;
|
|
57
|
+
i++;
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
i++;
|
|
61
|
+
closed = true;
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
value += sql[i];
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
if (!closed)
|
|
70
|
+
throw new errors_js_1.MigrationError('Unterminated MySQL migration quoted value.');
|
|
71
|
+
tokens.push({ value: identifier ? value : '', identifier });
|
|
72
|
+
normalized += identifier ? `"${value.replace(/"/g, '""')}"` : "'literal'";
|
|
73
|
+
}
|
|
74
|
+
else if (ch === ';') {
|
|
75
|
+
finish(i++);
|
|
76
|
+
}
|
|
77
|
+
else if (/[a-z_$\u0080-\uffff]/i.test(ch)) {
|
|
78
|
+
const word = /^[\w$\u0080-\uffff]+/.exec(sql.slice(i))[0];
|
|
79
|
+
tokens.push({ value: word, identifier: false });
|
|
80
|
+
// A native identifier containing $ is not a PostgreSQL dollar quote.
|
|
81
|
+
normalized += /[$\u0080-\uffff]/.test(word) ? `"${word}"` : word;
|
|
82
|
+
i += word.length;
|
|
83
|
+
}
|
|
84
|
+
else if (/\d/.test(ch)) {
|
|
85
|
+
const number = /^(?:0[xb][\da-f]+|\d+(?:\.\d+)?(?:e[+-]?\d+)?)/i.exec(sql.slice(i))[0];
|
|
86
|
+
tokens.push({ value: number, identifier: false });
|
|
87
|
+
normalized += number;
|
|
88
|
+
i += number.length;
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
if (!/\s/.test(ch))
|
|
92
|
+
tokens.push({ value: ch, identifier: false });
|
|
93
|
+
// Native -- without whitespace means subtraction/unary minus. Keep it
|
|
94
|
+
// from turning into a PG-style comment in the shared destructive scan.
|
|
95
|
+
normalized += ch === '-' ? ' - ' : ch;
|
|
96
|
+
i++;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
finish(sql.length);
|
|
100
|
+
return statements;
|
|
101
|
+
}
|
|
102
|
+
function assertStatement(tokens) {
|
|
103
|
+
const words = tokens.filter((token) => !token.identifier).map((token) => token.value.toUpperCase());
|
|
104
|
+
const head = words.slice(0, 4).join(' ');
|
|
105
|
+
if (!/^(?:CREATE (?:TABLE|(?:UNIQUE )?INDEX) |ALTER TABLE |DROP (?:TABLE|INDEX) |TRUNCATE (?:TABLE )?|INSERT (?:INTO|IGNORE INTO) |UPDATE |DELETE FROM )/.test(`${head} `)) {
|
|
106
|
+
throw new errors_js_1.MigrationError('Unsupported MySQL migration statement. Use native table/index DDL or INSERT/UPDATE/DELETE; transaction/session control, routines, triggers and DELIMITER are refused.');
|
|
107
|
+
}
|
|
108
|
+
for (const [position, token] of tokens.entries()) {
|
|
109
|
+
if (/^_turbine_migrations$|^_turbine_migration_state$/i.test(token.value)) {
|
|
110
|
+
throw new errors_js_1.MigrationError('MySQL migration SQL must not reference runner tracking metadata.');
|
|
111
|
+
}
|
|
112
|
+
if (tokens[position + 1]?.value === '(' &&
|
|
113
|
+
/^(?:GET_LOCK|RELEASE_LOCK|RELEASE_ALL_LOCKS|SERVICE_GET_READ_LOCKS|SERVICE_GET_WRITE_LOCKS|SERVICE_RELEASE_LOCKS)$/i.test(token.value)) {
|
|
114
|
+
throw new errors_js_1.MigrationError(`Unsupported MySQL migration control or object: ${token.value}.`);
|
|
115
|
+
}
|
|
116
|
+
if (!token.identifier &&
|
|
117
|
+
/^(?:GET_LOCK|RELEASE_LOCK|RELEASE_ALL_LOCKS|SERVICE_GET_READ_LOCKS|SERVICE_GET_WRITE_LOCKS|SERVICE_RELEASE_LOCKS|TEMPORARY|OUTFILE|DUMPFILE|PROCEDURE|FUNCTION|TRIGGER|EVENT|DELIMITER|PREPARE|EXECUTE|TABLESPACE|DATA_DIRECTORY|INDEX_DIRECTORY)$/i.test(token.value)) {
|
|
118
|
+
throw new errors_js_1.MigrationError(`Unsupported MySQL migration control or object: ${token.value}.`);
|
|
119
|
+
}
|
|
120
|
+
// This bounded runner accepts unqualified names only. Refusing every dot
|
|
121
|
+
// also closes qualified references in subqueries and multi-object DDL.
|
|
122
|
+
if (token.value === '.' || token.value === '@' || token.value === '\\' || token.value === '\0') {
|
|
123
|
+
throw new errors_js_1.MigrationError('MySQL migrations require unqualified names and no session variables or client commands.');
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
for (let engine = 0; engine < tokens.length; engine++) {
|
|
127
|
+
if (tokens[engine].identifier || tokens[engine].value.toUpperCase() !== 'ENGINE')
|
|
128
|
+
continue;
|
|
129
|
+
const value = tokens[engine + (tokens[engine + 1]?.value === '=' ? 2 : 1)]?.value;
|
|
130
|
+
if (value?.toUpperCase() !== 'INNODB') {
|
|
131
|
+
throw new errors_js_1.MigrationError('MySQL migrations support only InnoDB tables.');
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
/** Apply the shared destructive policy with MySQL-specific rewrite detection. */
|
|
136
|
+
function scanMysqlMigrationDestructive(statements) {
|
|
137
|
+
return statements.flatMap((statement) => {
|
|
138
|
+
const hits = (0, migrate_js_1.scanMigrationDestructive)(statement.normalized).map((hit) => ({ ...hit, statement: statement.sql }));
|
|
139
|
+
if (!hits.length && /^(?:UPDATE|DELETE|TRUNCATE|DROP\s+TABLE)\b/i.test(statement.normalized)) {
|
|
140
|
+
// MySQL truthiness/arithmetic differs from PG. Conservatively request
|
|
141
|
+
// consent for all native UPDATEs, including numeric WHERE expressions.
|
|
142
|
+
const kind = /^UPDATE\b/i.test(statement.normalized)
|
|
143
|
+
? 'update-without-where'
|
|
144
|
+
: /^DELETE\b/i.test(statement.normalized)
|
|
145
|
+
? 'delete'
|
|
146
|
+
: /^TRUNCATE\b/i.test(statement.normalized)
|
|
147
|
+
? 'truncate'
|
|
148
|
+
: 'drop-table';
|
|
149
|
+
hits.push({ statement: statement.sql, kind, target: 'MySQL data mutation' });
|
|
150
|
+
}
|
|
151
|
+
if (!hits.length &&
|
|
152
|
+
// Native ALTER includes partition truncation, numeric-leading names,
|
|
153
|
+
// renames and other forms beyond the shared PostgreSQL scanner. Require
|
|
154
|
+
// consent for every ALTER rather than guessing which native rewrite is safe.
|
|
155
|
+
(/^ALTER\s+TABLE\b/i.test(statement.normalized) ||
|
|
156
|
+
/^INSERT\b[\s\S]*\bON\s+DUPLICATE\s+KEY\s+UPDATE\b/i.test(statement.normalized))) {
|
|
157
|
+
const duplicateKeyUpdate = /^INSERT\b/i.test(statement.normalized);
|
|
158
|
+
hits.push({
|
|
159
|
+
statement: statement.sql,
|
|
160
|
+
kind: duplicateKeyUpdate ? 'overwrite-on-conflict' : 'alter-column-type',
|
|
161
|
+
target: duplicateKeyUpdate ? 'MySQL duplicate-key update' : 'MySQL schema/data alteration',
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
return hits;
|
|
165
|
+
});
|
|
166
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { type MigrationDeployPlan, type MigrationFile, type MigrationRunResult, type MigrationStatus, type RebaselinedChecksum } from './migrate.js';
|
|
2
|
+
export interface MysqlMigrationOptions {
|
|
3
|
+
/** MySQL schema is the database selected by the URL; it cannot be overridden. */
|
|
4
|
+
schema?: string;
|
|
5
|
+
adapter?: never;
|
|
6
|
+
dialect?: never;
|
|
7
|
+
lockWaitMs?: number;
|
|
8
|
+
onLockWait?: () => void;
|
|
9
|
+
}
|
|
10
|
+
export interface MysqlMigrationUpOptions extends MysqlMigrationOptions {
|
|
11
|
+
step?: number;
|
|
12
|
+
allowDrift?: boolean;
|
|
13
|
+
/** Reapplying an applied MySQL migration is unsafe and is refused. */
|
|
14
|
+
force?: boolean;
|
|
15
|
+
allowDestructive?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface MysqlMigrationDownOptions extends MysqlMigrationOptions {
|
|
18
|
+
step?: number;
|
|
19
|
+
allowDrift?: boolean;
|
|
20
|
+
allowDestructive?: boolean;
|
|
21
|
+
}
|
|
22
|
+
export interface MysqlMigrationDownResult {
|
|
23
|
+
rolledBack: MigrationFile[];
|
|
24
|
+
errors: Array<{
|
|
25
|
+
file: MigrationFile;
|
|
26
|
+
error: string;
|
|
27
|
+
}>;
|
|
28
|
+
rebaselined: RebaselinedChecksum[];
|
|
29
|
+
}
|
|
30
|
+
export interface MysqlMigrationDirty {
|
|
31
|
+
name: string;
|
|
32
|
+
checksum: string;
|
|
33
|
+
direction: 'up' | 'down';
|
|
34
|
+
/** Confirmed responses, not proof that the following statement had no effects. */
|
|
35
|
+
completedStatements: number;
|
|
36
|
+
totalStatements: number;
|
|
37
|
+
}
|
|
38
|
+
export interface MysqlMigrationDeployPlan extends MigrationDeployPlan {
|
|
39
|
+
dirty: MysqlMigrationDirty | null;
|
|
40
|
+
}
|
|
41
|
+
export interface MysqlMigrationStatus extends MigrationStatus {
|
|
42
|
+
dirty?: MysqlMigrationDirty;
|
|
43
|
+
}
|
|
44
|
+
export interface MysqlMigrationRecoveryOptions extends MysqlMigrationOptions {
|
|
45
|
+
name: string;
|
|
46
|
+
checksum: string;
|
|
47
|
+
outcome: 'applied' | 'rolled-back';
|
|
48
|
+
/** Caller has independently reconciled actual schema/data to the asserted outcome. */
|
|
49
|
+
acknowledgePartialDdl: true;
|
|
50
|
+
}
|
|
51
|
+
/** Inspect pending files and durable partial-DDL state without creating metadata. */
|
|
52
|
+
export declare function inspectMysqlMigrationDeploy(connectionString: string, migrationsDir: string, options?: MysqlMigrationOptions): Promise<MysqlMigrationDeployPlan>;
|
|
53
|
+
/** Plan inverse SQL in reverse application order; no DDL is executed. */
|
|
54
|
+
export declare function planMysqlMigrationRollback(connectionString: string, migrationsDir: string, options?: MysqlMigrationDownOptions): Promise<MigrationFile[]>;
|
|
55
|
+
/** Status includes missing files and dirty UP/DOWN entries, even before history insertion. */
|
|
56
|
+
export declare function migrateMysqlStatus(connectionString: string, migrationsDir: string, options?: MysqlMigrationOptions): Promise<MysqlMigrationStatus[]>;
|
|
57
|
+
/** Engine-local orchestration seam: one cooperative lock, existing journaled execution only. */
|
|
58
|
+
export declare function withMysqlMigrationWorkspace<T>(connectionString: string, migrationsDir: string, options: MysqlMigrationOptions & {
|
|
59
|
+
allowDestructive?: boolean;
|
|
60
|
+
}, body: (workspace: {
|
|
61
|
+
inspect(): Promise<MysqlMigrationDeployPlan>;
|
|
62
|
+
apply(expected: {
|
|
63
|
+
name: string;
|
|
64
|
+
checksum: string;
|
|
65
|
+
}, verify: (completed: number) => Promise<void>): Promise<MigrationRunResult>;
|
|
66
|
+
}) => Promise<T>): Promise<T>;
|
|
67
|
+
/** Execute pending files, persisting intent before any autocommitted migration SQL. */
|
|
68
|
+
export declare function migrateMysqlUp(connectionString: string, migrationsDir: string, options?: MysqlMigrationUpOptions): Promise<MigrationRunResult>;
|
|
69
|
+
/** Deploy all pending files with destructive consent, always refusing checksum drift. */
|
|
70
|
+
export declare function migrateMysqlDeploy(connectionString: string, migrationsDir: string, options?: MysqlMigrationUpOptions): Promise<MigrationRunResult>;
|
|
71
|
+
/** Execute inverse SQL; successful DOWN is not a transactional DDL rollback. */
|
|
72
|
+
export declare function migrateMysqlDown(connectionString: string, migrationsDir: string, options?: MysqlMigrationDownOptions): Promise<MysqlMigrationDownResult>;
|
|
73
|
+
/**
|
|
74
|
+
* Finalize history only after independent manual schema/data reconciliation.
|
|
75
|
+
* This never retries migration SQL or attempts to undo autocommitted DDL.
|
|
76
|
+
*/
|
|
77
|
+
export declare function recoverMysqlMigration(connectionString: string, migrationsDir: string, options: MysqlMigrationRecoveryOptions): Promise<void>;
|