Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only target netstandard 2.0 #11

Merged
merged 3 commits into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,13 @@ jobs:
env:
DOTNET_NOLOGO: true
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true # Avoid pre-populating the NuGet package cache
ASSENTNONINTERACTIVE: true

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:
Expand Down
13 changes: 0 additions & 13 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,4 @@
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>

<PropertyGroup Condition="'$(TF_BUILD)' == 'true' Or '$(CI)' == 'true'">

<!-- Perform a deterministic build, so our binaries aren't impacted by build server environmental factors (e.g. file paths). -->
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>

<!-- Embed source files that are not tracked by the source control manager in the PDB -->
<EmbedUntrackedSources>true</EmbedUntrackedSources>

<!-- Recommended: Embed symbols containing Source Link in the main file (exe/dll) -->
<DebugType>embedded</DebugType>

</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
58 changes: 0 additions & 58 deletions src/Tests/ApprovalFiles/NoPublicApiChanges.Run.Net.verified.cs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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")]

Expand Down
7 changes: 2 additions & 5 deletions src/Tests/DatabaseSupportTests.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
#if !NETCORE
using DbUp.Builder;
using DbUp.MySql;
using DbUp.Builder;
using DbUp.Tests.Common;

namespace DbUp.Tests.Providers.MySql;
namespace DbUp.MySql.Tests;

public class DatabaseSupportTests : DatabaseSupportTestsBase
{
Expand All @@ -20,4 +18,3 @@ protected override UpgradeEngineBuilder AddCustomNamedJournalToBuilder(UpgradeEn
=> new MySqlTableJournal(connectionManagerFactory, logFactory, schema, tableName)
);
}
#endif
4 changes: 1 addition & 3 deletions src/Tests/MySqlConnectionManagerTests.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
using System;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DbUp.MySql;
using Shouldly;
using Xunit;

namespace DbUp.Tests.Support.MySql
namespace DbUp.MySql.Tests
{
public class MySqlConnectionManagerTests
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,30 @@
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: Fetching list of already executed scripts.
DB Operation: Execute reader command: select scriptname from `schemaversions` order by scriptname
DB Operation: Dispose command
Info: Journal table does not exist
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
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`(
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`(
IN ssn VARCHAR(32)
)
BEGIN
Expand All @@ -25,7 +33,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
Expand Down
15 changes: 6 additions & 9 deletions src/Tests/MySqlSupportTests.cs
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
using System.Threading.Tasks;
using Assent;
using DbUp.Tests.Common;
using DbUp.Tests.Common.RecordingDb;
using Shouldly;
using VerifyXunit;
using Xunit;

namespace DbUp.Tests.Support.MySql
namespace DbUp.MySql.Tests
{
[UsesVerify]
public class MySqlSupportTests
{
[Fact]
public Task CanHandleDelimiter()
public void CanHandleDelimiter()
{
var logger = new CaptureLogsLogger();
var recordingDbConnection = new RecordingDbConnection(logger, "schemaversions");
recordingDbConnection.SetupRunScripts();
var recordingDbConnection = new RecordingDbConnection(logger);
var upgrader = DeployChanges.To
.MySqlDatabase(string.Empty)
.OverrideConnectionFactory(recordingDbConnection)
.MySqlDatabase(new TestConnectionManager(recordingDbConnection))
.LogTo(logger)
.WithScript("Script0003", @"USE `test`;
DROP procedure IF EXISTS `testSproc`;
Expand All @@ -40,7 +37,7 @@ FROM customer as c
var result = upgrader.PerformUpgrade();

result.Successful.ShouldBe(true);
return Verifier.Verify(logger.Log, VerifyHelper.GetVerifySettings());
this.Assent(logger.Log, new Configuration().UsingSanitiser(Scrubbers.ScrubDates));
}
}
}
6 changes: 2 additions & 4 deletions src/Tests/NoPublicApiChanges.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#if !NETCORE
using DbUp.Tests.Common;
using DbUp.Tests.Common;

namespace DbUp.Tests.Providers.MySql;
namespace DbUp.MySql.Tests;

public class NoPublicApiChanges : NoPublicApiChangesBase
{
Expand All @@ -10,4 +9,3 @@ public NoPublicApiChanges()
{
}
}
#endif
10 changes: 5 additions & 5 deletions src/Tests/Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net462;net8</TargetFrameworks>
<TargetFramework>net8</TargetFramework>
<AssemblyName>Tests</AssemblyName>
<RootNamespace>DbUp.MySql.Tests</RootNamespace>
<!-- <ImplicitUsings>enable</ImplicitUsings> Can't use implict usings with net46 -->
Expand All @@ -10,10 +10,10 @@

<ItemGroup>
<ProjectReference Include="..\dbup-mysql\dbup-mysql.csproj"/>
<PackageReference Include="DbUp.Tests.Common" Version="5.0.37"/>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0"/>
<PackageReference Include="xunit" Version="2.6.6"/>
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6">
<PackageReference Include="DbUp.Tests.Common" Version="6.0.0-beta.108"/>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="xunit" Version="2.7.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.7">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
1 change: 1 addition & 0 deletions src/dbup-mysql.sln
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ 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
Expand Down
4 changes: 2 additions & 2 deletions src/dbup-mysql/MySqlExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public static void MySqlDatabase(
}
catch (Exception e)
{
logger.WriteInformation(@"Database not found on server with connection string in settings: {0}", e.Message);
logger.LogInformation(@"Database not found on server with connection string in settings: {0}", e.Message);
}

using (var connection = new MySqlConnection(masterConnectionString))
Expand Down Expand Up @@ -195,7 +195,7 @@ public static void MySqlDatabase(
command.ExecuteNonQuery();
}

logger.WriteInformation(@"Created database {0}", databaseName);
logger.LogInformation(@"Created database {0}", databaseName);
}
}

Expand Down
10 changes: 3 additions & 7 deletions src/dbup-mysql/MySqlScriptExecutor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,10 @@ 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;
#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());
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());
throw;
}
}
Expand Down
27 changes: 8 additions & 19 deletions src/dbup-mysql/dbup-mysql.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Company>DbUp Contributors</Company>
<Product>DbUp</Product>
<Copyright>Copyright © DbUp Contributors 2015</Copyright>
<TargetFrameworks>netstandard1.3;netstandard2.0;net462</TargetFrameworks>
<TargetFramework>netstandard2.0</TargetFramework>
<AssemblyName>dbup-mysql</AssemblyName>
<RootNamespace>DbUp.MySql</RootNamespace>
<PackageId>dbup-mysql</PackageId>
Expand All @@ -16,27 +16,16 @@
<PackageIcon>dbup-icon.png</PackageIcon>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetFramework)' == 'net462'">
<DefineConstants>$(DefineConstants);MY_SQL_DATA_6_9_5</DefineConstants>
<PropertyGroup Condition="'$(CI)' == 'true'">
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild> <!-- Perform a deterministic build, so our binaries aren't impacted by build server environmental factors (e.g. file paths). -->
<EmbedUntrackedSources>true</EmbedUntrackedSources> <!-- Embed source files that are not tracked by the source control manager in the PDB -->
<DebugType>embedded</DebugType> <!-- Recommended: Embed symbols containing Source Link in the main file (exe/dll) -->
</PropertyGroup>

<ItemGroup>
<PackageReference Include="dbup-core" Version="5.0.87"/>
<PackageReference Include="dbup-core" Version="6.0.0-beta.108"/>
<PackageReference Include="System.Data.SqlClient" Version="4.8.6" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net462'">
<Reference Include="System"/>
<PackageReference Include="MySql.Data" Version="6.9.5"/>
<!-- last version to support < .NET 4.5.2. -->
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netstandard1.3'">
<PackageReference Include="MySql.Data" Version="6.10.9"/>
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="MySql.Data" Version="8.0.33"/>
<PackageReference Include="MySql.Data" Version="8.3.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Loading