-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Closed
Bug
Copy link
Milestone
Description
Have entities with nullable DateTime inside called "UpdatedDate".
var defaultPolicy = new MatchingPolicy()
{
Id = Guid.Parse("5cf3f8e5-50e1-47c8-aa42-40b1824ea099"),
CompanyId = null,
Name = "PASA data Matching convention (DMC)",
Status = MatchingPolicyStatus.Draft,
Type = MatchingPolicyType.Default,
Description = "Bla bla.",
CreatedDate = new DateTime(2022, 8, 11, 11, 35, 8, 586, DateTimeKind.Utc).AddTicks(1258),
};
var defaultPolicyVersion = new MatchingPolicyVersion()
{
Id = Guid.Parse("5cf3f8e5-50e1-47c8-aa42-40b1824ea098"),
CreatedByUserName = "System",
MatchingPolicyId = defaultPolicy.Id,
ReviewerUserName = "System",
Status = MatchingPolicyApprovalStatus.Approved,
Version = 1,
CreatedDate = new DateTime(2022, 8, 11, 11, 35, 8, 586, DateTimeKind.Utc),
UpdatedDate = new DateTime(2022, 8, 11, 11, 35, 8, 586, DateTimeKind.Utc),
};
var defaultGroups = new[]
{
new MatchingPolicyGroup
{
Id = Guid.Parse("1e93b3f9-4ed8-4b90-a859-31b6503ec89f"),
MatchingPolicyVersionId = defaultPolicyVersion.Id,
Group = MatchingPolicyGroupType.Full,
CreatedDate = new DateTime(2022, 8, 11, 11, 35, 8, 586, DateTimeKind.Utc).AddTicks(1258),
},
new MatchingPolicyGroup
{
Id = Guid.Parse("b08f004f-a62d-409e-8025-337f0eb73054"),
MatchingPolicyVersionId = defaultPolicyVersion.Id,
Group = MatchingPolicyGroupType.Possible,
CreatedDate = new DateTime(2022, 8, 11, 11, 35, 8, 586, DateTimeKind.Utc).AddTicks(1258),
},And when I'm trying add data to db by using HasData, `
modelBuilder.Entity<MatchingPolicy>().HasData(defaultPolicy);
modelBuilder.Entity<MatchingPolicyVersion>().HasData(defaultPolicyVersion);
entity.HasData(defaultGroups);
modelBuilder.Entity<Scheme>().Property(u => u.MatchingPolicyId).HasDefaultValue(defaultPolicy.Id);`It always creates the same migration with updating "UpdatedDate" field, even if this migration exist
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace DashboardISP.DAL.PostgreSQL.Migrations
{
/// <inheritdoc />
public partial class TestMigration : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.UpdateData(
table: "matching_policies",
keyColumn: "id",
keyValue: new Guid("5cf3f8e5-50e1-47c8-aa42-40b1824ea099"),
column: "updated_date",
value: null);
migrationBuilder.UpdateData(
table: "matching_policy_groups",
keyColumn: "id",
keyValue: new Guid("1e93b3f9-4ed8-4b90-a859-31b6503ec89f"),
column: "updated_date",
value: null);
migrationBuilder.UpdateData(
table: "matching_policy_groups",
keyColumn: "id",
keyValue: new Guid("b08f004f-a62d-409e-8025-337f0eb73054"),
column: "updated_date",
value: null);
migrationBuilder.UpdateData(
table: "matching_policy_versions",
keyColumn: "id",
keyValue: new Guid("5cf3f8e5-50e1-47c8-aa42-40b1824ea098"),
column: "updated_date",
value: new DateTime(2022, 8, 11, 11, 35, 8, 586, DateTimeKind.Utc));
migrationBuilder.UpdateData(
table: "matching_rule_templates",
keyColumn: "id",
keyValue: new Guid("0da103bd-4753-4e01-bc3b-9dd1316861f9"),
column: "updated_date",
value: null);
migrationBuilder.UpdateData(
table: "matching_rule_templates",
keyColumn: "id",
keyValue: new Guid("2f95ee66-ce3d-4c37-9c76-d89cb5a6114c"),
column: "updated_date",
value: null);
migrationBuilder.UpdateData(
table: "matching_rule_templates",
keyColumn: "id",
keyValue: new Guid("3b0768e4-c774-4228-8aad-150f9a6aed1b"),
column: "updated_date",
value: null);
migrationBuilder.UpdateData(
table: "matching_rule_templates",
keyColumn: "id",
keyValue: new Guid("4542bf1e-219f-4e2e-83a1-5064c627c919"),
column: "updated_date",
value: null);
migrationBuilder.UpdateData(
table: "matching_rule_templates",
keyColumn: "id",
keyValue: new Guid("6811980f-9890-452f-a358-82678cfb34b4"),
column: "updated_date",
value: null);
migrationBuilder.UpdateData(
table: "matching_rule_templates",
keyColumn: "id",
keyValue: new Guid("6f77d0d9-0c2d-477c-9f0f-87b1e69bbda1"),
column: "updated_date",
value: null);
migrationBuilder.UpdateData(
table: "matching_rule_templates",
keyColumn: "id",
keyValue: new Guid("868feacb-f89f-4605-887b-ba068a1f05bc"),
column: "updated_date",
value: null);
migrationBuilder.UpdateData(
table: "matching_rule_templates",
keyColumn: "id",
keyValue: new Guid("93c1fbb6-6a86-4fdf-b298-3a32998045c4"),
column: "updated_date",
value: null);
migrationBuilder.UpdateData(
table: "matching_rule_templates",
keyColumn: "id",
keyValue: new Guid("9d00f543-07c8-4938-8d2e-7157720c7840"),
column: "updated_date",
value: null);
migrationBuilder.UpdateData(
table: "matching_rule_templates",
keyColumn: "id",
keyValue: new Guid("b3434fcc-aa01-4630-a620-7219515fb3b7"),
column: "updated_date",
value: null);
migrationBuilder.UpdateData(
table: "matching_rule_templates",
keyColumn: "id",
keyValue: new Guid("b97737f0-0237-4d95-b8cb-86c706cd9e33"),
column: "updated_date",
value: null);
migrationBuilder.UpdateData(
table: "matching_rule_templates",
keyColumn: "id",
keyValue: new Guid("ff64a9ed-314a-49ff-821a-085c491bd7c1"),
column: "updated_date",
value: null);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.UpdateData(
table: "matching_policies",
keyColumn: "id",
keyValue: new Guid("5cf3f8e5-50e1-47c8-aa42-40b1824ea099"),
column: "updated_date",
value: null);
migrationBuilder.UpdateData(
table: "matching_policy_groups",
keyColumn: "id",
keyValue: new Guid("1e93b3f9-4ed8-4b90-a859-31b6503ec89f"),
column: "updated_date",
value: null);
migrationBuilder.UpdateData(
table: "matching_policy_groups",
keyColumn: "id",
keyValue: new Guid("b08f004f-a62d-409e-8025-337f0eb73054"),
column: "updated_date",
value: null);
migrationBuilder.UpdateData(
table: "matching_policy_versions",
keyColumn: "id",
keyValue: new Guid("5cf3f8e5-50e1-47c8-aa42-40b1824ea098"),
column: "updated_date",
value: new DateTime(2022, 8, 11, 11, 35, 8, 586, DateTimeKind.Utc));
migrationBuilder.UpdateData(
table: "matching_rule_templates",
keyColumn: "id",
keyValue: new Guid("0da103bd-4753-4e01-bc3b-9dd1316861f9"),
column: "updated_date",
value: null);
migrationBuilder.UpdateData(
table: "matching_rule_templates",
keyColumn: "id",
keyValue: new Guid("2f95ee66-ce3d-4c37-9c76-d89cb5a6114c"),
column: "updated_date",
value: null);
migrationBuilder.UpdateData(
table: "matching_rule_templates",
keyColumn: "id",
keyValue: new Guid("3b0768e4-c774-4228-8aad-150f9a6aed1b"),
column: "updated_date",
value: null);
migrationBuilder.UpdateData(
table: "matching_rule_templates",
keyColumn: "id",
keyValue: new Guid("4542bf1e-219f-4e2e-83a1-5064c627c919"),
column: "updated_date",
value: null);
migrationBuilder.UpdateData(
table: "matching_rule_templates",
keyColumn: "id",
keyValue: new Guid("6811980f-9890-452f-a358-82678cfb34b4"),
column: "updated_date",
value: null);
migrationBuilder.UpdateData(
table: "matching_rule_templates",
keyColumn: "id",
keyValue: new Guid("6f77d0d9-0c2d-477c-9f0f-87b1e69bbda1"),
column: "updated_date",
value: null);
migrationBuilder.UpdateData(
table: "matching_rule_templates",
keyColumn: "id",
keyValue: new Guid("868feacb-f89f-4605-887b-ba068a1f05bc"),
column: "updated_date",
value: null);
migrationBuilder.UpdateData(
table: "matching_rule_templates",
keyColumn: "id",
keyValue: new Guid("93c1fbb6-6a86-4fdf-b298-3a32998045c4"),
column: "updated_date",
value: null);
migrationBuilder.UpdateData(
table: "matching_rule_templates",
keyColumn: "id",
keyValue: new Guid("9d00f543-07c8-4938-8d2e-7157720c7840"),
column: "updated_date",
value: null);
migrationBuilder.UpdateData(
table: "matching_rule_templates",
keyColumn: "id",
keyValue: new Guid("b3434fcc-aa01-4630-a620-7219515fb3b7"),
column: "updated_date",
value: null);
migrationBuilder.UpdateData(
table: "matching_rule_templates",
keyColumn: "id",
keyValue: new Guid("b97737f0-0237-4d95-b8cb-86c706cd9e33"),
column: "updated_date",
value: null);
migrationBuilder.UpdateData(
table: "matching_rule_templates",
keyColumn: "id",
keyValue: new Guid("ff64a9ed-314a-49ff-821a-085c491bd7c1"),
column: "updated_date",
value: null);
}
}
}szilardd