Skip to content

Commit 37f864f

Browse files
authored
Merge pull request #17 from DbUp/core6
Update dbup-core to 6.0 and other references
2 parents d97055c + 2a19190 commit 37f864f

12 files changed

+41
-100
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
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 & 49 deletions
This file was deleted.
File renamed without changes.

src/Tests/PostgresTableJournalTests.cs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,22 @@ namespace DbUp.Postgresql.Tests;
1111

1212
public class PostgresTableJournalTests : IDisposable
1313
{
14-
[Fact]
14+
[Fact]
1515
public void uses_positional_parameters_when_sql_rewriting_disabled()
1616
{
1717
AppContext.SetSwitch("Npgsql.EnableSqlRewriting", false);
1818

1919
var dbConnection = Substitute.For<IDbConnection>();
20-
var connectionManager = new TestConnectionManager(dbConnection, true);
20+
var connectionManager = new TestConnectionManager(dbConnection);
2121
var command = Substitute.For<IDbCommand>();
2222
var param1 = Substitute.For<IDbDataParameter>();
2323
var param2 = Substitute.For<IDbDataParameter>();
2424
dbConnection.CreateCommand().Returns(command);
2525
command.CreateParameter().Returns(param1, param2);
2626
command.ExecuteScalar().Returns(x => 0);
2727
var consoleUpgradeLog = new ConsoleUpgradeLog();
28-
var journal = new PostgresqlTableJournal(() => connectionManager, () => consoleUpgradeLog, "public", "SchemaVersions");
28+
var journal = new PostgresqlTableJournal(() => connectionManager, () => consoleUpgradeLog, "public",
29+
"SchemaVersions");
2930

3031
// Act
3132
journal.StoreExecutedScript(new SqlScript("test", "select 1"), () => command);
@@ -45,15 +46,16 @@ public void uses_named_parameters_when_sql_rewriting_enabled()
4546
AppContext.SetSwitch("Npgsql.EnableSqlRewriting", true);
4647

4748
var dbConnection = Substitute.For<IDbConnection>();
48-
var connectionManager = new TestConnectionManager(dbConnection, true);
49+
var connectionManager = new TestConnectionManager(dbConnection);
4950
var command = Substitute.For<IDbCommand>();
5051
var param1 = Substitute.For<IDbDataParameter>();
5152
var param2 = Substitute.For<IDbDataParameter>();
5253
dbConnection.CreateCommand().Returns(command);
5354
command.CreateParameter().Returns(param1, param2);
5455
command.ExecuteScalar().Returns(x => 0);
5556
var consoleUpgradeLog = new ConsoleUpgradeLog();
56-
var journal = new PostgresqlTableJournal(() => connectionManager, () => consoleUpgradeLog, "public", "SchemaVersions");
57+
var journal = new PostgresqlTableJournal(() => connectionManager, () => consoleUpgradeLog, "public",
58+
"SchemaVersions");
5759

5860
// Act
5961
journal.StoreExecutedScript(new SqlScript("test", "select 1"), () => command);
@@ -62,7 +64,8 @@ public void uses_named_parameters_when_sql_rewriting_enabled()
6264
command.Received(2).CreateParameter();
6365
param1.ParameterName.ShouldBe("scriptName");
6466
param2.ParameterName.ShouldBe("applied");
65-
command.CommandText.ShouldBe("""insert into "public"."SchemaVersions" (ScriptName, Applied) values (@scriptName, @applied)""");
67+
command.CommandText.ShouldBe(
68+
"""insert into "public"."SchemaVersions" (ScriptName, Applied) values (@scriptName, @applied)""");
6669
command.Received().ExecuteNonQuery();
6770
}
6871

src/Tests/Tests.csproj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
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.Postgresql.Tests</RootNamespace>
7-
<!-- <ImplicitUsings>enable</ImplicitUsings> Can't use implict usings with net46 -->
7+
<ImplicitUsings>enable</ImplicitUsings>
88
<Nullable>enable</Nullable>
99
</PropertyGroup>
1010

1111
<ItemGroup>
1212
<ProjectReference Include="..\dbup-postgresql\dbup-postgresql.csproj"/>
13-
<PackageReference Include="DbUp.Tests.Common" Version="5.0.52-Split.8"/>
14-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0"/>
15-
<PackageReference Include="xunit" Version="2.6.6"/>
16-
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6">
13+
<PackageReference Include="DbUp.Tests.Common" Version="6.0.0-beta.146"/>
14+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0"/>
15+
<PackageReference Include="xunit" Version="2.9.0"/>
16+
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
1717
<PrivateAssets>all</PrivateAssets>
1818
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1919
</PackageReference>

src/dbup-postgresql.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-postgresql/PostgresqlExtensions.cs

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ private static void PostgresqlDatabase(this SupportedDatabasesForEnsureDatabase
153153
logMasterConnectionStringBuilder.Password = "******";
154154
}
155155

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

158158
using (var connection = new NpgsqlConnection(masterConnectionStringBuilder.ConnectionString))
159159
{
@@ -164,11 +164,8 @@ private static void PostgresqlDatabase(this SupportedDatabasesForEnsureDatabase
164164
}
165165
connection.Open();
166166

167-
var sqlCommandText = string.Format
168-
(
169-
@"SELECT case WHEN oid IS NOT NULL THEN 1 ELSE 0 end FROM pg_database WHERE datname = '{0}' limit 1;",
170-
databaseName
171-
);
167+
var sqlCommandText =
168+
$@"SELECT case WHEN oid IS NOT NULL THEN 1 ELSE 0 end FROM pg_database WHERE datname = '{databaseName}' limit 1;";
172169

173170
// check to see if the database already exists..
174171
using (var command = new NpgsqlCommand(sqlCommandText, connection)
@@ -185,11 +182,7 @@ private static void PostgresqlDatabase(this SupportedDatabasesForEnsureDatabase
185182
}
186183
}
187184

188-
sqlCommandText = string.Format
189-
(
190-
"create database \"{0}\";",
191-
databaseName
192-
);
185+
sqlCommandText = $"create database \"{databaseName}\";";
193186

194187
// Create the database...
195188
using (var command = new NpgsqlCommand(sqlCommandText, connection)
@@ -200,7 +193,7 @@ private static void PostgresqlDatabase(this SupportedDatabasesForEnsureDatabase
200193
command.ExecuteNonQuery();
201194
}
202195

203-
logger.WriteInformation(@"Created database {0}", databaseName);
196+
logger.LogInformation(@"Created database {0}", databaseName);
204197
}
205198
}
206199

0 commit comments

Comments
 (0)