Skip to content

Commit 4b89161

Browse files
committed
Updated to dbup-core 6.0 beta, targeted netstandard2 and update Npgsql reference
1 parent e19e2c0 commit 4b89161

11 files changed

+49
-118
lines changed

src/Directory.Build.props

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,4 @@
1010
<LangVersion>latest</LangVersion>
1111
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
1212
</PropertyGroup>
13-
14-
<PropertyGroup Condition="'$(TF_BUILD)' == 'true' Or '$(CI)' == 'true'">
15-
16-
<!-- Perform a deterministic build, so our binaries aren't impacted by build server environmental factors (e.g. file paths). -->
17-
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
18-
19-
<!-- Embed source files that are not tracked by the source control manager in the PDB -->
20-
<EmbedUntrackedSources>true</EmbedUntrackedSources>
21-
22-
<!-- Recommended: Embed symbols containing Source Link in the main file (exe/dll) -->
23-
<DebugType>embedded</DebugType>
24-
25-
</PropertyGroup>
26-
2713
</Project>

src/Tests/ApprovalFiles/DatabaseSupportTests.VerifyBasicSupport.verified.txt renamed to src/Tests/ApprovalFiles/DatabaseSupportTests.VerifyBasicSupport.approved.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
DB Operation: Open connection
22
Info: Beginning database upgrade
3-
Info: Checking whether journal table exists..
3+
Info: Checking whether journal table exists
44
DB Operation: Execute scalar command: select 1 from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'schemaversions'
55
DB Operation: Dispose command
66
Info: Journal table does not exist
77
Info: Executing Database Server script 'Script0001.sql'
8-
Info: Checking whether journal table exists..
8+
Info: Checking whether journal table exists
99
DB Operation: Execute scalar command: select 1 from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'schemaversions'
1010
DB Operation: Dispose command
1111
Info: Creating the "schemaversions" table

src/Tests/ApprovalFiles/DatabaseSupportTests.VerifyJournalCreationIfNameChanged.verified.txt renamed to src/Tests/ApprovalFiles/DatabaseSupportTests.VerifyJournalCreationIfNameChanged.approved.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
DB Operation: Open connection
22
Info: Beginning database upgrade
3-
Info: Checking whether journal table exists..
3+
Info: Checking whether journal table exists
44
DB Operation: Execute scalar command: select 1 from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'TestSchemaVersions' and TABLE_SCHEMA = 'test'
55
DB Operation: Dispose command
66
Info: Journal table does not exist
77
Info: Executing Database Server script 'Script0001.sql'
8-
Info: Checking whether journal table exists..
8+
Info: Checking whether journal table exists
99
DB Operation: Execute scalar command: select 1 from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'TestSchemaVersions' and TABLE_SCHEMA = 'test'
1010
DB Operation: Dispose command
1111
Info: Creating the "test"."TestSchemaVersions" table

src/Tests/ApprovalFiles/DatabaseSupportTests.VerifyVariableSubstitutions.verified.txt renamed to src/Tests/ApprovalFiles/DatabaseSupportTests.VerifyVariableSubstitutions.approved.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
DB Operation: Open connection
22
Info: Beginning database upgrade
3-
Info: Checking whether journal table exists..
3+
Info: Checking whether journal table exists
44
DB Operation: Execute scalar command: select 1 from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'schemaversions'
55
DB Operation: Dispose command
66
Info: Journal table does not exist
77
Info: Executing Database Server script 'Script0001.sql'
8-
Info: Checking whether journal table exists..
8+
Info: Checking whether journal table exists
99
DB Operation: Execute scalar command: select 1 from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'schemaversions'
1010
DB Operation: Dispose command
1111
Info: Creating the "schemaversions" table

src/Tests/ApprovalFiles/NoPublicApiChanges.Run.Net.verified.cs

Lines changed: 0 additions & 45 deletions
This file was deleted.

src/Tests/Tests.csproj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net462;net8</TargetFrameworks>
4+
<TargetFramework>net8</TargetFramework>
55
<AssemblyName>Tests</AssemblyName>
66
<RootNamespace>DbUp.Redshift.Tests</RootNamespace>
77
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
8-
<!-- <ImplicitUsings>enable</ImplicitUsings> Can't use implict usings with net46 -->
8+
<ImplicitUsings>enable</ImplicitUsings>
99
<Nullable>enable</Nullable>
1010
<NoWarn>$(NoWarn);NETSDK1138</NoWarn> <!-- Purposefully leaving an old version of netcoreapp to ensure we have compatibility. This never gets published -->
1111
<LangVersion>latest</LangVersion>
1212
</PropertyGroup>
1313

1414
<ItemGroup>
1515
<ProjectReference Include="..\dbup-redshift\dbup-redshift.csproj" />
16-
<PackageReference Include="DbUp.Tests.Common" Version="5.0.37" />
17-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
18-
<PackageReference Include="xunit" Version="2.6.6" />
19-
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6">
16+
<PackageReference Include="DbUp.Tests.Common" Version="6.0.0-beta.108" />
17+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
18+
<PackageReference Include="xunit" Version="2.9.0" />
19+
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
2020
<PrivateAssets>all</PrivateAssets>
2121
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2222
</PackageReference>

src/dbup-redshift.sln.DotSettings

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,8 @@
55
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=SQ/@EntryIndexedValue">SQ</s:String>
66
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateInstanceFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;</s:String>
77
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateStaticFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;</s:String>
8+
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/UserRules/=4a98fdf6_002D7d98_002D4f5a_002Dafeb_002Dea44ad98c70c/@EntryIndexedValue">&lt;Policy&gt;&lt;Descriptor Staticness="Instance" AccessRightKinds="Private" Description="Instance fields (private)"&gt;&lt;ElementKinds&gt;&lt;Kind Name="FIELD" /&gt;&lt;Kind Name="READONLY_FIELD" /&gt;&lt;/ElementKinds&gt;&lt;/Descriptor&gt;&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;&lt;/Policy&gt;</s:String>
9+
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/UserRules/=f9fce829_002De6f4_002D4cb2_002D80f1_002D5497c44f51df/@EntryIndexedValue">&lt;Policy&gt;&lt;Descriptor Staticness="Static" AccessRightKinds="Private" Description="Static fields (private)"&gt;&lt;ElementKinds&gt;&lt;Kind Name="FIELD" /&gt;&lt;/ElementKinds&gt;&lt;/Descriptor&gt;&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;&lt;/Policy&gt;</s:String>
10+
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EPredefinedNamingRulesToUserRulesUpgrade/@EntryIndexedValue">True</s:Boolean>
811
<s:String x:Key="/Default/FilterSettingsManager/CoverageFilterXml/@EntryValue">&lt;data&gt;&lt;IncludeFilters /&gt;&lt;ExcludeFilters /&gt;&lt;/data&gt;</s:String>
912
<s:String x:Key="/Default/FilterSettingsManager/AttributeFilterXml/@EntryValue">&lt;data /&gt;</s:String></wpf:ResourceDictionary>

src/dbup-redshift/RedshiftExtensions.cs

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -122,17 +122,14 @@ public static void RedshiftDatabase(this SupportedDatabasesForEnsureDatabase sup
122122
logMasterConnectionStringBuilder.Password = "******";
123123
}
124124

125-
logger.WriteInformation("Master ConnectionString => {0}", logMasterConnectionStringBuilder.ConnectionString);
125+
logger.LogInformation("Master ConnectionString => {0}", logMasterConnectionStringBuilder.ConnectionString);
126126

127127
using (var connection = new NpgsqlConnection(masterConnectionStringBuilder.ConnectionString))
128128
{
129129
connection.Open();
130130

131-
var sqlCommandText = string.Format
132-
(
133-
@"SELECT case WHEN oid IS NOT NULL THEN 1 ELSE 0 end FROM pg_database WHERE datname = '{0}' limit 1;",
134-
databaseName
135-
);
131+
var sqlCommandText =
132+
$@"SELECT case WHEN oid IS NOT NULL THEN 1 ELSE 0 end FROM pg_database WHERE datname = '{databaseName}' limit 1;";
136133

137134

138135
// check to see if the database already exists..
@@ -150,11 +147,7 @@ public static void RedshiftDatabase(this SupportedDatabasesForEnsureDatabase sup
150147
}
151148
}
152149

153-
sqlCommandText = string.Format
154-
(
155-
"create database \"{0}\";",
156-
databaseName
157-
);
150+
sqlCommandText = $"create database \"{databaseName}\";";
158151

159152
// Create the database...
160153
using (var command = new NpgsqlCommand(sqlCommandText, connection)
@@ -166,7 +159,7 @@ public static void RedshiftDatabase(this SupportedDatabasesForEnsureDatabase sup
166159

167160
}
168161

169-
logger.WriteInformation(@"Created database {0}", databaseName);
162+
logger.LogInformation(@"Created database {0}", databaseName);
170163
}
171164
}
172165

src/dbup-redshift/RedshiftScriptExecutor.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ protected override void ExecuteCommandsWithinExceptionHandler(int index, SqlScri
4646
catch (PostgresException exception)
4747
#endif
4848
{
49-
Log().WriteInformation("Npgsql exception has occured in script: '{0}'", script.Name);
50-
Log().WriteError("Script block number: {0}; Block line {1}; Position: {2}; Message: {3}", index, exception.Line, exception.Position, exception.Message);
51-
Log().WriteError(exception.ToString());
49+
Log().LogInformation("Npgsql exception has occured in script: '{0}'", script.Name);
50+
Log().LogError("Script block number: {0}; Block line {1}; Position: {2}; Message: {3}", index, exception.Line, exception.Position, exception.Message);
51+
Log().LogError(exception.ToString());
5252
throw;
5353
}
5454
}

0 commit comments

Comments
 (0)