Мелкие правки: удаление комментариев, переименование файлов и т.д.

This commit is contained in:
Оля Бизюкова 2025-01-28 12:30:58 +05:00
parent afd1e733f5
commit c2de8a0cc2
3 changed files with 7 additions and 13 deletions

View File

@ -6,7 +6,7 @@
}
},
"ConnectionStrings": {
"DefaultConnection": "Host=localhost:5462;Database=persistence;Username=postgres;Password=postgres;Persist Security Info=True"
"DefaultConnection": "Host=localhost;Database=persistence;Username=postgres;Password=postgres;Persist Security Info=True"
},
"AllowedHosts": "*",
"NeedUseKeyCloak": false,

View File

@ -5,19 +5,19 @@ using Npgsql;
namespace DD.Persistence.Database.Postgres.Test;
public class UnitTest1 : IClassFixture<DbFixture>
public class UnitTestCheckHyperTables : IClassFixture<DbFixture>
{
private ServiceProvider _serviceProvider;
private string _connectionString;
public UnitTest1(DbFixture fixture)
public UnitTestCheckHyperTables(DbFixture fixture)
{
_serviceProvider = fixture.serviceProvider;
_connectionString = fixture.connectionString;
}
[Fact]
public void CreateHyperTable()
public void CreateHyperTable_For_ParameterData_Return_Success()
{
var entity = new ParameterData()
{

View File

@ -25,6 +25,7 @@ public static class EFExtensionsPartitioning
/// <param name="db"></param>
private static void AddParameterDataPartitioning(this DatabaseFacade db)
{
var dayCount = 1;
var type = typeof(ParameterData);
var tableAttribute = type.GetCustomAttribute<TableAttribute>();
if (tableAttribute is null)
@ -33,17 +34,10 @@ public static class EFExtensionsPartitioning
}
var sqlCreateHypertableString = $"SELECT create_hypertable('{tableAttribute.Name}'," +
$"by_range('{nameof(ParameterData.Timestamp)}', INTERVAL '1 day'), if_not_exists => {true});";
$"by_range('{nameof(ParameterData.Timestamp)}', INTERVAL '{dayCount} day'), if_not_exists => {true});";
db.ExecuteSqlRaw(sqlCreateHypertableString);
var sqlCreateDimensionString = $"SELECT add_dimension('{tableAttribute.Name}'," +
$"by_hash('{nameof(ParameterData.ParameterId)}', 1));";
db.ExecuteSqlRaw(sqlCreateDimensionString);
//var sqlString = $"SELECT create_hypertable('{tableAttribute.Name}'," +
// $"'{nameof(ParameterData.Timestamp)}'," +
// $"'{nameof(ParameterData.ParameterId)}'," +
// $"{sectionsNumber}," +
// $"chunk_time_interval => INTERVAL '{chunkTimeInterval} day');";
//db.ExecuteSqlRaw(sqlString);
$"by_hash('{nameof(ParameterData.ParameterId)}', {dayCount}));";
}
}