From 02d1c5a454bed4d2ea185313e48bad8f0578dc6f Mon Sep 17 00:00:00 2001 From: stidsborg Date: Fri, 20 Sep 2024 12:36:28 +0200 Subject: [PATCH] Removed unused DropUnderlyingTable methods from Postgres stores --- .../UtilTests/RegisterTests.cs | 1 - .../PostgreSqlMessageStore.cs | 11 +---------- .../PostgreSqlTimeoutStore.cs | 9 --------- .../PostgresSqlUnderlyingRegister.cs | 11 ----------- 4 files changed, 1 insertion(+), 31 deletions(-) diff --git a/Stores/PostgreSQL/Cleipnir.ResilientFunctions.PostgreSQL.Tests/UtilTests/RegisterTests.cs b/Stores/PostgreSQL/Cleipnir.ResilientFunctions.PostgreSQL.Tests/UtilTests/RegisterTests.cs index b19d8a68..a5e25453 100644 --- a/Stores/PostgreSQL/Cleipnir.ResilientFunctions.PostgreSQL.Tests/UtilTests/RegisterTests.cs +++ b/Stores/PostgreSQL/Cleipnir.ResilientFunctions.PostgreSQL.Tests/UtilTests/RegisterTests.cs @@ -59,7 +59,6 @@ public override Task DeleteFailsWhenNonExpectedValueForExistingRegister() private async Task CreateAndInitializeRegister([CallerMemberName] string memberName = "") { var underlyingRegister = new PostgresSqlUnderlyingRegister(Sql.ConnectionString, tablePrefix: memberName); - await underlyingRegister.DropUnderlyingTable(); await underlyingRegister.Initialize(); return new Register(underlyingRegister); } diff --git a/Stores/PostgreSQL/Cleipnir.ResilientFunctions.PostgreSQL/PostgreSqlMessageStore.cs b/Stores/PostgreSQL/Cleipnir.ResilientFunctions.PostgreSQL/PostgreSqlMessageStore.cs index 93dd12e0..40e3f777 100644 --- a/Stores/PostgreSQL/Cleipnir.ResilientFunctions.PostgreSQL/PostgreSqlMessageStore.cs +++ b/Stores/PostgreSQL/Cleipnir.ResilientFunctions.PostgreSQL/PostgreSqlMessageStore.cs @@ -37,16 +37,7 @@ PRIMARY KEY (type, instance, position) var command = new NpgsqlCommand(_initializeSql, conn); await command.ExecuteNonQueryAsync(); } - - private string? _dropUnderlyingTableSql; - public async Task DropUnderlyingTable() - { - await using var conn = await CreateConnection(); - _dropUnderlyingTableSql ??= $"DROP TABLE IF EXISTS {_tablePrefix}_messages;"; - var command = new NpgsqlCommand(_dropUnderlyingTableSql, conn); - await command.ExecuteNonQueryAsync(); - } - + private string? _truncateTableSql; public async Task TruncateTable() { diff --git a/Stores/PostgreSQL/Cleipnir.ResilientFunctions.PostgreSQL/PostgreSqlTimeoutStore.cs b/Stores/PostgreSQL/Cleipnir.ResilientFunctions.PostgreSQL/PostgreSqlTimeoutStore.cs index dbb3d590..acd0292e 100644 --- a/Stores/PostgreSQL/Cleipnir.ResilientFunctions.PostgreSQL/PostgreSqlTimeoutStore.cs +++ b/Stores/PostgreSQL/Cleipnir.ResilientFunctions.PostgreSQL/PostgreSqlTimeoutStore.cs @@ -188,13 +188,4 @@ public async Task> GetTimeouts(FlowId flowId) return storedMessages; } - - private string? _dropUnderlyingTableSql; - public async Task DropUnderlyingTable() - { - await using var conn = await CreateConnection(); - _dropUnderlyingTableSql ??= $"DROP TABLE IF EXISTS {_tablePrefix}_timeouts;"; - var command = new NpgsqlCommand(_dropUnderlyingTableSql, conn); - await command.ExecuteNonQueryAsync(); - } } \ No newline at end of file diff --git a/Stores/PostgreSQL/Cleipnir.ResilientFunctions.PostgreSQL/PostgresSqlUnderlyingRegister.cs b/Stores/PostgreSQL/Cleipnir.ResilientFunctions.PostgreSQL/PostgresSqlUnderlyingRegister.cs index 6907e3cf..97146e91 100644 --- a/Stores/PostgreSQL/Cleipnir.ResilientFunctions.PostgreSQL/PostgresSqlUnderlyingRegister.cs +++ b/Stores/PostgreSQL/Cleipnir.ResilientFunctions.PostgreSQL/PostgresSqlUnderlyingRegister.cs @@ -23,17 +23,6 @@ PRIMARY KEY (registertype, groupname, name) await command.ExecuteNonQueryAsync(); } - private string? _dropUnderlyingTableSql; - public async Task DropUnderlyingTable() - { - await using var conn = new NpgsqlConnection(connectionString); - await conn.OpenAsync(); - - _dropUnderlyingTableSql ??= $"DROP TABLE IF EXISTS {tablePrefix}_register"; - await using var command = new NpgsqlCommand(_dropUnderlyingTableSql, conn); - await command.ExecuteNonQueryAsync(); - } - private string? _setIfEmptySql; public async Task SetIfEmpty(RegisterType registerType, string group, string name, string value) {