From 5e42d31d6cdca274d1190d46250e332a070838b1 Mon Sep 17 00:00:00 2001 From: Robert Wagner Date: Wed, 20 Mar 2024 10:21:08 +1000 Subject: [PATCH] Revert "Use reusable workflow for build (#13)" This reverts commit 59973471e490c272404eff574ba2c55fb641436b. --- .github/pull_request_template.md | 2 +- .github/workflows/main.yml | 71 ++++++++++++++++++- .github/workflows/publish-release.yml | 11 --- .github/workflows/test-report.yml | 13 ---- README.md | 2 +- src/Directory.Build.props | 13 ++++ ...portTests.VerifyBasicSupport.verified.txt} | 6 +- ...JournalCreationIfNameChanged.verified.txt} | 6 +- ....VerifyVariableSubstitutions.verified.txt} | 6 +- ...portTests.CanHandleDelimiter.verified.txt} | 36 ++++------ ...NoPublicApiChanges.Run.DotNet.verified.cs} | 2 +- .../NoPublicApiChanges.Run.Net.verified.cs | 58 +++++++++++++++ src/Tests/DatabaseSupportTests.cs | 7 +- src/Tests/MySqlConnectionManagerTests.cs | 4 +- src/Tests/MySqlSupportTests.cs | 15 ++-- src/Tests/NoPublicApiChanges.cs | 6 +- src/Tests/Tests.csproj | 10 +-- src/dbup-mysql.sln | 3 - src/dbup-mysql/MySqlExtensions.cs | 4 +- src/dbup-mysql/MySqlScriptExecutor.cs | 10 ++- src/dbup-mysql/dbup-mysql.csproj | 27 ++++--- 21 files changed, 220 insertions(+), 92 deletions(-) delete mode 100644 .github/workflows/publish-release.yml delete mode 100644 .github/workflows/test-report.yml rename src/Tests/ApprovalFiles/{DatabaseSupportTests.VerifyBasicSupport.approved.txt => DatabaseSupportTests.VerifyBasicSupport.verified.txt} (90%) rename src/Tests/ApprovalFiles/{DatabaseSupportTests.VerifyJournalCreationIfNameChanged.approved.txt => DatabaseSupportTests.VerifyJournalCreationIfNameChanged.verified.txt} (91%) rename src/Tests/ApprovalFiles/{DatabaseSupportTests.VerifyVariableSubstitutions.approved.txt => DatabaseSupportTests.VerifyVariableSubstitutions.verified.txt} (90%) rename src/Tests/{MySqlSupportTests.CanHandleDelimiter.approved.txt => ApprovalFiles/MySqlSupportTests.CanHandleDelimiter.verified.txt} (59%) rename src/Tests/ApprovalFiles/{NoPublicApiChanges.Run.approved.cs => NoPublicApiChanges.Run.DotNet.verified.cs} (98%) create mode 100644 src/Tests/ApprovalFiles/NoPublicApiChanges.Run.Net.verified.cs diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 161da36..495ce36 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,5 +1,5 @@ # Checklist -- [ ] I have read the [Contributing Guide](https://github.com/DbUp/DbUp/blob/main/CONTRIBUTING.md) +- [ ] I have read the [Contributing Guide](https://github.com/DbUp/DbUp/blob/master/CONTRIBUTING.md) - [ ] I have checked to ensure this does not introduce an unintended breaking changes - [ ] I have considered appropriate testing for my change diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3794b45..18198a1 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -7,5 +7,72 @@ on: jobs: build: - name: Build - uses: DbUp/Universe/.github/workflows/build.yml@reusable + runs-on: windows-latest # Use Ubuntu in v5.0 + + env: + DOTNET_NOLOGO: true + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true # Avoid pre-populating the NuGet package cache + + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 # all + + - name: Setup .NET 2.0 # Remove in v5.0 + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 2.0.x + + - name: Setup .NET 8.0 + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 8.0.x + + - name: Install GitVersion + uses: gittools/actions/gitversion/setup@v0 + with: + versionSpec: '5.x' + + - name: Run GitVersion + id: gitversion + uses: gittools/actions/gitversion/execute@v0 + + - name: Display SemVer + run: | + echo "SemVer: $env:GitVersion_SemVer" + + - name: Add DbUp NuGet Source + run: dotnet nuget add source --name DbUp --username DbUp --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text https://nuget.pkg.github.com/DbUp/index.json + + - name: Restore + run: dotnet restore + working-directory: src + + - name: Build + run: dotnet build -c Release --no-restore /p:Version=$env:GitVersion_SemVer + working-directory: src + + - name: Test + run: dotnet test --no-build -c Release --logger trx --logger "console;verbosity=detailed" --results-directory ../artifacts + working-directory: src + + - name: Pack + run: dotnet pack --no-build -c Release -o ../artifacts /p:Version=$env:GitVersion_SemVer + working-directory: src + + - name: Push NuGet packages to GitHub Packages ⬆️ + working-directory: artifacts + run: dotnet nuget push *.nupkg --api-key ${{ secrets.GITHUB_TOKEN }} --source "https://nuget.pkg.github.com/DbUp/index.json" + + - name: Push NuGet packages to NuGet ⬆️ + if: ${{ steps.gitversion.outputs.preReleaseLabel == '' }} + working-directory: artifacts + run: dotnet nuget push *.nupkg --api-key ${{ secrets.NUGET_APIKEY }} --source https://api.nuget.org/v3/index.json + + - name: Test Report 🧪 + uses: dorny/test-reporter@v1 + if: ${{ always() }} + with: + name: Tests + path: artifacts/*.trx + reporter: dotnet-trx diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml deleted file mode 100644 index 1968a3f..0000000 --- a/.github/workflows/publish-release.yml +++ /dev/null @@ -1,11 +0,0 @@ -name: Publish DbUp Packages to NuGet - -on: - release: - types: [ published ] - workflow_dispatch: - -jobs: - publish: - name: Publish Package - uses: DbUp/Universe/.github/workflows/publish-release.yml@reusable diff --git a/.github/workflows/test-report.yml b/.github/workflows/test-report.yml deleted file mode 100644 index f0881e5..0000000 --- a/.github/workflows/test-report.yml +++ /dev/null @@ -1,13 +0,0 @@ -name: Test Report -run-name: Generate Test Report for workflow ${{ github.event.workflow_run.name }} run ${{ github.event.workflow_run.run_number }} branch ${{ github.event.workflow_run.head_branch }} - -on: - workflow_run: - workflows: [ "CI" ] - types: - - completed - -jobs: - report: - name: Test Report 🧪 - uses: DbUp/Universe/.github/workflows/test-report.yml@reusable \ No newline at end of file diff --git a/README.md b/README.md index 5a061e6..a2abaf9 100644 --- a/README.md +++ b/README.md @@ -13,4 +13,4 @@ Please only log issue related to MySql support in this repo. For cross cutting i # Contributing -See the [readme in our main repo](https://github.com/DbUp/DbUp/blob/main/README.md) for how to get started and contribute. \ No newline at end of file +See the [readme in our main repo](https://github.com/DbUp/DbUp/blob/master/README.md) for how to get started and contribute. \ No newline at end of file diff --git a/src/Directory.Build.props b/src/Directory.Build.props index b053fd8..1d2e110 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -11,4 +11,17 @@ true + + + + true + + + true + + + embedded + + + diff --git a/src/Tests/ApprovalFiles/DatabaseSupportTests.VerifyBasicSupport.approved.txt b/src/Tests/ApprovalFiles/DatabaseSupportTests.VerifyBasicSupport.verified.txt similarity index 90% rename from src/Tests/ApprovalFiles/DatabaseSupportTests.VerifyBasicSupport.approved.txt rename to src/Tests/ApprovalFiles/DatabaseSupportTests.VerifyBasicSupport.verified.txt index 3ea7dbe..fe10484 100644 --- a/src/Tests/ApprovalFiles/DatabaseSupportTests.VerifyBasicSupport.approved.txt +++ b/src/Tests/ApprovalFiles/DatabaseSupportTests.VerifyBasicSupport.verified.txt @@ -1,11 +1,11 @@ -DB Operation: Open connection +DB Operation: Open connection Info: Beginning database upgrade -Info: Checking whether journal table exists +Info: Checking whether journal table exists.. DB Operation: Execute scalar command: select 1 from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'schemaversions' DB Operation: Dispose command Info: Journal table does not exist Info: Executing Database Server script 'Script0001.sql' -Info: Checking whether journal table exists +Info: Checking whether journal table exists.. DB Operation: Execute scalar command: select 1 from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'schemaversions' DB Operation: Dispose command Info: Creating the `schemaversions` table diff --git a/src/Tests/ApprovalFiles/DatabaseSupportTests.VerifyJournalCreationIfNameChanged.approved.txt b/src/Tests/ApprovalFiles/DatabaseSupportTests.VerifyJournalCreationIfNameChanged.verified.txt similarity index 91% rename from src/Tests/ApprovalFiles/DatabaseSupportTests.VerifyJournalCreationIfNameChanged.approved.txt rename to src/Tests/ApprovalFiles/DatabaseSupportTests.VerifyJournalCreationIfNameChanged.verified.txt index ba71ccf..780fceb 100644 --- a/src/Tests/ApprovalFiles/DatabaseSupportTests.VerifyJournalCreationIfNameChanged.approved.txt +++ b/src/Tests/ApprovalFiles/DatabaseSupportTests.VerifyJournalCreationIfNameChanged.verified.txt @@ -1,11 +1,11 @@ -DB Operation: Open connection +DB Operation: Open connection Info: Beginning database upgrade -Info: Checking whether journal table exists +Info: Checking whether journal table exists.. DB Operation: Execute scalar command: select 1 from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'TestSchemaVersions' and TABLE_SCHEMA = 'test' DB Operation: Dispose command Info: Journal table does not exist Info: Executing Database Server script 'Script0001.sql' -Info: Checking whether journal table exists +Info: Checking whether journal table exists.. DB Operation: Execute scalar command: select 1 from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'TestSchemaVersions' and TABLE_SCHEMA = 'test' DB Operation: Dispose command Info: Creating the `test`.`TestSchemaVersions` table diff --git a/src/Tests/ApprovalFiles/DatabaseSupportTests.VerifyVariableSubstitutions.approved.txt b/src/Tests/ApprovalFiles/DatabaseSupportTests.VerifyVariableSubstitutions.verified.txt similarity index 90% rename from src/Tests/ApprovalFiles/DatabaseSupportTests.VerifyVariableSubstitutions.approved.txt rename to src/Tests/ApprovalFiles/DatabaseSupportTests.VerifyVariableSubstitutions.verified.txt index 98d5fc4..af915cf 100644 --- a/src/Tests/ApprovalFiles/DatabaseSupportTests.VerifyVariableSubstitutions.approved.txt +++ b/src/Tests/ApprovalFiles/DatabaseSupportTests.VerifyVariableSubstitutions.verified.txt @@ -1,11 +1,11 @@ -DB Operation: Open connection +DB Operation: Open connection Info: Beginning database upgrade -Info: Checking whether journal table exists +Info: Checking whether journal table exists.. DB Operation: Execute scalar command: select 1 from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'schemaversions' DB Operation: Dispose command Info: Journal table does not exist Info: Executing Database Server script 'Script0001.sql' -Info: Checking whether journal table exists +Info: Checking whether journal table exists.. DB Operation: Execute scalar command: select 1 from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'schemaversions' DB Operation: Dispose command Info: Creating the `schemaversions` table diff --git a/src/Tests/MySqlSupportTests.CanHandleDelimiter.approved.txt b/src/Tests/ApprovalFiles/MySqlSupportTests.CanHandleDelimiter.verified.txt similarity index 59% rename from src/Tests/MySqlSupportTests.CanHandleDelimiter.approved.txt rename to src/Tests/ApprovalFiles/MySqlSupportTests.CanHandleDelimiter.verified.txt index d72d5f8..7d49bda 100644 --- a/src/Tests/MySqlSupportTests.CanHandleDelimiter.approved.txt +++ b/src/Tests/ApprovalFiles/MySqlSupportTests.CanHandleDelimiter.verified.txt @@ -1,30 +1,22 @@ -DB Operation: Open connection +DB Operation: Open connection Info: Beginning database upgrade -Info: Checking whether journal table exists +Info: Checking whether journal table exists.. DB Operation: Execute scalar command: select 1 from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'schemaversions' DB Operation: Dispose command -Info: Journal table does not exist +Info: Fetching list of already executed scripts. +DB Operation: Execute reader command: select scriptname from `schemaversions` order by scriptname +DB Operation: Dispose command Info: Executing Database Server script 'Script0003' -Info: Checking whether journal table exists +Info: Checking whether journal table exists.. DB Operation: Execute scalar command: select 1 from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'schemaversions' DB Operation: Dispose command -Info: Creating the `schemaversions` table -DB Operation: Execute non query command: CREATE TABLE `schemaversions` -( - `schemaversionid` INT NOT NULL AUTO_INCREMENT, - `scriptname` VARCHAR(255) NOT NULL, - `applied` TIMESTAMP NOT NULL, - PRIMARY KEY (`schemaversionid`) -); -DB Operation: Dispose command -Info: The `schemaversions` table has been created -DB Operation: Execute non query command: USE `test`; -DROP procedure IF EXISTS `testSproc`; - -DELIMITER $$ - -USE `test`$$ -CREATE PROCEDURE `testSproc`( +DB Operation: Execute non query command: USE `test` +DB Operation: Dispose command +DB Operation: Execute non query command: DROP procedure IF EXISTS `testSproc` +DB Operation: Dispose command +DB Operation: Execute non query command: USE `test` +DB Operation: Dispose command +DB Operation: Execute non query command: CREATE PROCEDURE `testSproc`( IN ssn VARCHAR(32) ) BEGIN @@ -33,7 +25,7 @@ BEGIN FROM customer as c WHERE c.ssn = ssn ; -END$$ +END DB Operation: Dispose command DB Operation: Create parameter Info: DB Operation: Add parameter to command: scriptName=Script0003 diff --git a/src/Tests/ApprovalFiles/NoPublicApiChanges.Run.approved.cs b/src/Tests/ApprovalFiles/NoPublicApiChanges.Run.DotNet.verified.cs similarity index 98% rename from src/Tests/ApprovalFiles/NoPublicApiChanges.Run.approved.cs rename to src/Tests/ApprovalFiles/NoPublicApiChanges.Run.DotNet.verified.cs index c129d52..b25c715 100644 --- a/src/Tests/ApprovalFiles/NoPublicApiChanges.Run.approved.cs +++ b/src/Tests/ApprovalFiles/NoPublicApiChanges.Run.DotNet.verified.cs @@ -1,4 +1,4 @@ -[assembly: System.CLSCompliantAttribute(true)] +[assembly: System.CLSCompliantAttribute(true)] [assembly: System.Runtime.InteropServices.ComVisibleAttribute(false)] [assembly: System.Runtime.InteropServices.GuidAttribute("b6988607-c547-4cbd-8012-f8162a25092f")] diff --git a/src/Tests/ApprovalFiles/NoPublicApiChanges.Run.Net.verified.cs b/src/Tests/ApprovalFiles/NoPublicApiChanges.Run.Net.verified.cs new file mode 100644 index 0000000..b25c715 --- /dev/null +++ b/src/Tests/ApprovalFiles/NoPublicApiChanges.Run.Net.verified.cs @@ -0,0 +1,58 @@ +[assembly: System.CLSCompliantAttribute(true)] +[assembly: System.Runtime.InteropServices.ComVisibleAttribute(false)] +[assembly: System.Runtime.InteropServices.GuidAttribute("b6988607-c547-4cbd-8012-f8162a25092f")] + +public static class MySqlExtensions +{ + public static DbUp.Builder.UpgradeEngineBuilder MySqlDatabase(DbUp.Engine.Transactions.IConnectionManager connectionManager) { } + public static DbUp.Builder.UpgradeEngineBuilder MySqlDatabase(this DbUp.Builder.SupportedDatabases supported, string connectionString) { } + public static DbUp.Builder.UpgradeEngineBuilder MySqlDatabase(this DbUp.Builder.SupportedDatabases supported, DbUp.Engine.Transactions.IConnectionManager connectionManager) { } + public static DbUp.Builder.UpgradeEngineBuilder MySqlDatabase(DbUp.Engine.Transactions.IConnectionManager connectionManager, string schema) { } + public static DbUp.Builder.UpgradeEngineBuilder MySqlDatabase(this DbUp.Builder.SupportedDatabases supported, string connectionString, string schema) { } + public static void MySqlDatabase(this DbUp.SupportedDatabasesForEnsureDatabase supported, string connectionString) { } + public static void MySqlDatabase(this DbUp.SupportedDatabasesForEnsureDatabase supported, string connectionString, int commandTimeout) { } + public static void MySqlDatabase(this DbUp.SupportedDatabasesForEnsureDatabase supported, string connectionString, string collation) { } + public static void MySqlDatabase(this DbUp.SupportedDatabasesForEnsureDatabase supported, string connectionString, int commandTimeout, string collation) { } + public static void MySqlDatabase(this DbUp.SupportedDatabasesForEnsureDatabase supported, string connectionString, DbUp.Engine.Output.IUpgradeLog logger, int timeout = -1, string collation = null) { } +} +namespace DbUp.MySql +{ + public class MySqlCommandReader : DbUp.Support.SqlCommandReader, System.IDisposable + { + public MySqlCommandReader(string sqlText) { } + protected override bool IsCustomStatement { get; } + protected override void ReadCustomStatement() { } + } + public class MySqlCommandSplitter + { + public MySqlCommandSplitter() { } + public System.Collections.Generic.IEnumerable SplitScriptIntoCommands(string scriptContents) { } + } + public class MySqlConnectionManager : DbUp.Engine.Transactions.DatabaseConnectionManager, DbUp.Engine.Transactions.IConnectionManager + { + public MySqlConnectionManager(string connectionString) { } + public override System.Collections.Generic.IEnumerable SplitScriptIntoCommands(string scriptContents) { } + } + public class MySqlObjectParser : DbUp.Support.SqlObjectParser, DbUp.Engine.ISqlObjectParser + { + public MySqlObjectParser() { } + } + public class MySqlPreprocessor : DbUp.Engine.IScriptPreprocessor + { + public MySqlPreprocessor() { } + public string Process(string contents) { } + } + public class MySqlScriptExecutor : DbUp.Support.ScriptExecutor, DbUp.Engine.IScriptExecutor + { + public MySqlScriptExecutor(System.Func connectionManagerFactory, System.Func log, string schema, System.Func variablesEnabled, System.Collections.Generic.IEnumerable scriptPreprocessors, System.Func journalFactory) { } + protected override void ExecuteCommandsWithinExceptionHandler(int index, DbUp.Engine.SqlScript script, System.Action executeCommand) { } + protected override string GetVerifySchemaSql(string schema) { } + } + public class MySqlTableJournal : DbUp.Support.TableJournal, DbUp.Engine.IJournal + { + public MySqlTableJournal(System.Func connectionManager, System.Func logger, string schema, string table) { } + protected override string CreateSchemaTableSql(string quotedPrimaryKeyName) { } + protected override string GetInsertJournalEntrySql(string scriptName, string applied) { } + protected override string GetJournalEntriesSql() { } + } +} diff --git a/src/Tests/DatabaseSupportTests.cs b/src/Tests/DatabaseSupportTests.cs index cb8dca2..f5e6232 100644 --- a/src/Tests/DatabaseSupportTests.cs +++ b/src/Tests/DatabaseSupportTests.cs @@ -1,7 +1,9 @@ -using DbUp.Builder; +#if !NETCORE +using DbUp.Builder; +using DbUp.MySql; using DbUp.Tests.Common; -namespace DbUp.MySql.Tests; +namespace DbUp.Tests.Providers.MySql; public class DatabaseSupportTests : DatabaseSupportTestsBase { @@ -18,3 +20,4 @@ protected override UpgradeEngineBuilder AddCustomNamedJournalToBuilder(UpgradeEn => new MySqlTableJournal(connectionManagerFactory, logFactory, schema, tableName) ); } +#endif diff --git a/src/Tests/MySqlConnectionManagerTests.cs b/src/Tests/MySqlConnectionManagerTests.cs index ed65fb0..dfd5c74 100644 --- a/src/Tests/MySqlConnectionManagerTests.cs +++ b/src/Tests/MySqlConnectionManagerTests.cs @@ -1,10 +1,12 @@ using System; using System.Linq; using System.Text; +using System.Threading.Tasks; +using DbUp.MySql; using Shouldly; using Xunit; -namespace DbUp.MySql.Tests +namespace DbUp.Tests.Support.MySql { public class MySqlConnectionManagerTests { diff --git a/src/Tests/MySqlSupportTests.cs b/src/Tests/MySqlSupportTests.cs index 14d2e8c..2c46e67 100644 --- a/src/Tests/MySqlSupportTests.cs +++ b/src/Tests/MySqlSupportTests.cs @@ -1,21 +1,24 @@ using System.Threading.Tasks; -using Assent; using DbUp.Tests.Common; using DbUp.Tests.Common.RecordingDb; using Shouldly; +using VerifyXunit; using Xunit; -namespace DbUp.MySql.Tests +namespace DbUp.Tests.Support.MySql { + [UsesVerify] public class MySqlSupportTests { [Fact] - public void CanHandleDelimiter() + public Task CanHandleDelimiter() { var logger = new CaptureLogsLogger(); - var recordingDbConnection = new RecordingDbConnection(logger); + var recordingDbConnection = new RecordingDbConnection(logger, "schemaversions"); + recordingDbConnection.SetupRunScripts(); var upgrader = DeployChanges.To - .MySqlDatabase(new TestConnectionManager(recordingDbConnection)) + .MySqlDatabase(string.Empty) + .OverrideConnectionFactory(recordingDbConnection) .LogTo(logger) .WithScript("Script0003", @"USE `test`; DROP procedure IF EXISTS `testSproc`; @@ -37,7 +40,7 @@ FROM customer as c var result = upgrader.PerformUpgrade(); result.Successful.ShouldBe(true); - this.Assent(logger.Log, new Configuration().UsingSanitiser(Scrubbers.ScrubDates)); + return Verifier.Verify(logger.Log, VerifyHelper.GetVerifySettings()); } } } diff --git a/src/Tests/NoPublicApiChanges.cs b/src/Tests/NoPublicApiChanges.cs index 9618037..52d3a5e 100644 --- a/src/Tests/NoPublicApiChanges.cs +++ b/src/Tests/NoPublicApiChanges.cs @@ -1,6 +1,7 @@ -using DbUp.Tests.Common; +#if !NETCORE +using DbUp.Tests.Common; -namespace DbUp.MySql.Tests; +namespace DbUp.Tests.Providers.MySql; public class NoPublicApiChanges : NoPublicApiChangesBase { @@ -9,3 +10,4 @@ public NoPublicApiChanges() { } } +#endif diff --git a/src/Tests/Tests.csproj b/src/Tests/Tests.csproj index 555645c..d76581b 100644 --- a/src/Tests/Tests.csproj +++ b/src/Tests/Tests.csproj @@ -1,7 +1,7 @@ - net8 + net462;net8 Tests DbUp.MySql.Tests @@ -10,10 +10,10 @@ - - - - + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/dbup-mysql.sln b/src/dbup-mysql.sln index 12f2895..f3deaf1 100644 --- a/src/dbup-mysql.sln +++ b/src/dbup-mysql.sln @@ -15,8 +15,6 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{62E5FE92-E288-4E09-964D-F92AF0E49131}" ProjectSection(SolutionItems) = preProject ..\.github\workflows\main.yml = ..\.github\workflows\main.yml - ..\.github\workflows\publish-release.yml = ..\.github\workflows\publish-release.yml - ..\.github\workflows\test-report.yml = ..\.github\workflows\test-report.yml EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{5DA19CA9-8039-46D6-B474-021943582785}" @@ -25,7 +23,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{77157734-01D ProjectSection(SolutionItems) = preProject .editorconfig = .editorconfig dbup-mysql.sln.DotSettings = dbup-mysql.sln.DotSettings - Directory.Build.props = Directory.Build.props EndProjectSection EndProject Global diff --git a/src/dbup-mysql/MySqlExtensions.cs b/src/dbup-mysql/MySqlExtensions.cs index 7f32379..478c6e9 100644 --- a/src/dbup-mysql/MySqlExtensions.cs +++ b/src/dbup-mysql/MySqlExtensions.cs @@ -164,7 +164,7 @@ public static void MySqlDatabase( } catch (Exception e) { - logger.LogInformation(@"Database not found on server with connection string in settings: {0}", e.Message); + logger.WriteInformation(@"Database not found on server with connection string in settings: {0}", e.Message); } using (var connection = new MySqlConnection(masterConnectionString)) @@ -195,7 +195,7 @@ public static void MySqlDatabase( command.ExecuteNonQuery(); } - logger.LogInformation(@"Created database {0}", databaseName); + logger.WriteInformation(@"Created database {0}", databaseName); } } diff --git a/src/dbup-mysql/MySqlScriptExecutor.cs b/src/dbup-mysql/MySqlScriptExecutor.cs index 70324de..5e221a6 100644 --- a/src/dbup-mysql/MySqlScriptExecutor.cs +++ b/src/dbup-mysql/MySqlScriptExecutor.cs @@ -41,10 +41,14 @@ protected override void ExecuteCommandsWithinExceptionHandler(int index, SqlScri } catch (MySqlException exception) { +#if MY_SQL_DATA_6_9_5 + var code = exception.ErrorCode; +#else var code = exception.Code; - Log().LogInformation("MySql exception has occurred in script: '{0}'", script.Name); - Log().LogError("Script block number: {0}; MySql error code: {1}; Number {2}; Message: {3}", index, code, exception.Number, exception.Message); - Log().LogError(exception.ToString()); +#endif + Log().WriteInformation("MySql exception has occurred in script: '{0}'", script.Name); + Log().WriteError("Script block number: {0}; MySql error code: {1}; Number {2}; Message: {3}", index, code, exception.Number, exception.Message); + Log().WriteError(exception.ToString()); throw; } } diff --git a/src/dbup-mysql/dbup-mysql.csproj b/src/dbup-mysql/dbup-mysql.csproj index ce3df24..1e7d602 100644 --- a/src/dbup-mysql/dbup-mysql.csproj +++ b/src/dbup-mysql/dbup-mysql.csproj @@ -6,7 +6,7 @@ DbUp Contributors DbUp Copyright © DbUp Contributors 2015 - netstandard2.0 + netstandard1.3;netstandard2.0;net462 dbup-mysql DbUp.MySql dbup-mysql @@ -16,16 +16,27 @@ dbup-icon.png - - true - true - embedded + + $(DefineConstants);MY_SQL_DATA_6_9_5 - + - + - + + + + + + + + + + + + + +