diff --git a/src/Directory.Build.props b/src/Directory.Build.props index f3a3a06..c2554b1 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -10,18 +10,4 @@ latest true - - - - - true - - - true - - - embedded - - - diff --git a/src/Tests/ApprovalFiles/DatabaseSupportTests.VerifyBasicSupport.verified.txt b/src/Tests/ApprovalFiles/DatabaseSupportTests.VerifyBasicSupport.approved.txt similarity index 92% rename from src/Tests/ApprovalFiles/DatabaseSupportTests.VerifyBasicSupport.verified.txt rename to src/Tests/ApprovalFiles/DatabaseSupportTests.VerifyBasicSupport.approved.txt index b2efe85..1c26cb7 100644 --- a/src/Tests/ApprovalFiles/DatabaseSupportTests.VerifyBasicSupport.verified.txt +++ b/src/Tests/ApprovalFiles/DatabaseSupportTests.VerifyBasicSupport.approved.txt @@ -1,11 +1,11 @@ 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.verified.txt b/src/Tests/ApprovalFiles/DatabaseSupportTests.VerifyJournalCreationIfNameChanged.approved.txt similarity index 93% rename from src/Tests/ApprovalFiles/DatabaseSupportTests.VerifyJournalCreationIfNameChanged.verified.txt rename to src/Tests/ApprovalFiles/DatabaseSupportTests.VerifyJournalCreationIfNameChanged.approved.txt index 17625f2..bf50dd8 100644 --- a/src/Tests/ApprovalFiles/DatabaseSupportTests.VerifyJournalCreationIfNameChanged.verified.txt +++ b/src/Tests/ApprovalFiles/DatabaseSupportTests.VerifyJournalCreationIfNameChanged.approved.txt @@ -1,11 +1,11 @@ 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.verified.txt b/src/Tests/ApprovalFiles/DatabaseSupportTests.VerifyVariableSubstitutions.approved.txt similarity index 92% rename from src/Tests/ApprovalFiles/DatabaseSupportTests.VerifyVariableSubstitutions.verified.txt rename to src/Tests/ApprovalFiles/DatabaseSupportTests.VerifyVariableSubstitutions.approved.txt index 2854ff2..c4898b2 100644 --- a/src/Tests/ApprovalFiles/DatabaseSupportTests.VerifyVariableSubstitutions.verified.txt +++ b/src/Tests/ApprovalFiles/DatabaseSupportTests.VerifyVariableSubstitutions.approved.txt @@ -1,11 +1,11 @@ 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/NoPublicApiChanges.Run.Net.verified.cs b/src/Tests/ApprovalFiles/NoPublicApiChanges.Run.Net.verified.cs deleted file mode 100644 index 65bb0bd..0000000 --- a/src/Tests/ApprovalFiles/NoPublicApiChanges.Run.Net.verified.cs +++ /dev/null @@ -1,45 +0,0 @@ -[assembly: System.CLSCompliantAttribute(true)] -[assembly: System.Runtime.InteropServices.ComVisibleAttribute(false)] -[assembly: System.Runtime.InteropServices.GuidAttribute("abcc04cc-0bd3-421e-9ae4-9fd0e4f4ef04")] - -public static class RedshiftExtensions -{ - public static DbUp.Builder.UpgradeEngineBuilder JournalToRedshiftTable(this DbUp.Builder.UpgradeEngineBuilder builder, string schema, string table) { } - public static DbUp.Builder.UpgradeEngineBuilder RedshiftDatabase(DbUp.Engine.Transactions.IConnectionManager connectionManager) { } - public static DbUp.Builder.UpgradeEngineBuilder RedshiftDatabase(this DbUp.Builder.SupportedDatabases supported, string connectionString) { } - public static DbUp.Builder.UpgradeEngineBuilder RedshiftDatabase(this DbUp.Builder.SupportedDatabases supported, DbUp.Engine.Transactions.IConnectionManager connectionManager) { } - public static DbUp.Builder.UpgradeEngineBuilder RedshiftDatabase(DbUp.Engine.Transactions.IConnectionManager connectionManager, string schema) { } - public static DbUp.Builder.UpgradeEngineBuilder RedshiftDatabase(this DbUp.Builder.SupportedDatabases supported, string connectionString, string schema) { } - public static void RedshiftDatabase(this DbUp.SupportedDatabasesForEnsureDatabase supported, string connectionString) { } - public static void RedshiftDatabase(this DbUp.SupportedDatabasesForEnsureDatabase supported, string connectionString, DbUp.Engine.Output.IUpgradeLog logger) { } -} -namespace DbUp.Redshift -{ - public class RedshiftConnectionManager : DbUp.Engine.Transactions.DatabaseConnectionManager, DbUp.Engine.Transactions.IConnectionManager - { - public RedshiftConnectionManager(string connectionString) { } - public override System.Collections.Generic.IEnumerable SplitScriptIntoCommands(string scriptContents) { } - } - public class RedshiftObjectParser : DbUp.Support.SqlObjectParser, DbUp.Engine.ISqlObjectParser - { - public RedshiftObjectParser() { } - } - public class RedshiftPreprocessor : DbUp.Engine.IScriptPreprocessor - { - public RedshiftPreprocessor() { } - public string Process(string contents) { } - } - public class RedshiftScriptExecutor : DbUp.Support.ScriptExecutor, DbUp.Engine.IScriptExecutor - { - public RedshiftScriptExecutor(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 excuteCommand) { } - protected override string GetVerifySchemaSql(string schema) { } - } - public class RedshiftTableJournal : DbUp.Support.TableJournal, DbUp.Engine.IJournal - { - public RedshiftTableJournal(System.Func connectionManager, System.Func logger, string schema, string tableName) { } - protected override string CreateSchemaTableSql(string quotedPrimaryKeyName) { } - protected override string GetInsertJournalEntrySql(string scriptName, string applied) { } - protected override string GetJournalEntriesSql() { } - } -} diff --git a/src/Tests/ApprovalFiles/NoPublicApiChanges.Run.DotNet.verified.cs b/src/Tests/ApprovalFiles/NoPublicApiChanges.Run.approved.cs similarity index 100% rename from src/Tests/ApprovalFiles/NoPublicApiChanges.Run.DotNet.verified.cs rename to src/Tests/ApprovalFiles/NoPublicApiChanges.Run.approved.cs diff --git a/src/Tests/Tests.csproj b/src/Tests/Tests.csproj index f211f1a..d8c8852 100644 --- a/src/Tests/Tests.csproj +++ b/src/Tests/Tests.csproj @@ -1,11 +1,11 @@ - net462;net8 + net8 Tests DbUp.Redshift.Tests true - + enable enable $(NoWarn);NETSDK1138 latest @@ -13,10 +13,10 @@ - - - - + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/dbup-redshift.sln.DotSettings b/src/dbup-redshift.sln.DotSettings index 2c78c0a..d3334fb 100644 --- a/src/dbup-redshift.sln.DotSettings +++ b/src/dbup-redshift.sln.DotSettings @@ -5,5 +5,8 @@ SQ <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> + <Policy><Descriptor Staticness="Instance" AccessRightKinds="Private" Description="Instance fields (private)"><ElementKinds><Kind Name="FIELD" /><Kind Name="READONLY_FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></Policy> + <Policy><Descriptor Staticness="Static" AccessRightKinds="Private" Description="Static fields (private)"><ElementKinds><Kind Name="FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></Policy> + True <data><IncludeFilters /><ExcludeFilters /></data> <data /> \ No newline at end of file diff --git a/src/dbup-redshift/RedshiftExtensions.cs b/src/dbup-redshift/RedshiftExtensions.cs index 63d873d..b3041fb 100644 --- a/src/dbup-redshift/RedshiftExtensions.cs +++ b/src/dbup-redshift/RedshiftExtensions.cs @@ -122,17 +122,14 @@ public static void RedshiftDatabase(this SupportedDatabasesForEnsureDatabase sup logMasterConnectionStringBuilder.Password = "******"; } - logger.WriteInformation("Master ConnectionString => {0}", logMasterConnectionStringBuilder.ConnectionString); + logger.LogInformation("Master ConnectionString => {0}", logMasterConnectionStringBuilder.ConnectionString); using (var connection = new NpgsqlConnection(masterConnectionStringBuilder.ConnectionString)) { connection.Open(); - var sqlCommandText = string.Format - ( - @"SELECT case WHEN oid IS NOT NULL THEN 1 ELSE 0 end FROM pg_database WHERE datname = '{0}' limit 1;", - databaseName - ); + var sqlCommandText = + $@"SELECT case WHEN oid IS NOT NULL THEN 1 ELSE 0 end FROM pg_database WHERE datname = '{databaseName}' limit 1;"; // check to see if the database already exists.. @@ -150,11 +147,7 @@ public static void RedshiftDatabase(this SupportedDatabasesForEnsureDatabase sup } } - sqlCommandText = string.Format - ( - "create database \"{0}\";", - databaseName - ); + sqlCommandText = $"create database \"{databaseName}\";"; // Create the database... using (var command = new NpgsqlCommand(sqlCommandText, connection) @@ -166,7 +159,7 @@ public static void RedshiftDatabase(this SupportedDatabasesForEnsureDatabase sup } - logger.WriteInformation(@"Created database {0}", databaseName); + logger.LogInformation(@"Created database {0}", databaseName); } } diff --git a/src/dbup-redshift/RedshiftScriptExecutor.cs b/src/dbup-redshift/RedshiftScriptExecutor.cs index 43bdaf1..98b02b0 100644 --- a/src/dbup-redshift/RedshiftScriptExecutor.cs +++ b/src/dbup-redshift/RedshiftScriptExecutor.cs @@ -46,9 +46,9 @@ protected override void ExecuteCommandsWithinExceptionHandler(int index, SqlScri catch (PostgresException exception) #endif { - Log().WriteInformation("Npgsql exception has occured in script: '{0}'", script.Name); - Log().WriteError("Script block number: {0}; Block line {1}; Position: {2}; Message: {3}", index, exception.Line, exception.Position, exception.Message); - Log().WriteError(exception.ToString()); + Log().LogInformation("Npgsql exception has occured in script: '{0}'", script.Name); + Log().LogError("Script block number: {0}; Block line {1}; Position: {2}; Message: {3}", index, exception.Line, exception.Position, exception.Message); + Log().LogError(exception.ToString()); throw; } } diff --git a/src/dbup-redshift/dbup-redshift.csproj b/src/dbup-redshift/dbup-redshift.csproj index 42c94b7..3d515ea 100644 --- a/src/dbup-redshift/dbup-redshift.csproj +++ b/src/dbup-redshift/dbup-redshift.csproj @@ -1,37 +1,31 @@  - - DbUp makes it easy to deploy and upgrade SQL Server databases. This package adds Amazon Redshift support. - DbUp Redshift Support - netstandard1.3;netstandard2.0;net35;net45 - dbup-redshift - DbUp.Redshift - ../dbup.snk - true - https://github.com/DbUp/dbup-redshift.git - dbup_redshift - dbup-redshift - dbup-icon.png - + + DbUp makes it easy to deploy and upgrade SQL Server databases. This package adds Amazon Redshift support. + DbUp Redshift Support + netstandard2.0 + dbup-redshift + DbUp.Redshift + ../dbup.snk + true + https://github.com/DbUp/dbup-redshift.git + dbup_redshift + dbup-redshift + dbup-icon.png + - - $(DefineConstants);NPGSQLv2 - - - - - - - - - - - - - - - - - + + true + true + embedded + + + + + + + + +