@deterministic-code/migraters 0.0.2 → 0.0.4
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 +149 -1
- package/bundle.yaml +20 -28
- package/cli.yaml +24 -12
- package/csharp/Abstractions/IConnectionResolver.cs +6 -0
- package/csharp/Abstractions/IMigrateCommand.cs +7 -0
- package/csharp/Abstractions/IMigrater.cs +20 -0
- package/csharp/Abstractions/ISqlDialect.cs +23 -0
- package/csharp/Abstractions/ISqlDialectFactory.cs +7 -0
- package/csharp/Abstractions/SqlDialect.cs +78 -0
- package/csharp/Abstractions/SqlDialectFactory.cs +24 -0
- package/csharp/Dialects/Mysql/MigrateMysql.csproj +14 -0
- package/csharp/Dialects/Mysql/MysqlCreateDatabase.cs +21 -0
- package/csharp/Dialects/Mysql/MysqlDialect.cs +44 -0
- package/csharp/Dialects/Mysql/bin/Debug/net9.0/MigrateCore.dll +0 -0
- package/csharp/Dialects/Mysql/bin/Debug/net9.0/MigrateCore.pdb +0 -0
- package/csharp/Dialects/Mysql/bin/Debug/net9.0/MigrateMysql.deps.json +213 -0
- package/csharp/Dialects/Mysql/bin/Debug/net9.0/MigrateMysql.dll +0 -0
- package/csharp/Dialects/Mysql/bin/Debug/net9.0/MigrateMysql.pdb +0 -0
- package/csharp/Dialects/Mysql/bin/Debug/net9.0/cli.yaml +276 -0
- package/{dist → csharp/Dialects/Mysql/bin/Debug/net9.0}/templates/help/down.txt +3 -5
- package/csharp/Dialects/Mysql/bin/Debug/net9.0/templates/help/init.txt +15 -0
- package/{dist → csharp/Dialects/Mysql/bin/Debug/net9.0}/templates/help/setup.txt +4 -0
- package/csharp/Dialects/Mysql/bin/Debug/net9.0/templates/messages/down/confirm-prompt.txt +1 -0
- package/csharp/Dialects/Mysql/bin/Debug/net9.0/templates/messages/down/confirm-token-mismatch.txt +1 -0
- package/csharp/Dialects/Mysql/bin/Debug/net9.0/templates/messages/down/confirm-tty-required.txt +1 -0
- package/{dist → csharp/Dialects/Mysql/bin/Debug/net9.0}/templates/messages/down/destructive-header.txt +0 -1
- package/csharp/Dialects/Mysql/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs +4 -0
- package/csharp/Dialects/Mysql/obj/Debug/net9.0/MigrateM.E580FE7A.Up2Date +0 -0
- package/csharp/Dialects/Mysql/obj/Debug/net9.0/MigrateMysql.AssemblyInfo.cs +22 -0
- package/csharp/Dialects/Mysql/obj/Debug/net9.0/MigrateMysql.AssemblyInfoInputs.cache +1 -0
- package/csharp/Dialects/Mysql/obj/Debug/net9.0/MigrateMysql.GeneratedMSBuildEditorConfig.editorconfig +18 -0
- package/csharp/Dialects/Mysql/obj/Debug/net9.0/MigrateMysql.GlobalUsings.g.cs +8 -0
- package/csharp/Dialects/Mysql/obj/Debug/net9.0/MigrateMysql.assets.cache +0 -0
- package/csharp/Dialects/Mysql/obj/Debug/net9.0/MigrateMysql.csproj.AssemblyReference.cache +0 -0
- package/csharp/Dialects/Mysql/obj/Debug/net9.0/MigrateMysql.csproj.CoreCompileInputs.cache +1 -0
- package/csharp/Dialects/Mysql/obj/Debug/net9.0/MigrateMysql.csproj.FileListAbsolute.txt +63 -0
- package/csharp/Dialects/Mysql/obj/Debug/net9.0/MigrateMysql.dll +0 -0
- package/csharp/Dialects/Mysql/obj/Debug/net9.0/MigrateMysql.pdb +0 -0
- package/csharp/Dialects/Mysql/obj/Debug/net9.0/MigrateMysql.sourcelink.json +1 -0
- package/csharp/Dialects/Mysql/obj/Debug/net9.0/ref/MigrateMysql.dll +0 -0
- package/csharp/Dialects/Mysql/obj/Debug/net9.0/refint/MigrateMysql.dll +0 -0
- package/csharp/Dialects/Mysql/obj/MigrateMysql.csproj.nuget.dgspec.json +172 -0
- package/csharp/Dialects/Mysql/obj/MigrateMysql.csproj.nuget.g.props +15 -0
- package/csharp/Dialects/Mysql/obj/MigrateMysql.csproj.nuget.g.targets +6 -0
- package/csharp/Dialects/Mysql/obj/project.assets.json +5081 -0
- package/csharp/Dialects/Mysql/obj/project.nuget.cache +94 -0
- package/csharp/Dialects/Oracle/MigrateOracle.csproj +14 -0
- package/csharp/Dialects/Oracle/OracleDialect.cs +30 -0
- package/csharp/Dialects/Oracle/bin/Debug/net9.0/MigrateCore.dll +0 -0
- package/csharp/Dialects/Oracle/bin/Debug/net9.0/MigrateCore.pdb +0 -0
- package/csharp/Dialects/Oracle/bin/Debug/net9.0/MigrateOracle.deps.json +343 -0
- package/csharp/Dialects/Oracle/bin/Debug/net9.0/MigrateOracle.dll +0 -0
- package/csharp/Dialects/Oracle/bin/Debug/net9.0/MigrateOracle.pdb +0 -0
- package/csharp/Dialects/Oracle/bin/Debug/net9.0/cli.yaml +276 -0
- package/csharp/Dialects/Oracle/bin/Debug/net9.0/templates/help/create.txt +16 -0
- package/csharp/Dialects/Oracle/bin/Debug/net9.0/templates/help/down.txt +40 -0
- package/csharp/Dialects/Oracle/bin/Debug/net9.0/templates/help/init.txt +15 -0
- package/csharp/Dialects/Oracle/bin/Debug/net9.0/templates/help/setup.txt +45 -0
- package/csharp/Dialects/Oracle/bin/Debug/net9.0/templates/help/up.txt +43 -0
- package/csharp/Dialects/Oracle/bin/Debug/net9.0/templates/messages/checksum-drift-line.txt +1 -0
- package/csharp/Dialects/Oracle/bin/Debug/net9.0/templates/messages/checksum-drift.txt +11 -0
- package/csharp/Dialects/Oracle/bin/Debug/net9.0/templates/messages/down/confirm-mismatch.txt +1 -0
- package/csharp/Dialects/Oracle/bin/Debug/net9.0/templates/messages/down/confirm-prompt.txt +1 -0
- package/csharp/Dialects/Oracle/bin/Debug/net9.0/templates/messages/down/confirm-stdin-failed.txt +1 -0
- package/csharp/Dialects/Oracle/bin/Debug/net9.0/templates/messages/down/confirm-token-mismatch.txt +1 -0
- package/csharp/Dialects/Oracle/bin/Debug/net9.0/templates/messages/down/confirm-tty-required.txt +1 -0
- package/csharp/Dialects/Oracle/bin/Debug/net9.0/templates/messages/down/destructive-header.txt +2 -0
- package/csharp/Dialects/Oracle/bin/Debug/net9.0/templates/messages/errors/invalid-name.txt +1 -0
- package/csharp/Dialects/Oracle/bin/Debug/net9.0/templates/messages/errors/migrate-path-not-dir.txt +1 -0
- package/csharp/Dialects/Oracle/bin/Debug/net9.0/templates/messages/errors/missing-connection.txt +1 -0
- package/csharp/Dialects/Oracle/bin/Debug/net9.0/templates/messages/errors/missing-name-hint.txt +1 -0
- package/csharp/Dialects/Oracle/bin/Debug/net9.0/templates/messages/errors/missing-name.txt +1 -0
- package/csharp/Dialects/Oracle/bin/Debug/net9.0/templates/messages/errors/missing-provider-hint.txt +1 -0
- package/csharp/Dialects/Oracle/bin/Debug/net9.0/templates/messages/errors/missing-provider.txt +1 -0
- package/csharp/Dialects/Oracle/bin/Debug/net9.0/templates/messages/errors/missing-value-for-flag.txt +1 -0
- package/csharp/Dialects/Oracle/bin/Debug/net9.0/templates/messages/errors/rollback-no-down-sibling.txt +1 -0
- package/csharp/Dialects/Oracle/bin/Debug/net9.0/templates/messages/errors/rollback-no-rollback-sibling.txt +1 -0
- package/csharp/Dialects/Oracle/bin/Debug/net9.0/templates/messages/errors/rollback-not-in-path.txt +1 -0
- package/csharp/Dialects/Oracle/bin/Debug/net9.0/templates/messages/errors/sqlite-prerequisite.txt +1 -0
- package/csharp/Dialects/Oracle/bin/Debug/net9.0/templates/messages/errors/unknown-arg.txt +1 -0
- package/csharp/Dialects/Oracle/bin/Debug/net9.0/templates/messages/errors/unsupported-provider.txt +1 -0
- package/csharp/Dialects/Oracle/bin/Debug/net9.0/templates/messages/setup-complete.txt +9 -0
- package/csharp/Dialects/Oracle/bin/Debug/net9.0/templates/messages/status/applied.txt +1 -0
- package/csharp/Dialects/Oracle/bin/Debug/net9.0/templates/messages/status/created.txt +1 -0
- package/csharp/Dialects/Oracle/bin/Debug/net9.0/templates/messages/status/no-more-pending.txt +1 -0
- package/csharp/Dialects/Oracle/bin/Debug/net9.0/templates/messages/status/no-pending.txt +1 -0
- package/csharp/Dialects/Oracle/bin/Debug/net9.0/templates/messages/status/no-rollback.txt +1 -0
- package/csharp/Dialects/Oracle/bin/Debug/net9.0/templates/messages/status/rolled-back.txt +1 -0
- package/csharp/Dialects/Oracle/bin/Debug/net9.0/templates/scaffold/down.sql +1 -0
- package/csharp/Dialects/Oracle/bin/Debug/net9.0/templates/scaffold/up.sql +1 -0
- package/csharp/Dialects/Oracle/bin/Debug/net9.0/templates/sql/mysql/migrate_logs.sql +11 -0
- package/csharp/Dialects/Oracle/bin/Debug/net9.0/templates/sql/mysql/migrates.sql +7 -0
- package/csharp/Dialects/Oracle/bin/Debug/net9.0/templates/sql/oracle/migrate_logs.sql +14 -0
- package/csharp/Dialects/Oracle/bin/Debug/net9.0/templates/sql/oracle/migrates.sql +10 -0
- package/csharp/Dialects/Oracle/bin/Debug/net9.0/templates/sql/postgres/migrate_logs.sql +11 -0
- package/csharp/Dialects/Oracle/bin/Debug/net9.0/templates/sql/postgres/migrates.sql +7 -0
- package/csharp/Dialects/Oracle/bin/Debug/net9.0/templates/sql/sqlite/migrate_logs.sql +11 -0
- package/csharp/Dialects/Oracle/bin/Debug/net9.0/templates/sql/sqlite/migrates.sql +7 -0
- package/csharp/Dialects/Oracle/bin/Debug/net9.0/templates/sql/sqlserver/migrate_logs.sql +12 -0
- package/csharp/Dialects/Oracle/bin/Debug/net9.0/templates/sql/sqlserver/migrates.sql +8 -0
- package/csharp/Dialects/Oracle/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs +4 -0
- package/csharp/Dialects/Oracle/obj/Debug/net9.0/MigrateO.BD46121C.Up2Date +0 -0
- package/csharp/Dialects/Oracle/obj/Debug/net9.0/MigrateOracle.AssemblyInfo.cs +22 -0
- package/csharp/Dialects/Oracle/obj/Debug/net9.0/MigrateOracle.AssemblyInfoInputs.cache +1 -0
- package/csharp/Dialects/Oracle/obj/Debug/net9.0/MigrateOracle.GeneratedMSBuildEditorConfig.editorconfig +18 -0
- package/csharp/Dialects/Oracle/obj/Debug/net9.0/MigrateOracle.GlobalUsings.g.cs +8 -0
- package/csharp/Dialects/Oracle/obj/Debug/net9.0/MigrateOracle.assets.cache +0 -0
- package/csharp/Dialects/Oracle/obj/Debug/net9.0/MigrateOracle.csproj.AssemblyReference.cache +0 -0
- package/csharp/Dialects/Oracle/obj/Debug/net9.0/MigrateOracle.csproj.CoreCompileInputs.cache +1 -0
- package/csharp/Dialects/Oracle/obj/Debug/net9.0/MigrateOracle.csproj.FileListAbsolute.txt +63 -0
- package/csharp/Dialects/Oracle/obj/Debug/net9.0/MigrateOracle.dll +0 -0
- package/csharp/Dialects/Oracle/obj/Debug/net9.0/MigrateOracle.pdb +0 -0
- package/csharp/Dialects/Oracle/obj/Debug/net9.0/MigrateOracle.sourcelink.json +1 -0
- package/csharp/Dialects/Oracle/obj/Debug/net9.0/ref/MigrateOracle.dll +0 -0
- package/csharp/Dialects/Oracle/obj/Debug/net9.0/refint/MigrateOracle.dll +0 -0
- package/csharp/Dialects/Oracle/obj/MigrateOracle.csproj.nuget.dgspec.json +172 -0
- package/csharp/Dialects/Oracle/obj/MigrateOracle.csproj.nuget.g.props +15 -0
- package/csharp/Dialects/Oracle/obj/MigrateOracle.csproj.nuget.g.targets +2 -0
- package/csharp/Dialects/Oracle/obj/project.assets.json +5414 -0
- package/csharp/Dialects/Oracle/obj/project.nuget.cache +101 -0
- package/csharp/Dialects/Postgres/MigratePostgres.csproj +14 -0
- package/csharp/Dialects/Postgres/PostgresCreateDatabase.cs +31 -0
- package/csharp/Dialects/Postgres/PostgresDialect.cs +43 -0
- package/csharp/Dialects/Postgres/bin/Debug/net9.0/MigrateCore.dll +0 -0
- package/csharp/Dialects/Postgres/bin/Debug/net9.0/MigrateCore.pdb +0 -0
- package/csharp/Dialects/Postgres/bin/Debug/net9.0/MigratePostgres.deps.json +212 -0
- package/csharp/Dialects/Postgres/bin/Debug/net9.0/MigratePostgres.dll +0 -0
- package/csharp/Dialects/Postgres/bin/Debug/net9.0/MigratePostgres.pdb +0 -0
- package/csharp/Dialects/Postgres/bin/Debug/net9.0/cli.yaml +276 -0
- package/csharp/Dialects/Postgres/bin/Debug/net9.0/templates/help/create.txt +16 -0
- package/csharp/Dialects/Postgres/bin/Debug/net9.0/templates/help/down.txt +40 -0
- package/csharp/Dialects/Postgres/bin/Debug/net9.0/templates/help/init.txt +15 -0
- package/csharp/Dialects/Postgres/bin/Debug/net9.0/templates/help/setup.txt +45 -0
- package/csharp/Dialects/Postgres/bin/Debug/net9.0/templates/help/up.txt +43 -0
- package/csharp/Dialects/Postgres/bin/Debug/net9.0/templates/messages/checksum-drift-line.txt +1 -0
- package/csharp/Dialects/Postgres/bin/Debug/net9.0/templates/messages/checksum-drift.txt +11 -0
- package/csharp/Dialects/Postgres/bin/Debug/net9.0/templates/messages/down/confirm-mismatch.txt +1 -0
- package/csharp/Dialects/Postgres/bin/Debug/net9.0/templates/messages/down/confirm-prompt.txt +1 -0
- package/csharp/Dialects/Postgres/bin/Debug/net9.0/templates/messages/down/confirm-stdin-failed.txt +1 -0
- package/csharp/Dialects/Postgres/bin/Debug/net9.0/templates/messages/down/confirm-token-mismatch.txt +1 -0
- package/csharp/Dialects/Postgres/bin/Debug/net9.0/templates/messages/down/confirm-tty-required.txt +1 -0
- package/csharp/Dialects/Postgres/bin/Debug/net9.0/templates/messages/down/destructive-header.txt +2 -0
- package/csharp/Dialects/Postgres/bin/Debug/net9.0/templates/messages/errors/invalid-name.txt +1 -0
- package/csharp/Dialects/Postgres/bin/Debug/net9.0/templates/messages/errors/migrate-path-not-dir.txt +1 -0
- package/csharp/Dialects/Postgres/bin/Debug/net9.0/templates/messages/errors/missing-connection.txt +1 -0
- package/csharp/Dialects/Postgres/bin/Debug/net9.0/templates/messages/errors/missing-name-hint.txt +1 -0
- package/csharp/Dialects/Postgres/bin/Debug/net9.0/templates/messages/errors/missing-name.txt +1 -0
- package/csharp/Dialects/Postgres/bin/Debug/net9.0/templates/messages/errors/missing-provider-hint.txt +1 -0
- package/csharp/Dialects/Postgres/bin/Debug/net9.0/templates/messages/errors/missing-provider.txt +1 -0
- package/csharp/Dialects/Postgres/bin/Debug/net9.0/templates/messages/errors/missing-value-for-flag.txt +1 -0
- package/csharp/Dialects/Postgres/bin/Debug/net9.0/templates/messages/errors/rollback-no-down-sibling.txt +1 -0
- package/csharp/Dialects/Postgres/bin/Debug/net9.0/templates/messages/errors/rollback-no-rollback-sibling.txt +1 -0
- package/csharp/Dialects/Postgres/bin/Debug/net9.0/templates/messages/errors/rollback-not-in-path.txt +1 -0
- package/csharp/Dialects/Postgres/bin/Debug/net9.0/templates/messages/errors/sqlite-prerequisite.txt +1 -0
- package/csharp/Dialects/Postgres/bin/Debug/net9.0/templates/messages/errors/unknown-arg.txt +1 -0
- package/csharp/Dialects/Postgres/bin/Debug/net9.0/templates/messages/errors/unsupported-provider.txt +1 -0
- package/csharp/Dialects/Postgres/bin/Debug/net9.0/templates/messages/setup-complete.txt +9 -0
- package/csharp/Dialects/Postgres/bin/Debug/net9.0/templates/messages/status/applied.txt +1 -0
- package/csharp/Dialects/Postgres/bin/Debug/net9.0/templates/messages/status/created.txt +1 -0
- package/csharp/Dialects/Postgres/bin/Debug/net9.0/templates/messages/status/no-more-pending.txt +1 -0
- package/csharp/Dialects/Postgres/bin/Debug/net9.0/templates/messages/status/no-pending.txt +1 -0
- package/csharp/Dialects/Postgres/bin/Debug/net9.0/templates/messages/status/no-rollback.txt +1 -0
- package/csharp/Dialects/Postgres/bin/Debug/net9.0/templates/messages/status/rolled-back.txt +1 -0
- package/csharp/Dialects/Postgres/bin/Debug/net9.0/templates/scaffold/down.sql +1 -0
- package/csharp/Dialects/Postgres/bin/Debug/net9.0/templates/scaffold/up.sql +1 -0
- package/csharp/Dialects/Postgres/bin/Debug/net9.0/templates/sql/mysql/migrate_logs.sql +11 -0
- package/csharp/Dialects/Postgres/bin/Debug/net9.0/templates/sql/mysql/migrates.sql +7 -0
- package/csharp/Dialects/Postgres/bin/Debug/net9.0/templates/sql/oracle/migrate_logs.sql +14 -0
- package/csharp/Dialects/Postgres/bin/Debug/net9.0/templates/sql/oracle/migrates.sql +10 -0
- package/csharp/Dialects/Postgres/bin/Debug/net9.0/templates/sql/postgres/migrate_logs.sql +11 -0
- package/csharp/Dialects/Postgres/bin/Debug/net9.0/templates/sql/postgres/migrates.sql +7 -0
- package/csharp/Dialects/Postgres/bin/Debug/net9.0/templates/sql/sqlite/migrate_logs.sql +11 -0
- package/csharp/Dialects/Postgres/bin/Debug/net9.0/templates/sql/sqlite/migrates.sql +7 -0
- package/csharp/Dialects/Postgres/bin/Debug/net9.0/templates/sql/sqlserver/migrate_logs.sql +12 -0
- package/csharp/Dialects/Postgres/bin/Debug/net9.0/templates/sql/sqlserver/migrates.sql +8 -0
- package/csharp/Dialects/Postgres/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs +4 -0
- package/csharp/Dialects/Postgres/obj/Debug/net9.0/MigrateP.DF842641.Up2Date +0 -0
- package/csharp/Dialects/Postgres/obj/Debug/net9.0/MigratePostgres.AssemblyInfo.cs +22 -0
- package/csharp/Dialects/Postgres/obj/Debug/net9.0/MigratePostgres.AssemblyInfoInputs.cache +1 -0
- package/csharp/Dialects/Postgres/obj/Debug/net9.0/MigratePostgres.GeneratedMSBuildEditorConfig.editorconfig +18 -0
- package/csharp/Dialects/Postgres/obj/Debug/net9.0/MigratePostgres.GlobalUsings.g.cs +8 -0
- package/csharp/Dialects/Postgres/obj/Debug/net9.0/MigratePostgres.assets.cache +0 -0
- package/csharp/Dialects/Postgres/obj/Debug/net9.0/MigratePostgres.csproj.AssemblyReference.cache +0 -0
- package/csharp/Dialects/Postgres/obj/Debug/net9.0/MigratePostgres.csproj.CoreCompileInputs.cache +1 -0
- package/csharp/Dialects/Postgres/obj/Debug/net9.0/MigratePostgres.csproj.FileListAbsolute.txt +63 -0
- package/csharp/Dialects/Postgres/obj/Debug/net9.0/MigratePostgres.dll +0 -0
- package/csharp/Dialects/Postgres/obj/Debug/net9.0/MigratePostgres.pdb +0 -0
- package/csharp/Dialects/Postgres/obj/Debug/net9.0/MigratePostgres.sourcelink.json +1 -0
- package/csharp/Dialects/Postgres/obj/Debug/net9.0/ref/MigratePostgres.dll +0 -0
- package/csharp/Dialects/Postgres/obj/Debug/net9.0/refint/MigratePostgres.dll +0 -0
- package/csharp/Dialects/Postgres/obj/MigratePostgres.csproj.nuget.dgspec.json +172 -0
- package/csharp/Dialects/Postgres/obj/MigratePostgres.csproj.nuget.g.props +15 -0
- package/csharp/Dialects/Postgres/obj/MigratePostgres.csproj.nuget.g.targets +6 -0
- package/csharp/Dialects/Postgres/obj/project.assets.json +5068 -0
- package/csharp/Dialects/Postgres/obj/project.nuget.cache +94 -0
- package/csharp/Dialects/SqlServer/MigrateSqlServer.csproj +14 -0
- package/csharp/Dialects/SqlServer/SqlServerCreateDatabase.cs +21 -0
- package/csharp/Dialects/SqlServer/SqlServerDialect.cs +21 -0
- package/csharp/Dialects/SqlServer/bin/Debug/net9.0/MigrateCore.dll +0 -0
- package/csharp/Dialects/SqlServer/bin/Debug/net9.0/MigrateCore.pdb +0 -0
- package/csharp/Dialects/SqlServer/bin/Debug/net9.0/MigrateSqlServer.deps.json +727 -0
- package/csharp/Dialects/SqlServer/bin/Debug/net9.0/MigrateSqlServer.dll +0 -0
- package/csharp/Dialects/SqlServer/bin/Debug/net9.0/MigrateSqlServer.pdb +0 -0
- package/csharp/Dialects/SqlServer/bin/Debug/net9.0/cli.yaml +276 -0
- package/csharp/Dialects/SqlServer/bin/Debug/net9.0/templates/help/create.txt +16 -0
- package/csharp/Dialects/SqlServer/bin/Debug/net9.0/templates/help/down.txt +40 -0
- package/csharp/Dialects/SqlServer/bin/Debug/net9.0/templates/help/init.txt +15 -0
- package/csharp/Dialects/SqlServer/bin/Debug/net9.0/templates/help/setup.txt +45 -0
- package/csharp/Dialects/SqlServer/bin/Debug/net9.0/templates/help/up.txt +43 -0
- package/csharp/Dialects/SqlServer/bin/Debug/net9.0/templates/messages/checksum-drift-line.txt +1 -0
- package/csharp/Dialects/SqlServer/bin/Debug/net9.0/templates/messages/checksum-drift.txt +11 -0
- package/csharp/Dialects/SqlServer/bin/Debug/net9.0/templates/messages/down/confirm-mismatch.txt +1 -0
- package/csharp/Dialects/SqlServer/bin/Debug/net9.0/templates/messages/down/confirm-prompt.txt +1 -0
- package/csharp/Dialects/SqlServer/bin/Debug/net9.0/templates/messages/down/confirm-stdin-failed.txt +1 -0
- package/csharp/Dialects/SqlServer/bin/Debug/net9.0/templates/messages/down/confirm-token-mismatch.txt +1 -0
- package/csharp/Dialects/SqlServer/bin/Debug/net9.0/templates/messages/down/confirm-tty-required.txt +1 -0
- package/csharp/Dialects/SqlServer/bin/Debug/net9.0/templates/messages/down/destructive-header.txt +2 -0
- package/csharp/Dialects/SqlServer/bin/Debug/net9.0/templates/messages/errors/invalid-name.txt +1 -0
- package/csharp/Dialects/SqlServer/bin/Debug/net9.0/templates/messages/errors/migrate-path-not-dir.txt +1 -0
- package/csharp/Dialects/SqlServer/bin/Debug/net9.0/templates/messages/errors/missing-connection.txt +1 -0
- package/csharp/Dialects/SqlServer/bin/Debug/net9.0/templates/messages/errors/missing-name-hint.txt +1 -0
- package/csharp/Dialects/SqlServer/bin/Debug/net9.0/templates/messages/errors/missing-name.txt +1 -0
- package/csharp/Dialects/SqlServer/bin/Debug/net9.0/templates/messages/errors/missing-provider-hint.txt +1 -0
- package/csharp/Dialects/SqlServer/bin/Debug/net9.0/templates/messages/errors/missing-provider.txt +1 -0
- package/csharp/Dialects/SqlServer/bin/Debug/net9.0/templates/messages/errors/missing-value-for-flag.txt +1 -0
- package/csharp/Dialects/SqlServer/bin/Debug/net9.0/templates/messages/errors/rollback-no-down-sibling.txt +1 -0
- package/csharp/Dialects/SqlServer/bin/Debug/net9.0/templates/messages/errors/rollback-no-rollback-sibling.txt +1 -0
- package/csharp/Dialects/SqlServer/bin/Debug/net9.0/templates/messages/errors/rollback-not-in-path.txt +1 -0
- package/csharp/Dialects/SqlServer/bin/Debug/net9.0/templates/messages/errors/sqlite-prerequisite.txt +1 -0
- package/csharp/Dialects/SqlServer/bin/Debug/net9.0/templates/messages/errors/unknown-arg.txt +1 -0
- package/csharp/Dialects/SqlServer/bin/Debug/net9.0/templates/messages/errors/unsupported-provider.txt +1 -0
- package/csharp/Dialects/SqlServer/bin/Debug/net9.0/templates/messages/setup-complete.txt +9 -0
- package/csharp/Dialects/SqlServer/bin/Debug/net9.0/templates/messages/status/applied.txt +1 -0
- package/csharp/Dialects/SqlServer/bin/Debug/net9.0/templates/messages/status/created.txt +1 -0
- package/csharp/Dialects/SqlServer/bin/Debug/net9.0/templates/messages/status/no-more-pending.txt +1 -0
- package/csharp/Dialects/SqlServer/bin/Debug/net9.0/templates/messages/status/no-pending.txt +1 -0
- package/csharp/Dialects/SqlServer/bin/Debug/net9.0/templates/messages/status/no-rollback.txt +1 -0
- package/csharp/Dialects/SqlServer/bin/Debug/net9.0/templates/messages/status/rolled-back.txt +1 -0
- package/csharp/Dialects/SqlServer/bin/Debug/net9.0/templates/scaffold/down.sql +1 -0
- package/csharp/Dialects/SqlServer/bin/Debug/net9.0/templates/scaffold/up.sql +1 -0
- package/csharp/Dialects/SqlServer/bin/Debug/net9.0/templates/sql/mysql/migrate_logs.sql +11 -0
- package/csharp/Dialects/SqlServer/bin/Debug/net9.0/templates/sql/mysql/migrates.sql +7 -0
- package/csharp/Dialects/SqlServer/bin/Debug/net9.0/templates/sql/oracle/migrate_logs.sql +14 -0
- package/csharp/Dialects/SqlServer/bin/Debug/net9.0/templates/sql/oracle/migrates.sql +10 -0
- package/csharp/Dialects/SqlServer/bin/Debug/net9.0/templates/sql/postgres/migrate_logs.sql +11 -0
- package/csharp/Dialects/SqlServer/bin/Debug/net9.0/templates/sql/postgres/migrates.sql +7 -0
- package/csharp/Dialects/SqlServer/bin/Debug/net9.0/templates/sql/sqlite/migrate_logs.sql +11 -0
- package/csharp/Dialects/SqlServer/bin/Debug/net9.0/templates/sql/sqlite/migrates.sql +7 -0
- package/csharp/Dialects/SqlServer/bin/Debug/net9.0/templates/sql/sqlserver/migrate_logs.sql +12 -0
- package/csharp/Dialects/SqlServer/bin/Debug/net9.0/templates/sql/sqlserver/migrates.sql +8 -0
- package/csharp/Dialects/SqlServer/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs +4 -0
- package/csharp/Dialects/SqlServer/obj/Debug/net9.0/MigrateS.6604771C.Up2Date +0 -0
- package/csharp/Dialects/SqlServer/obj/Debug/net9.0/MigrateSqlServer.AssemblyInfo.cs +22 -0
- package/csharp/Dialects/SqlServer/obj/Debug/net9.0/MigrateSqlServer.AssemblyInfoInputs.cache +1 -0
- package/csharp/Dialects/SqlServer/obj/Debug/net9.0/MigrateSqlServer.GeneratedMSBuildEditorConfig.editorconfig +18 -0
- package/csharp/Dialects/SqlServer/obj/Debug/net9.0/MigrateSqlServer.GlobalUsings.g.cs +8 -0
- package/csharp/Dialects/SqlServer/obj/Debug/net9.0/MigrateSqlServer.assets.cache +0 -0
- package/csharp/Dialects/SqlServer/obj/Debug/net9.0/MigrateSqlServer.csproj.AssemblyReference.cache +0 -0
- package/csharp/Dialects/SqlServer/obj/Debug/net9.0/MigrateSqlServer.csproj.CoreCompileInputs.cache +1 -0
- package/csharp/Dialects/SqlServer/obj/Debug/net9.0/MigrateSqlServer.csproj.FileListAbsolute.txt +63 -0
- package/csharp/Dialects/SqlServer/obj/Debug/net9.0/MigrateSqlServer.dll +0 -0
- package/csharp/Dialects/SqlServer/obj/Debug/net9.0/MigrateSqlServer.pdb +0 -0
- package/csharp/Dialects/SqlServer/obj/Debug/net9.0/MigrateSqlServer.sourcelink.json +1 -0
- package/csharp/Dialects/SqlServer/obj/Debug/net9.0/ref/MigrateSqlServer.dll +0 -0
- package/csharp/Dialects/SqlServer/obj/Debug/net9.0/refint/MigrateSqlServer.dll +0 -0
- package/csharp/Dialects/SqlServer/obj/MigrateSqlServer.csproj.nuget.dgspec.json +172 -0
- package/csharp/Dialects/SqlServer/obj/MigrateSqlServer.csproj.nuget.g.props +15 -0
- package/csharp/Dialects/SqlServer/obj/MigrateSqlServer.csproj.nuget.g.targets +7 -0
- package/csharp/Dialects/SqlServer/obj/project.assets.json +6391 -0
- package/csharp/Dialects/SqlServer/obj/project.nuget.cache +122 -0
- package/csharp/Dialects/Sqlite/MigrateSqlite.csproj +14 -0
- package/csharp/Dialects/Sqlite/SqliteDialect.cs +77 -0
- package/csharp/Dialects/Sqlite/bin/Debug/net9.0/MigrateCore.dll +0 -0
- package/csharp/Dialects/Sqlite/bin/Debug/net9.0/MigrateCore.pdb +0 -0
- package/csharp/Dialects/Sqlite/bin/Debug/net9.0/MigrateSqlite.deps.json +376 -0
- package/csharp/Dialects/Sqlite/bin/Debug/net9.0/MigrateSqlite.dll +0 -0
- package/csharp/Dialects/Sqlite/bin/Debug/net9.0/MigrateSqlite.pdb +0 -0
- package/csharp/Dialects/Sqlite/bin/Debug/net9.0/cli.yaml +276 -0
- package/csharp/Dialects/Sqlite/bin/Debug/net9.0/templates/help/create.txt +16 -0
- package/csharp/Dialects/Sqlite/bin/Debug/net9.0/templates/help/down.txt +40 -0
- package/csharp/Dialects/Sqlite/bin/Debug/net9.0/templates/help/init.txt +15 -0
- package/csharp/Dialects/Sqlite/bin/Debug/net9.0/templates/help/setup.txt +45 -0
- package/csharp/Dialects/Sqlite/bin/Debug/net9.0/templates/help/up.txt +43 -0
- package/csharp/Dialects/Sqlite/bin/Debug/net9.0/templates/messages/checksum-drift-line.txt +1 -0
- package/csharp/Dialects/Sqlite/bin/Debug/net9.0/templates/messages/checksum-drift.txt +11 -0
- package/csharp/Dialects/Sqlite/bin/Debug/net9.0/templates/messages/down/confirm-mismatch.txt +1 -0
- package/csharp/Dialects/Sqlite/bin/Debug/net9.0/templates/messages/down/confirm-prompt.txt +1 -0
- package/csharp/Dialects/Sqlite/bin/Debug/net9.0/templates/messages/down/confirm-stdin-failed.txt +1 -0
- package/csharp/Dialects/Sqlite/bin/Debug/net9.0/templates/messages/down/confirm-token-mismatch.txt +1 -0
- package/csharp/Dialects/Sqlite/bin/Debug/net9.0/templates/messages/down/confirm-tty-required.txt +1 -0
- package/csharp/Dialects/Sqlite/bin/Debug/net9.0/templates/messages/down/destructive-header.txt +2 -0
- package/csharp/Dialects/Sqlite/bin/Debug/net9.0/templates/messages/errors/invalid-name.txt +1 -0
- package/csharp/Dialects/Sqlite/bin/Debug/net9.0/templates/messages/errors/migrate-path-not-dir.txt +1 -0
- package/csharp/Dialects/Sqlite/bin/Debug/net9.0/templates/messages/errors/missing-connection.txt +1 -0
- package/csharp/Dialects/Sqlite/bin/Debug/net9.0/templates/messages/errors/missing-name-hint.txt +1 -0
- package/csharp/Dialects/Sqlite/bin/Debug/net9.0/templates/messages/errors/missing-name.txt +1 -0
- package/csharp/Dialects/Sqlite/bin/Debug/net9.0/templates/messages/errors/missing-provider-hint.txt +1 -0
- package/csharp/Dialects/Sqlite/bin/Debug/net9.0/templates/messages/errors/missing-provider.txt +1 -0
- package/csharp/Dialects/Sqlite/bin/Debug/net9.0/templates/messages/errors/missing-value-for-flag.txt +1 -0
- package/csharp/Dialects/Sqlite/bin/Debug/net9.0/templates/messages/errors/rollback-no-down-sibling.txt +1 -0
- package/csharp/Dialects/Sqlite/bin/Debug/net9.0/templates/messages/errors/rollback-no-rollback-sibling.txt +1 -0
- package/csharp/Dialects/Sqlite/bin/Debug/net9.0/templates/messages/errors/rollback-not-in-path.txt +1 -0
- package/csharp/Dialects/Sqlite/bin/Debug/net9.0/templates/messages/errors/sqlite-prerequisite.txt +1 -0
- package/csharp/Dialects/Sqlite/bin/Debug/net9.0/templates/messages/errors/unknown-arg.txt +1 -0
- package/csharp/Dialects/Sqlite/bin/Debug/net9.0/templates/messages/errors/unsupported-provider.txt +1 -0
- package/csharp/Dialects/Sqlite/bin/Debug/net9.0/templates/messages/setup-complete.txt +9 -0
- package/csharp/Dialects/Sqlite/bin/Debug/net9.0/templates/messages/status/applied.txt +1 -0
- package/csharp/Dialects/Sqlite/bin/Debug/net9.0/templates/messages/status/created.txt +1 -0
- package/csharp/Dialects/Sqlite/bin/Debug/net9.0/templates/messages/status/no-more-pending.txt +1 -0
- package/csharp/Dialects/Sqlite/bin/Debug/net9.0/templates/messages/status/no-pending.txt +1 -0
- package/csharp/Dialects/Sqlite/bin/Debug/net9.0/templates/messages/status/no-rollback.txt +1 -0
- package/csharp/Dialects/Sqlite/bin/Debug/net9.0/templates/messages/status/rolled-back.txt +1 -0
- package/csharp/Dialects/Sqlite/bin/Debug/net9.0/templates/scaffold/down.sql +1 -0
- package/csharp/Dialects/Sqlite/bin/Debug/net9.0/templates/scaffold/up.sql +1 -0
- package/csharp/Dialects/Sqlite/bin/Debug/net9.0/templates/sql/mysql/migrate_logs.sql +11 -0
- package/csharp/Dialects/Sqlite/bin/Debug/net9.0/templates/sql/mysql/migrates.sql +7 -0
- package/csharp/Dialects/Sqlite/bin/Debug/net9.0/templates/sql/oracle/migrate_logs.sql +14 -0
- package/csharp/Dialects/Sqlite/bin/Debug/net9.0/templates/sql/oracle/migrates.sql +10 -0
- package/csharp/Dialects/Sqlite/bin/Debug/net9.0/templates/sql/postgres/migrate_logs.sql +11 -0
- package/csharp/Dialects/Sqlite/bin/Debug/net9.0/templates/sql/postgres/migrates.sql +7 -0
- package/csharp/Dialects/Sqlite/bin/Debug/net9.0/templates/sql/sqlite/migrate_logs.sql +11 -0
- package/csharp/Dialects/Sqlite/bin/Debug/net9.0/templates/sql/sqlite/migrates.sql +7 -0
- package/csharp/Dialects/Sqlite/bin/Debug/net9.0/templates/sql/sqlserver/migrate_logs.sql +12 -0
- package/csharp/Dialects/Sqlite/bin/Debug/net9.0/templates/sql/sqlserver/migrates.sql +8 -0
- package/csharp/Dialects/Sqlite/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs +4 -0
- package/csharp/Dialects/Sqlite/obj/Debug/net9.0/MigrateS.4867C581.Up2Date +0 -0
- package/csharp/Dialects/Sqlite/obj/Debug/net9.0/MigrateSqlite.AssemblyInfo.cs +22 -0
- package/csharp/Dialects/Sqlite/obj/Debug/net9.0/MigrateSqlite.AssemblyInfoInputs.cache +1 -0
- package/csharp/Dialects/Sqlite/obj/Debug/net9.0/MigrateSqlite.GeneratedMSBuildEditorConfig.editorconfig +18 -0
- package/csharp/Dialects/Sqlite/obj/Debug/net9.0/MigrateSqlite.GlobalUsings.g.cs +8 -0
- package/csharp/Dialects/Sqlite/obj/Debug/net9.0/MigrateSqlite.assets.cache +0 -0
- package/csharp/Dialects/Sqlite/obj/Debug/net9.0/MigrateSqlite.csproj.AssemblyReference.cache +0 -0
- package/csharp/Dialects/Sqlite/obj/Debug/net9.0/MigrateSqlite.csproj.CoreCompileInputs.cache +1 -0
- package/csharp/Dialects/Sqlite/obj/Debug/net9.0/MigrateSqlite.csproj.FileListAbsolute.txt +63 -0
- package/csharp/Dialects/Sqlite/obj/Debug/net9.0/MigrateSqlite.dll +0 -0
- package/csharp/Dialects/Sqlite/obj/Debug/net9.0/MigrateSqlite.pdb +0 -0
- package/csharp/Dialects/Sqlite/obj/Debug/net9.0/MigrateSqlite.sourcelink.json +1 -0
- package/csharp/Dialects/Sqlite/obj/Debug/net9.0/ref/MigrateSqlite.dll +0 -0
- package/csharp/Dialects/Sqlite/obj/Debug/net9.0/refint/MigrateSqlite.dll +0 -0
- package/csharp/Dialects/Sqlite/obj/MigrateSqlite.csproj.nuget.dgspec.json +172 -0
- package/csharp/Dialects/Sqlite/obj/MigrateSqlite.csproj.nuget.g.props +15 -0
- package/csharp/Dialects/Sqlite/obj/MigrateSqlite.csproj.nuget.g.targets +6 -0
- package/csharp/Dialects/Sqlite/obj/project.assets.json +5263 -0
- package/csharp/Dialects/Sqlite/obj/project.nuget.cache +99 -0
- package/csharp/GlobalUsings.cs +6 -0
- package/csharp/Infrastructure/Checksum.cs +18 -0
- package/csharp/Infrastructure/CliSpec.cs +228 -0
- package/csharp/Infrastructure/ConnectionResolver.cs +9 -0
- package/csharp/Infrastructure/ConnectionStringUrl.cs +47 -0
- package/csharp/Infrastructure/CreateDatabase.cs +7 -0
- package/csharp/Infrastructure/DbExecute.cs +81 -0
- package/csharp/Infrastructure/HelpTemplates.cs +47 -0
- package/csharp/Infrastructure/MigrateCli.cs +159 -0
- package/csharp/Infrastructure/MigrateLog.cs +54 -0
- package/csharp/Infrastructure/Migrater.cs +157 -0
- package/csharp/Infrastructure/Migrations.cs +105 -0
- package/csharp/Infrastructure/SqlTemplates.cs +10 -0
- package/csharp/MigrateCreate.cs +114 -0
- package/csharp/MigrateDown.cs +147 -0
- package/csharp/MigrateRunner.Core.csproj +66 -0
- package/csharp/MigrateRunner.csproj +63 -0
- package/csharp/MigrateRunnerServices.cs +55 -0
- package/csharp/MigrateSetup.cs +145 -0
- package/csharp/MigrateUp.cs +122 -0
- package/csharp/Program.cs +40 -0
- package/{dist → orchestrator/dist}/cli-spec.d.ts +1 -1
- package/{dist → orchestrator/dist}/cli-spec.js +10 -2
- package/orchestrator/dist/config.d.ts +13 -0
- package/orchestrator/dist/config.js +48 -0
- package/orchestrator/dist/dialects.d.ts +2 -0
- package/orchestrator/dist/dialects.js +25 -0
- package/orchestrator/dist/dispatch.d.ts +9 -0
- package/orchestrator/dist/dispatch.js +36 -0
- package/{dist → orchestrator/dist}/help.d.ts +0 -1
- package/orchestrator/dist/help.js +36 -0
- package/orchestrator/dist/languages.d.ts +4 -0
- package/orchestrator/dist/languages.js +12 -0
- package/orchestrator/dist/manifests.d.ts +8 -0
- package/orchestrator/dist/manifests.js +53 -0
- package/orchestrator/dist/migrate-create.js +3 -0
- package/orchestrator/dist/migrate-down.js +3 -0
- package/orchestrator/dist/migrate-init.js +37 -0
- package/orchestrator/dist/migrate-setup.js +3 -0
- package/orchestrator/dist/migrate-up.js +3 -0
- package/orchestrator/dist/parse-init.d.ts +12 -0
- package/orchestrator/dist/parse-init.js +56 -0
- package/orchestrator/dist/repo.d.ts +2 -0
- package/orchestrator/dist/repo.js +19 -0
- package/orchestrator/dist/run-init.d.ts +2 -0
- package/orchestrator/dist/run-init.js +66 -0
- package/orchestrator/dist/run.d.ts +3 -0
- package/orchestrator/dist/run.js +16 -0
- package/orchestrator/prepare.js +21 -0
- package/orchestrator/tsconfig.json +19 -0
- package/package.json +49 -62
- package/rust/Cargo.lock +393 -0
- package/rust/Cargo.toml +29 -0
- package/rust/api/Cargo.toml +8 -0
- package/rust/api/src/lib.rs +231 -0
- package/rust/dialects/mysql/Cargo.toml +11 -0
- package/rust/dialects/mysql/src/lib.rs +231 -0
- package/rust/dialects/oracle/Cargo.toml +11 -0
- package/rust/dialects/oracle/src/lib.rs +245 -0
- package/rust/dialects/postgres/Cargo.toml +11 -0
- package/rust/dialects/postgres/src/lib.rs +235 -0
- package/rust/dialects/sqlite/Cargo.toml +11 -0
- package/rust/dialects/sqlite/src/lib.rs +286 -0
- package/rust/dialects/sqlserver/Cargo.toml +12 -0
- package/rust/dialects/sqlserver/src/lib.rs +235 -0
- package/rust/rustfmt.toml +2 -0
- package/rust/src/abstractions/factory.rs +17 -0
- package/rust/src/abstractions/mod.rs +5 -0
- package/rust/src/abstractions/sql_dialect.rs +1 -0
- package/rust/src/argv.rs +15 -0
- package/rust/src/attached_dialects.rs +2 -0
- package/rust/src/bin/migrate_create.rs +97 -0
- package/rust/src/bin/migrate_down.rs +151 -0
- package/rust/src/bin/migrate_setup.rs +153 -0
- package/rust/src/bin/migrate_up.rs +126 -0
- package/rust/src/checksum.rs +55 -0
- package/rust/src/cli_spec.rs +249 -0
- package/rust/src/dialects/mod.rs +4 -0
- package/rust/src/help.rs +10 -0
- package/rust/src/infrastructure/connection_resolver.rs +8 -0
- package/rust/src/infrastructure/create_database.rs +15 -0
- package/rust/src/infrastructure/mod.rs +9 -0
- package/rust/src/infrastructure/pool.rs +79 -0
- package/rust/src/infrastructure/split_on_go.rs +48 -0
- package/rust/src/lib.rs +115 -0
- package/rust/src/messages.rs +102 -0
- package/rust/src/migrater.rs +224 -0
- package/rust/src/migrations.rs +151 -0
- package/rust/src/provider.rs +57 -0
- package/shared/templates/help/create.txt +16 -0
- package/shared/templates/help/down.txt +40 -0
- package/shared/templates/help/init.txt +15 -0
- package/shared/templates/help/setup.txt +45 -0
- package/shared/templates/help/up.txt +43 -0
- package/shared/templates/messages/checksum-drift-line.txt +1 -0
- package/shared/templates/messages/checksum-drift.txt +11 -0
- package/shared/templates/messages/down/confirm-mismatch.txt +1 -0
- package/shared/templates/messages/down/confirm-prompt.txt +1 -0
- package/shared/templates/messages/down/confirm-stdin-failed.txt +1 -0
- package/shared/templates/messages/down/confirm-token-mismatch.txt +1 -0
- package/shared/templates/messages/down/confirm-tty-required.txt +1 -0
- package/shared/templates/messages/down/destructive-header.txt +2 -0
- package/shared/templates/messages/errors/invalid-name.txt +1 -0
- package/shared/templates/messages/errors/migrate-path-not-dir.txt +1 -0
- package/shared/templates/messages/errors/missing-connection.txt +1 -0
- package/shared/templates/messages/errors/missing-name-hint.txt +1 -0
- package/shared/templates/messages/errors/missing-name.txt +1 -0
- package/shared/templates/messages/errors/missing-provider-hint.txt +1 -0
- package/shared/templates/messages/errors/missing-provider.txt +1 -0
- package/shared/templates/messages/errors/missing-value-for-flag.txt +1 -0
- package/shared/templates/messages/errors/rollback-no-down-sibling.txt +1 -0
- package/shared/templates/messages/errors/rollback-no-rollback-sibling.txt +1 -0
- package/shared/templates/messages/errors/rollback-not-in-path.txt +1 -0
- package/shared/templates/messages/errors/sqlite-prerequisite.txt +1 -0
- package/shared/templates/messages/errors/unknown-arg.txt +1 -0
- package/shared/templates/messages/errors/unsupported-provider.txt +1 -0
- package/shared/templates/messages/setup-complete.txt +9 -0
- package/shared/templates/messages/status/applied.txt +1 -0
- package/shared/templates/messages/status/created.txt +1 -0
- package/shared/templates/messages/status/no-more-pending.txt +1 -0
- package/shared/templates/messages/status/no-pending.txt +1 -0
- package/shared/templates/messages/status/no-rollback.txt +1 -0
- package/shared/templates/messages/status/rolled-back.txt +1 -0
- package/shared/templates/scaffold/down.sql +1 -0
- package/shared/templates/scaffold/up.sql +1 -0
- package/shared/templates/sql/mysql/migrate_logs.sql +11 -0
- package/shared/templates/sql/mysql/migrates.sql +7 -0
- package/shared/templates/sql/oracle/migrate_logs.sql +14 -0
- package/shared/templates/sql/oracle/migrates.sql +10 -0
- package/shared/templates/sql/postgres/migrate_logs.sql +11 -0
- package/shared/templates/sql/postgres/migrates.sql +7 -0
- package/shared/templates/sql/sqlite/migrate_logs.sql +11 -0
- package/shared/templates/sql/sqlite/migrates.sql +7 -0
- package/shared/templates/sql/sqlserver/migrate_logs.sql +12 -0
- package/shared/templates/sql/sqlserver/migrates.sql +8 -0
- package/typescript/bundle.yaml +254 -0
- package/typescript/dialects/mysql/package.json +12 -0
- package/typescript/dialects/mysql/src/index.ts +4 -0
- package/typescript/dialects/mysql/src/mysql-dialect.test.ts +99 -0
- package/typescript/dialects/mysql/src/mysql-dialect.ts +75 -0
- package/typescript/dialects/oracle/package.json +13 -0
- package/typescript/dialects/oracle/src/index.ts +4 -0
- package/typescript/dialects/oracle/src/oracle-dialect.test.ts +118 -0
- package/typescript/dialects/oracle/src/oracle-dialect.ts +91 -0
- package/typescript/dialects/postgres/package.json +13 -0
- package/typescript/dialects/postgres/src/index.ts +4 -0
- package/typescript/dialects/postgres/src/postgres-dialect.test.ts +98 -0
- package/typescript/dialects/postgres/src/postgres-dialect.ts +82 -0
- package/typescript/dialects/sqlite/package.json +13 -0
- package/typescript/dialects/sqlite/src/index.ts +4 -0
- package/typescript/dialects/sqlite/src/sqlite-dialect.rollback.test.ts +30 -0
- package/typescript/dialects/sqlite/src/sqlite-dialect.test.ts +77 -0
- package/typescript/dialects/sqlite/src/sqlite-dialect.ts +96 -0
- package/typescript/dialects/sqlserver/package.json +13 -0
- package/typescript/dialects/sqlserver/src/index.ts +4 -0
- package/typescript/dialects/sqlserver/src/sqlserver-dialect.test.ts +109 -0
- package/typescript/dialects/sqlserver/src/sqlserver-dialect.ts +103 -0
- package/typescript/package.json +46 -0
- package/typescript/src/abstractions/migrater.ts +13 -0
- package/typescript/src/abstractions/sql-dialect-base.ts +38 -0
- package/typescript/src/abstractions/sql-dialect-factory.ts +29 -0
- package/typescript/src/abstractions/sql-dialect.ts +18 -0
- package/typescript/src/bin/migrate-create.ts +80 -0
- package/typescript/src/bin/migrate-down.ts +141 -0
- package/typescript/src/bin/migrate-setup.ts +106 -0
- package/typescript/src/bin/migrate-up.ts +111 -0
- package/typescript/src/cli-contract.ts +25 -0
- package/typescript/src/cli-spec.ts +73 -0
- package/typescript/src/cli.ts +52 -0
- package/typescript/src/create-database.test.ts +18 -0
- package/typescript/src/create-database.ts +7 -0
- package/typescript/src/create-sequence.ts +17 -0
- package/typescript/src/datasource-migrate.ts +314 -0
- package/typescript/src/generate-help.test.ts +33 -0
- package/typescript/src/generate-help.ts +173 -0
- package/typescript/src/help.test.ts +48 -0
- package/typescript/src/help.ts +12 -0
- package/typescript/src/index.ts +23 -0
- package/typescript/src/infrastructure/connection-resolver.ts +18 -0
- package/typescript/src/infrastructure/default-factory.test.ts +30 -0
- package/typescript/src/infrastructure/default-factory.ts +41 -0
- package/typescript/src/infrastructure/interop-default.test.ts +9 -0
- package/typescript/src/infrastructure/interop-default.ts +2 -0
- package/typescript/src/infrastructure/message-templates.ts +30 -0
- package/typescript/src/infrastructure/mysql-text-protocol.ts +7 -0
- package/typescript/src/infrastructure/split-on-go.ts +19 -0
- package/typescript/src/infrastructure/sql-templates.ts +10 -0
- package/typescript/src/infrastructure/templates-root.ts +16 -0
- package/typescript/src/init-select.test.ts +34 -0
- package/typescript/src/init-select.ts +77 -0
- package/typescript/src/migrater.ts +92 -0
- package/{dist/migration-client.d.ts → typescript/src/migration-client.ts} +12 -12
- package/typescript/src/path-exists.ts +10 -0
- package/typescript/src/setup-sql.test.ts +16 -0
- package/typescript/src/sql.ts +17 -0
- package/typescript/tsconfig.build.json +20 -0
- package/dist/abstractions/migrater.d.ts +0 -28
- package/dist/abstractions/migrater.js +0 -1
- package/dist/abstractions/sql-dialect-base.d.ts +0 -16
- package/dist/abstractions/sql-dialect-base.js +0 -19
- package/dist/abstractions/sql-dialect-factory.d.ts +0 -8
- package/dist/abstractions/sql-dialect-factory.js +0 -22
- package/dist/abstractions/sql-dialect.d.ts +0 -16
- package/dist/abstractions/sql-dialect.js +0 -1
- package/dist/bin/migrate-create.js +0 -71
- package/dist/bin/migrate-down.js +0 -135
- package/dist/bin/migrate-init.js +0 -77
- package/dist/bin/migrate-setup.js +0 -87
- package/dist/bin/migrate-up.js +0 -97
- package/dist/cli-contract.d.ts +0 -6
- package/dist/cli-contract.js +0 -19
- package/dist/cli.d.ts +0 -9
- package/dist/cli.js +0 -41
- package/dist/create-sequence.d.ts +0 -4
- package/dist/create-sequence.js +0 -16
- package/dist/datasource-migrate.d.ts +0 -31
- package/dist/datasource-migrate.js +0 -206
- package/dist/dialects/mysql-dialect.d.ts +0 -12
- package/dist/dialects/mysql-dialect.js +0 -56
- package/dist/dialects/oracle-dialect.d.ts +0 -18
- package/dist/dialects/oracle-dialect.js +0 -76
- package/dist/dialects/postgres-dialect.d.ts +0 -11
- package/dist/dialects/postgres-dialect.js +0 -58
- package/dist/dialects/sqlite-dialect.d.ts +0 -13
- package/dist/dialects/sqlite-dialect.js +0 -96
- package/dist/dialects/sqlserver-dialect.d.ts +0 -12
- package/dist/dialects/sqlserver-dialect.js +0 -73
- package/dist/help.js +0 -10
- package/dist/index.d.ts +0 -7
- package/dist/index.js +0 -6
- package/dist/infrastructure/connection-resolver.d.ts +0 -7
- package/dist/infrastructure/connection-resolver.js +0 -19
- package/dist/infrastructure/default-factory.d.ts +0 -4
- package/dist/infrastructure/default-factory.js +0 -15
- package/dist/infrastructure/interop-default.d.ts +0 -3
- package/dist/infrastructure/interop-default.js +0 -1
- package/dist/infrastructure/message-templates.d.ts +0 -3
- package/dist/infrastructure/message-templates.js +0 -18
- package/dist/infrastructure/split-on-go.d.ts +0 -2
- package/dist/infrastructure/split-on-go.js +0 -20
- package/dist/infrastructure/sql-templates.d.ts +0 -2
- package/dist/infrastructure/sql-templates.js +0 -4
- package/dist/infrastructure/templates-root.d.ts +0 -2
- package/dist/infrastructure/templates-root.js +0 -11
- package/dist/init-select.d.ts +0 -12
- package/dist/init-select.js +0 -52
- package/dist/migrater.d.ts +0 -12
- package/dist/migrater.js +0 -84
- package/dist/migration-client.js +0 -1
- package/dist/path-exists.d.ts +0 -1
- package/dist/path-exists.js +0 -10
- package/dist/sql.d.ts +0 -3
- package/dist/sql.js +0 -15
- package/dist/templates/help/init.txt +0 -13
- package/dist/templates/messages/down/confirm-prompt.txt +0 -1
- package/dist/templates/messages/down/confirm-token-mismatch.txt +0 -1
- package/dist/templates/messages/down/confirm-tty-required.txt +0 -1
- /package/{dist → csharp/Dialects/Mysql/bin/Debug/net9.0}/templates/help/create.txt +0 -0
- /package/{dist → csharp/Dialects/Mysql/bin/Debug/net9.0}/templates/help/up.txt +0 -0
- /package/{dist → csharp/Dialects/Mysql/bin/Debug/net9.0}/templates/messages/checksum-drift-line.txt +0 -0
- /package/{dist → csharp/Dialects/Mysql/bin/Debug/net9.0}/templates/messages/checksum-drift.txt +0 -0
- /package/{dist → csharp/Dialects/Mysql/bin/Debug/net9.0}/templates/messages/down/confirm-mismatch.txt +0 -0
- /package/{dist → csharp/Dialects/Mysql/bin/Debug/net9.0}/templates/messages/down/confirm-stdin-failed.txt +0 -0
- /package/{dist → csharp/Dialects/Mysql/bin/Debug/net9.0}/templates/messages/errors/invalid-name.txt +0 -0
- /package/{dist → csharp/Dialects/Mysql/bin/Debug/net9.0}/templates/messages/errors/migrate-path-not-dir.txt +0 -0
- /package/{dist → csharp/Dialects/Mysql/bin/Debug/net9.0}/templates/messages/errors/missing-connection.txt +0 -0
- /package/{dist → csharp/Dialects/Mysql/bin/Debug/net9.0}/templates/messages/errors/missing-name-hint.txt +0 -0
- /package/{dist → csharp/Dialects/Mysql/bin/Debug/net9.0}/templates/messages/errors/missing-name.txt +0 -0
- /package/{dist → csharp/Dialects/Mysql/bin/Debug/net9.0}/templates/messages/errors/missing-provider-hint.txt +0 -0
- /package/{dist → csharp/Dialects/Mysql/bin/Debug/net9.0}/templates/messages/errors/missing-provider.txt +0 -0
- /package/{dist → csharp/Dialects/Mysql/bin/Debug/net9.0}/templates/messages/errors/missing-value-for-flag.txt +0 -0
- /package/{dist → csharp/Dialects/Mysql/bin/Debug/net9.0}/templates/messages/errors/rollback-no-down-sibling.txt +0 -0
- /package/{dist → csharp/Dialects/Mysql/bin/Debug/net9.0}/templates/messages/errors/rollback-no-rollback-sibling.txt +0 -0
- /package/{dist → csharp/Dialects/Mysql/bin/Debug/net9.0}/templates/messages/errors/rollback-not-in-path.txt +0 -0
- /package/{dist → csharp/Dialects/Mysql/bin/Debug/net9.0}/templates/messages/errors/sqlite-prerequisite.txt +0 -0
- /package/{dist → csharp/Dialects/Mysql/bin/Debug/net9.0}/templates/messages/errors/unknown-arg.txt +0 -0
- /package/{dist → csharp/Dialects/Mysql/bin/Debug/net9.0}/templates/messages/errors/unsupported-provider.txt +0 -0
- /package/{dist → csharp/Dialects/Mysql/bin/Debug/net9.0}/templates/messages/setup-complete.txt +0 -0
- /package/{dist → csharp/Dialects/Mysql/bin/Debug/net9.0}/templates/messages/status/applied.txt +0 -0
- /package/{dist → csharp/Dialects/Mysql/bin/Debug/net9.0}/templates/messages/status/created.txt +0 -0
- /package/{dist → csharp/Dialects/Mysql/bin/Debug/net9.0}/templates/messages/status/no-more-pending.txt +0 -0
- /package/{dist → csharp/Dialects/Mysql/bin/Debug/net9.0}/templates/messages/status/no-pending.txt +0 -0
- /package/{dist → csharp/Dialects/Mysql/bin/Debug/net9.0}/templates/messages/status/no-rollback.txt +0 -0
- /package/{dist → csharp/Dialects/Mysql/bin/Debug/net9.0}/templates/messages/status/rolled-back.txt +0 -0
- /package/{dist → csharp/Dialects/Mysql/bin/Debug/net9.0}/templates/scaffold/down.sql +0 -0
- /package/{dist → csharp/Dialects/Mysql/bin/Debug/net9.0}/templates/scaffold/up.sql +0 -0
- /package/{dist → csharp/Dialects/Mysql/bin/Debug/net9.0}/templates/sql/mysql/migrate_logs.sql +0 -0
- /package/{dist → csharp/Dialects/Mysql/bin/Debug/net9.0}/templates/sql/mysql/migrates.sql +0 -0
- /package/{dist → csharp/Dialects/Mysql/bin/Debug/net9.0}/templates/sql/oracle/migrate_logs.sql +0 -0
- /package/{dist → csharp/Dialects/Mysql/bin/Debug/net9.0}/templates/sql/oracle/migrates.sql +0 -0
- /package/{dist → csharp/Dialects/Mysql/bin/Debug/net9.0}/templates/sql/postgres/migrate_logs.sql +0 -0
- /package/{dist → csharp/Dialects/Mysql/bin/Debug/net9.0}/templates/sql/postgres/migrates.sql +0 -0
- /package/{dist → csharp/Dialects/Mysql/bin/Debug/net9.0}/templates/sql/sqlite/migrate_logs.sql +0 -0
- /package/{dist → csharp/Dialects/Mysql/bin/Debug/net9.0}/templates/sql/sqlite/migrates.sql +0 -0
- /package/{dist → csharp/Dialects/Mysql/bin/Debug/net9.0}/templates/sql/sqlserver/migrate_logs.sql +0 -0
- /package/{dist → csharp/Dialects/Mysql/bin/Debug/net9.0}/templates/sql/sqlserver/migrates.sql +0 -0
- /package/{dist/bin → orchestrator/dist}/migrate-create.d.ts +0 -0
- /package/{dist/bin → orchestrator/dist}/migrate-down.d.ts +0 -0
- /package/{dist/bin → orchestrator/dist}/migrate-init.d.ts +0 -0
- /package/{dist/bin → orchestrator/dist}/migrate-setup.d.ts +0 -0
- /package/{dist/bin → orchestrator/dist}/migrate-up.d.ts +0 -0
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
use std::collections::HashMap;
|
|
2
|
+
use std::future::Future;
|
|
3
|
+
use std::pin::Pin;
|
|
4
|
+
|
|
5
|
+
pub type BoxError = Box<dyn std::error::Error + Send + Sync + 'static>;
|
|
6
|
+
|
|
7
|
+
pub fn catalog_name(stored: &str) -> &str {
|
|
8
|
+
stored.strip_suffix("_up.sql").unwrap_or(stored)
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
pub trait SqlDialect: Send + Sync {
|
|
12
|
+
fn name(&self) -> &'static str;
|
|
13
|
+
fn connection_env_vars(&self) -> &'static [&'static str];
|
|
14
|
+
fn migrates_ddl(&self) -> &'static str;
|
|
15
|
+
fn migrate_logs_ddl(&self) -> &'static str;
|
|
16
|
+
fn use_transaction(&self) -> bool;
|
|
17
|
+
fn insert_applied_sql(&self) -> &'static str;
|
|
18
|
+
fn delete_applied_sql(&self) -> &'static str;
|
|
19
|
+
fn normalize_connection(&self, connection: &str) -> String;
|
|
20
|
+
fn prerequisite_error(&self, connection: &str) -> Option<String>;
|
|
21
|
+
fn prepare_setup(&self, connection: &str) -> std::io::Result<()>;
|
|
22
|
+
|
|
23
|
+
fn quote_ident(&self, ident: &str) -> String {
|
|
24
|
+
format!("\"{ident}\"")
|
|
25
|
+
}
|
|
26
|
+
fn now_expr(&self) -> &'static str {
|
|
27
|
+
"CURRENT_TIMESTAMP"
|
|
28
|
+
}
|
|
29
|
+
fn limit_clause(&self, n: usize) -> String {
|
|
30
|
+
format!("LIMIT {n}")
|
|
31
|
+
}
|
|
32
|
+
fn select_applied_checksum_sql(&self) -> String {
|
|
33
|
+
let name = self.quote_ident("name");
|
|
34
|
+
let checksum = self.quote_ident("checksum");
|
|
35
|
+
let table = self.quote_ident("migrates");
|
|
36
|
+
format!("SELECT {name} AS name, {checksum} AS checksum FROM {table}")
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
fn connect<'a>(
|
|
40
|
+
&'a self,
|
|
41
|
+
connection: &'a str,
|
|
42
|
+
) -> Pin<Box<dyn Future<Output = Result<Box<dyn MigrationSession>, BoxError>> + Send + 'a>>;
|
|
43
|
+
|
|
44
|
+
fn create_database<'a>(
|
|
45
|
+
&'a self,
|
|
46
|
+
_connection: &'a str,
|
|
47
|
+
) -> Pin<Box<dyn Future<Output = Result<(), BoxError>> + Send + 'a>> {
|
|
48
|
+
Box::pin(async { Ok(()) })
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
#[async_trait::async_trait]
|
|
53
|
+
pub trait MigrationSession: Send + Sync {
|
|
54
|
+
async fn execute(&self, sql: &str) -> Result<(), BoxError>;
|
|
55
|
+
async fn fetch_applied(&self, sql: &str) -> Result<HashMap<String, Option<String>>, BoxError>;
|
|
56
|
+
async fn apply_in_transaction(
|
|
57
|
+
&self,
|
|
58
|
+
stmts: &[String],
|
|
59
|
+
catalog_sql: &str,
|
|
60
|
+
p1: &str,
|
|
61
|
+
p2: Option<&str>,
|
|
62
|
+
) -> Result<(), BoxError>;
|
|
63
|
+
async fn catalog_write(
|
|
64
|
+
&self,
|
|
65
|
+
catalog_sql: &str,
|
|
66
|
+
p1: &str,
|
|
67
|
+
p2: Option<&str>,
|
|
68
|
+
) -> Result<(), BoxError>;
|
|
69
|
+
async fn fetch_id(&self, sql: &str, p1: &str, p2: &str) -> Result<i64, BoxError>;
|
|
70
|
+
async fn update_log_exec(
|
|
71
|
+
&self,
|
|
72
|
+
sql: &str,
|
|
73
|
+
status: &str,
|
|
74
|
+
duration_ms: i64,
|
|
75
|
+
error_message: Option<&str>,
|
|
76
|
+
id: i64,
|
|
77
|
+
) -> Result<(), BoxError>;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
pub struct DialectPlugin {
|
|
81
|
+
pub dialect: &'static dyn SqlDialect,
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
inventory::collect!(DialectPlugin);
|
|
85
|
+
|
|
86
|
+
pub fn registered_dialects() -> Vec<&'static dyn SqlDialect> {
|
|
87
|
+
inventory::iter::<DialectPlugin>
|
|
88
|
+
.into_iter()
|
|
89
|
+
.map(|p| p.dialect)
|
|
90
|
+
.collect()
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
pub fn register_try_get(
|
|
94
|
+
name: &str,
|
|
95
|
+
normalize: impl Fn(&str) -> Option<&str>,
|
|
96
|
+
) -> Option<&'static dyn SqlDialect> {
|
|
97
|
+
let key = normalize(name)?;
|
|
98
|
+
registered_dialects()
|
|
99
|
+
.into_iter()
|
|
100
|
+
.find(|d| d.name() == key)
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
pub fn split_on_go(sql: &str) -> Vec<String> {
|
|
104
|
+
let mut out = Vec::new();
|
|
105
|
+
let mut buf = String::new();
|
|
106
|
+
for line in sql.replace("\r\n", "\n").split('\n') {
|
|
107
|
+
if line.trim().eq_ignore_ascii_case("GO") {
|
|
108
|
+
let s = buf.trim();
|
|
109
|
+
if !s.is_empty() {
|
|
110
|
+
out.push(s.to_string());
|
|
111
|
+
}
|
|
112
|
+
buf.clear();
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
if !buf.is_empty() {
|
|
116
|
+
buf.push('\n');
|
|
117
|
+
}
|
|
118
|
+
buf.push_str(line);
|
|
119
|
+
}
|
|
120
|
+
let tail = buf.trim();
|
|
121
|
+
if !tail.is_empty() {
|
|
122
|
+
out.push(tail.to_string());
|
|
123
|
+
}
|
|
124
|
+
out
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
pub fn placeholders(dialect: &str, n: usize) -> Vec<String> {
|
|
128
|
+
match dialect {
|
|
129
|
+
"postgres" => (1..=n).map(|i| format!("${i}")).collect(),
|
|
130
|
+
"sqlserver" => (1..=n).map(|i| format!("@P{i}")).collect(),
|
|
131
|
+
"oracle" => (1..=n).map(|i| format!(":{i}")).collect(),
|
|
132
|
+
_ => (0..n).map(|_| "?".into()).collect(),
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
pub async fn apply_statements(
|
|
137
|
+
session: &dyn MigrationSession,
|
|
138
|
+
dialect: &dyn SqlDialect,
|
|
139
|
+
sql: &str,
|
|
140
|
+
catalog_sql: &str,
|
|
141
|
+
p1: &str,
|
|
142
|
+
p2: Option<&str>,
|
|
143
|
+
) -> Result<(), BoxError> {
|
|
144
|
+
let stmts = split_on_go(sql);
|
|
145
|
+
if dialect.use_transaction() {
|
|
146
|
+
session
|
|
147
|
+
.apply_in_transaction(&stmts, catalog_sql, p1, p2)
|
|
148
|
+
.await
|
|
149
|
+
} else {
|
|
150
|
+
for stmt in &stmts {
|
|
151
|
+
session.execute(stmt).await?;
|
|
152
|
+
}
|
|
153
|
+
session.catalog_write(catalog_sql, p1, p2).await
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
pub async fn insert_log_started(
|
|
158
|
+
session: &dyn MigrationSession,
|
|
159
|
+
dialect: &dyn SqlDialect,
|
|
160
|
+
name: &str,
|
|
161
|
+
direction: &str,
|
|
162
|
+
) -> Result<i64, BoxError> {
|
|
163
|
+
let t = dialect.quote_ident("migrate_logs");
|
|
164
|
+
let migrate_name = dialect.quote_ident("migrate_name");
|
|
165
|
+
let dir_col = dialect.quote_ident("direction");
|
|
166
|
+
let status = dialect.quote_ident("status");
|
|
167
|
+
let id_col = dialect.quote_ident("id");
|
|
168
|
+
let ph = placeholders(dialect.name(), 2);
|
|
169
|
+
let insert = format!(
|
|
170
|
+
"INSERT INTO {t} ({migrate_name}, {dir_col}, {status}) VALUES ({}, {}, 'started')",
|
|
171
|
+
ph[0], ph[1]
|
|
172
|
+
);
|
|
173
|
+
session
|
|
174
|
+
.catalog_write(&insert, name, Some(direction))
|
|
175
|
+
.await?;
|
|
176
|
+
let select = format!(
|
|
177
|
+
"SELECT {id_col} AS id FROM {t} WHERE {migrate_name} = {} AND {dir_col} = {} ORDER BY {id_col} DESC {}",
|
|
178
|
+
ph[0],
|
|
179
|
+
ph[1],
|
|
180
|
+
dialect.limit_clause(1)
|
|
181
|
+
);
|
|
182
|
+
session.fetch_id(&select, name, direction).await
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
pub async fn update_log(
|
|
186
|
+
session: &dyn MigrationSession,
|
|
187
|
+
dialect: &dyn SqlDialect,
|
|
188
|
+
id: i64,
|
|
189
|
+
status: &str,
|
|
190
|
+
duration_ms: i64,
|
|
191
|
+
error_message: Option<&str>,
|
|
192
|
+
) -> Result<(), BoxError> {
|
|
193
|
+
let t = dialect.quote_ident("migrate_logs");
|
|
194
|
+
let now = dialect.now_expr();
|
|
195
|
+
let ph = placeholders(dialect.name(), 4);
|
|
196
|
+
let sql = format!(
|
|
197
|
+
"UPDATE {t} SET {status_col} = {p1}, {finished} = {now}, {duration} = {p2}, {err} = {p3}, {updated} = {now} WHERE {id_col} = {p4}",
|
|
198
|
+
status_col = dialect.quote_ident("status"),
|
|
199
|
+
finished = dialect.quote_ident("finished_at"),
|
|
200
|
+
duration = dialect.quote_ident("duration_ms"),
|
|
201
|
+
err = dialect.quote_ident("error_message"),
|
|
202
|
+
updated = dialect.quote_ident("updated"),
|
|
203
|
+
id_col = dialect.quote_ident("id"),
|
|
204
|
+
p1 = ph[0],
|
|
205
|
+
p2 = ph[1],
|
|
206
|
+
p3 = ph[2],
|
|
207
|
+
p4 = ph[3],
|
|
208
|
+
);
|
|
209
|
+
session
|
|
210
|
+
.update_log_exec(&sql, status, duration_ms, error_message, id)
|
|
211
|
+
.await
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
pub fn assert_dialect_surface(d: &dyn SqlDialect) {
|
|
215
|
+
assert!(!d.name().is_empty());
|
|
216
|
+
assert!(!d.connection_env_vars().is_empty());
|
|
217
|
+
assert!(d.migrates_ddl().to_ascii_lowercase().contains("migrates"));
|
|
218
|
+
assert!(d
|
|
219
|
+
.migrate_logs_ddl()
|
|
220
|
+
.to_ascii_lowercase()
|
|
221
|
+
.contains("migrate_logs"));
|
|
222
|
+
assert!(!d.insert_applied_sql().is_empty());
|
|
223
|
+
assert!(!d.delete_applied_sql().is_empty());
|
|
224
|
+
assert!(!d.quote_ident("t").is_empty());
|
|
225
|
+
assert!(!d.now_expr().is_empty());
|
|
226
|
+
assert!(d.limit_clause(3).contains('3'));
|
|
227
|
+
assert!(d
|
|
228
|
+
.select_applied_checksum_sql()
|
|
229
|
+
.to_ascii_lowercase()
|
|
230
|
+
.contains("migrates"));
|
|
231
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
[package]
|
|
2
|
+
name = "migraters-mysql"
|
|
3
|
+
version = "0.0.1"
|
|
4
|
+
edition = "2021"
|
|
5
|
+
|
|
6
|
+
[dependencies]
|
|
7
|
+
async-trait = "0.1"
|
|
8
|
+
inventory = "0.3"
|
|
9
|
+
migraters-api = { path = "../../api" }
|
|
10
|
+
sqlx = { version = "0.8", default-features = false, features = ["runtime-tokio", "mysql"] }
|
|
11
|
+
tokio = { version = "1", features = ["net", "rt"] }
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
use std::collections::HashMap;
|
|
2
|
+
use std::future::Future;
|
|
3
|
+
use std::pin::Pin;
|
|
4
|
+
|
|
5
|
+
use async_trait::async_trait;
|
|
6
|
+
use migraters_api::{catalog_name, BoxError, DialectPlugin, MigrationSession, SqlDialect};
|
|
7
|
+
use sqlx::mysql::MySqlPool;
|
|
8
|
+
use sqlx::Row;
|
|
9
|
+
|
|
10
|
+
pub struct MysqlDialect;
|
|
11
|
+
|
|
12
|
+
pub static MYSQL: MysqlDialect = MysqlDialect;
|
|
13
|
+
|
|
14
|
+
inventory::submit! {
|
|
15
|
+
DialectPlugin { dialect: &MYSQL }
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
impl SqlDialect for MysqlDialect {
|
|
19
|
+
fn name(&self) -> &'static str {
|
|
20
|
+
"mysql"
|
|
21
|
+
}
|
|
22
|
+
fn connection_env_vars(&self) -> &'static [&'static str] {
|
|
23
|
+
&["MYSQL_URL", "DATABASE_URL"]
|
|
24
|
+
}
|
|
25
|
+
fn migrates_ddl(&self) -> &'static str {
|
|
26
|
+
include_str!("../../../../shared/templates/sql/mysql/migrates.sql")
|
|
27
|
+
}
|
|
28
|
+
fn migrate_logs_ddl(&self) -> &'static str {
|
|
29
|
+
include_str!("../../../../shared/templates/sql/mysql/migrate_logs.sql")
|
|
30
|
+
}
|
|
31
|
+
fn use_transaction(&self) -> bool {
|
|
32
|
+
false
|
|
33
|
+
}
|
|
34
|
+
fn insert_applied_sql(&self) -> &'static str {
|
|
35
|
+
"INSERT INTO `migrates` (`name`, `checksum`) VALUES (?, ?)"
|
|
36
|
+
}
|
|
37
|
+
fn delete_applied_sql(&self) -> &'static str {
|
|
38
|
+
"DELETE FROM `migrates` WHERE `name` = ?"
|
|
39
|
+
}
|
|
40
|
+
fn normalize_connection(&self, connection: &str) -> String {
|
|
41
|
+
connection.to_string()
|
|
42
|
+
}
|
|
43
|
+
fn prerequisite_error(&self, _connection: &str) -> Option<String> {
|
|
44
|
+
None
|
|
45
|
+
}
|
|
46
|
+
fn prepare_setup(&self, _connection: &str) -> std::io::Result<()> {
|
|
47
|
+
Ok(())
|
|
48
|
+
}
|
|
49
|
+
fn quote_ident(&self, ident: &str) -> String {
|
|
50
|
+
format!("`{ident}`")
|
|
51
|
+
}
|
|
52
|
+
fn connect<'a>(
|
|
53
|
+
&'a self,
|
|
54
|
+
connection: &'a str,
|
|
55
|
+
) -> Pin<Box<dyn Future<Output = Result<Box<dyn MigrationSession>, BoxError>> + Send + 'a>> {
|
|
56
|
+
Box::pin(async move {
|
|
57
|
+
let url = self.normalize_connection(connection);
|
|
58
|
+
let pool = MySqlPool::connect(&url).await?;
|
|
59
|
+
Ok(Box::new(MysqlSession { pool }) as Box<dyn MigrationSession>)
|
|
60
|
+
})
|
|
61
|
+
}
|
|
62
|
+
fn create_database<'a>(
|
|
63
|
+
&'a self,
|
|
64
|
+
connection: &'a str,
|
|
65
|
+
) -> Pin<Box<dyn Future<Output = Result<(), BoxError>> + Send + 'a>> {
|
|
66
|
+
Box::pin(async move { create_database(connection).await })
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
struct MysqlSession {
|
|
71
|
+
pool: MySqlPool,
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
#[async_trait]
|
|
75
|
+
impl MigrationSession for MysqlSession {
|
|
76
|
+
async fn execute(&self, sql: &str) -> Result<(), BoxError> {
|
|
77
|
+
sqlx::query(sql).execute(&self.pool).await?;
|
|
78
|
+
Ok(())
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
async fn fetch_applied(&self, sql: &str) -> Result<HashMap<String, Option<String>>, BoxError> {
|
|
82
|
+
let mut out = HashMap::new();
|
|
83
|
+
for row in sqlx::query(sql).fetch_all(&self.pool).await? {
|
|
84
|
+
let name: String = row.get(0);
|
|
85
|
+
let checksum: Option<String> = row.try_get(1).ok().flatten();
|
|
86
|
+
out.insert(catalog_name(&name).to_string(), checksum);
|
|
87
|
+
}
|
|
88
|
+
Ok(out)
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
async fn apply_in_transaction(
|
|
92
|
+
&self,
|
|
93
|
+
stmts: &[String],
|
|
94
|
+
catalog_sql: &str,
|
|
95
|
+
p1: &str,
|
|
96
|
+
p2: Option<&str>,
|
|
97
|
+
) -> Result<(), BoxError> {
|
|
98
|
+
use sqlx::Executor;
|
|
99
|
+
let mut tx = self.pool.begin().await?;
|
|
100
|
+
for stmt in stmts {
|
|
101
|
+
tx.execute(stmt.as_str()).await?;
|
|
102
|
+
}
|
|
103
|
+
catalog_exec_tx(&mut tx, catalog_sql, p1, p2).await?;
|
|
104
|
+
tx.commit().await?;
|
|
105
|
+
Ok(())
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
async fn catalog_write(
|
|
109
|
+
&self,
|
|
110
|
+
catalog_sql: &str,
|
|
111
|
+
p1: &str,
|
|
112
|
+
p2: Option<&str>,
|
|
113
|
+
) -> Result<(), BoxError> {
|
|
114
|
+
catalog_exec_pool(&self.pool, catalog_sql, p1, p2).await
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
async fn fetch_id(&self, sql: &str, p1: &str, p2: &str) -> Result<i64, BoxError> {
|
|
118
|
+
let row = sqlx::query(sql)
|
|
119
|
+
.bind(p1)
|
|
120
|
+
.bind(p2)
|
|
121
|
+
.fetch_one(&self.pool)
|
|
122
|
+
.await?;
|
|
123
|
+
Ok(row
|
|
124
|
+
.try_get::<i64, _>(0)
|
|
125
|
+
.or_else(|_| row.try_get::<u64, _>(0).map(|v| v as i64))?)
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
async fn update_log_exec(
|
|
129
|
+
&self,
|
|
130
|
+
sql: &str,
|
|
131
|
+
status: &str,
|
|
132
|
+
duration_ms: i64,
|
|
133
|
+
error_message: Option<&str>,
|
|
134
|
+
id: i64,
|
|
135
|
+
) -> Result<(), BoxError> {
|
|
136
|
+
sqlx::query(sql)
|
|
137
|
+
.bind(status)
|
|
138
|
+
.bind(duration_ms)
|
|
139
|
+
.bind(error_message)
|
|
140
|
+
.bind(id)
|
|
141
|
+
.execute(&self.pool)
|
|
142
|
+
.await?;
|
|
143
|
+
Ok(())
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
async fn catalog_exec_tx(
|
|
148
|
+
tx: &mut sqlx::Transaction<'_, sqlx::MySql>,
|
|
149
|
+
sql: &str,
|
|
150
|
+
p1: &str,
|
|
151
|
+
p2: Option<&str>,
|
|
152
|
+
) -> Result<(), BoxError> {
|
|
153
|
+
if let Some(p2) = p2 {
|
|
154
|
+
sqlx::query(sql)
|
|
155
|
+
.bind(p1)
|
|
156
|
+
.bind(p2)
|
|
157
|
+
.execute(&mut **tx)
|
|
158
|
+
.await?;
|
|
159
|
+
} else {
|
|
160
|
+
sqlx::query(sql).bind(p1).execute(&mut **tx).await?;
|
|
161
|
+
}
|
|
162
|
+
Ok(())
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
async fn catalog_exec_pool(
|
|
166
|
+
pool: &MySqlPool,
|
|
167
|
+
sql: &str,
|
|
168
|
+
p1: &str,
|
|
169
|
+
p2: Option<&str>,
|
|
170
|
+
) -> Result<(), BoxError> {
|
|
171
|
+
if let Some(p2) = p2 {
|
|
172
|
+
sqlx::query(sql).bind(p1).bind(p2).execute(pool).await?;
|
|
173
|
+
} else {
|
|
174
|
+
sqlx::query(sql).bind(p1).execute(pool).await?;
|
|
175
|
+
}
|
|
176
|
+
Ok(())
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
fn database_name_from_url(connection: &str) -> Option<&str> {
|
|
180
|
+
let (_, tail) = connection.rsplit_once('/')?;
|
|
181
|
+
let name = tail.split(['?', '#']).next()?;
|
|
182
|
+
if name.is_empty() {
|
|
183
|
+
return None;
|
|
184
|
+
}
|
|
185
|
+
Some(name)
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
fn admin_url(connection: &str, admin_db: &str) -> Option<String> {
|
|
189
|
+
let (head, tail) = connection.rsplit_once('/')?;
|
|
190
|
+
let rest = tail.find(['?', '#']).map(|i| &tail[i..]).unwrap_or("");
|
|
191
|
+
Some(format!("{head}/{admin_db}{rest}"))
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
async fn create_database(connection: &str) -> Result<(), BoxError> {
|
|
195
|
+
let Some(name) = database_name_from_url(connection) else {
|
|
196
|
+
return Ok(());
|
|
197
|
+
};
|
|
198
|
+
let Some(admin) = admin_url(connection, "") else {
|
|
199
|
+
return Ok(());
|
|
200
|
+
};
|
|
201
|
+
let pool = MySqlPool::connect(&admin).await?;
|
|
202
|
+
let sql = format!("CREATE DATABASE IF NOT EXISTS `{name}`");
|
|
203
|
+
sqlx::query(&sql).execute(&pool).await?;
|
|
204
|
+
Ok(())
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
#[cfg(test)]
|
|
208
|
+
mod tests {
|
|
209
|
+
use super::MysqlDialect;
|
|
210
|
+
use migraters_api::{assert_dialect_surface, SqlDialect};
|
|
211
|
+
|
|
212
|
+
#[test]
|
|
213
|
+
fn surface() {
|
|
214
|
+
let d = MysqlDialect;
|
|
215
|
+
assert_dialect_surface(&d);
|
|
216
|
+
assert_eq!(d.name(), "mysql");
|
|
217
|
+
assert_eq!(d.connection_env_vars(), &["MYSQL_URL", "DATABASE_URL"]);
|
|
218
|
+
assert!(!d.use_transaction());
|
|
219
|
+
assert_eq!(
|
|
220
|
+
d.normalize_connection("mysql://localhost/db"),
|
|
221
|
+
"mysql://localhost/db"
|
|
222
|
+
);
|
|
223
|
+
assert!(d.prerequisite_error("mysql://localhost/db").is_none());
|
|
224
|
+
d.prepare_setup("mysql://localhost/db").unwrap();
|
|
225
|
+
assert!(d.insert_applied_sql().contains('?'));
|
|
226
|
+
assert!(d.delete_applied_sql().contains('?'));
|
|
227
|
+
assert_eq!(d.quote_ident("t"), "`t`");
|
|
228
|
+
assert_eq!(d.now_expr(), "CURRENT_TIMESTAMP");
|
|
229
|
+
assert_eq!(d.limit_clause(2), "LIMIT 2");
|
|
230
|
+
}
|
|
231
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
[package]
|
|
2
|
+
name = "migraters-oracle"
|
|
3
|
+
version = "0.0.1"
|
|
4
|
+
edition = "2021"
|
|
5
|
+
|
|
6
|
+
[dependencies]
|
|
7
|
+
async-trait = "0.1"
|
|
8
|
+
inventory = "0.3"
|
|
9
|
+
migraters-api = { path = "../../api" }
|
|
10
|
+
oracle = { version = "0.6", features = ["chrono"] }
|
|
11
|
+
tokio = { version = "1", features = ["rt"] }
|