Изменения
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ using Pf2eModel.Model.Enum;
|
||||
namespace Pf2eModel.Migrations
|
||||
{
|
||||
[DbContext(typeof(Pf2eDbContext))]
|
||||
[Migration("20250514102154_1")]
|
||||
[Migration("20250514120355_1")]
|
||||
partial class _1
|
||||
{
|
||||
/// <inheritdoc />
|
||||
@@ -104,5 +104,5 @@ public class Entity
|
||||
/// <summary>
|
||||
/// Коллекция устаревших сущностей.
|
||||
/// </summary>
|
||||
public IEnumerable<LegacyEntity> LegacyEntities { get; set; } = [];
|
||||
public ICollection<LegacyEntity> LegacyEntities { get; set; } = [];
|
||||
}
|
||||
|
||||
@@ -136,6 +136,7 @@ public partial class Pf2eDbContext : DbContext
|
||||
|
||||
// optionsBuilder.LogTo(Console.WriteLine);
|
||||
optionsBuilder.UseSnakeCaseNamingConvention();
|
||||
|
||||
optionsBuilder.EnableSensitiveDataLogging();
|
||||
optionsBuilder.UseNpgsql(
|
||||
databaseConnection,
|
||||
|
||||
Reference in New Issue
Block a user