Изменения

This commit is contained in:
2025-05-15 01:37:27 +04:00
parent 995029ce8d
commit 2b61669e7a
36 changed files with 200 additions and 360 deletions
+2 -2
View File
@@ -69,7 +69,7 @@ public static class EfCleanHelper
public static string Truncate<T>(this DbSet<T> dbSet)
where T : class
{
string cmd = $"TRUNCATE TABLE {TableName(dbSet)} CASCADE;";
string cmd = $"TRUNCATE TABLE {TableName(dbSet)} RESTART IDENTITY CASCADE;";
DbContext context = dbSet.GetService<ICurrentDbContext>().Context;
context.Database.ExecuteSqlRaw(cmd);
return cmd;
@@ -87,7 +87,7 @@ public static class EfCleanHelper
foreach (IEntityType entityType in tables)
{
string cmd = $"TRUNCATE TABLE {GetName(entityType)} CASCADE;";
string cmd = $"TRUNCATE TABLE {GetName(entityType)} RESTART IDENTITY CASCADE;";
context.Database.ExecuteSqlRaw(cmd);
cmdList.Add(cmd);
}
@@ -13,7 +13,7 @@ using Pf2eModel.Model.Enum;
namespace Pf2eModel.Migrations
{
[DbContext(typeof(Pf2eDbContext))]
[Migration("20250514102154_1")]
[Migration("20250514120355_1")]
partial class _1
{
/// <inheritdoc />
+1 -1
View File
@@ -104,5 +104,5 @@ public class Entity
/// <summary>
/// Коллекция устаревших сущностей.
/// </summary>
public IEnumerable<LegacyEntity> LegacyEntities { get; set; } = [];
public ICollection<LegacyEntity> LegacyEntities { get; set; } = [];
}
+1
View File
@@ -136,6 +136,7 @@ public partial class Pf2eDbContext : DbContext
// optionsBuilder.LogTo(Console.WriteLine);
optionsBuilder.UseSnakeCaseNamingConvention();
optionsBuilder.EnableSensitiveDataLogging();
optionsBuilder.UseNpgsql(
databaseConnection,