title: EF Core 2.2 New Migrations keep deleting and recreating seeded data
body: <p>Whenever I create a new Migration, for some reason my seeded data is always deleted and recreated. How can I prevent this from happening? </p>
  
  <p>It seemed to be a bug in EF Core 2.1 but was supposedly fixed in 2.2 but that issue is still here.</p>
  
  <p>This is my OnModelCreating:</p>
  
  <pre><code>protected override void OnModelCreating(ModelBuilder modelBuilder)
  {
      base.OnModelCreating(modelBuilder);
      Application application = new Application
      {
          Id = Guid.NewGuid().ToString(),
          Name = "APPONE",
          Description = "APPONE",
          TagColor = "#fb3640",
          IsActive = true,
          CreatedOn = DateTime.Now,
          UpdatedOn = DateTime.Now
      };
  
      User user = new User
      {
          Id = "223862af-978e-41a9-90ca-fda4b0f49c77",
          UserName = "system@managementstudio.com",
          NormalizedUserName = "SYSTEM@MANAGEMENTSTUDIO.COM",
          Email = "system@managementstudio.com",
          NormalizedEmail = "SYSTEM@MANAGEMENTSTUDIO.COM",
          SecurityStamp = "42032b8b-4581-46cf-8c56-a53e155176a3",
          PhoneNumber = "1234567890",
          FirstName = "System",
          LastName = "Administrator",
          ConcurrencyStamp = "8a75b8eb-01e6-4aff-b59b-849ad93cd28e",
          CreatedOn = Convert.ToDateTime("2020-04-16 19:22:09.546094"),
          UpdatedOn = Convert.ToDateTime("2020-04-16 19:22:09.546094"),
          PasswordHash = "AQAAAAEAACcQAAAAEATcP3mZf4Ok1uuUwpnG4v6ES3XJ4VsyiM3G9hhKgZNwen4Z3ke5DEIvK1acSJOhDQ==",
      };
  
      UserPasswordPolicy upp = new UserPasswordPolicy
      {
          Id = Guid.NewGuid().ToString(),
          IsPolicyActivated = false,
          RetentionDays = 0,
          TenantId = null,
          UserId = user.Id,
          CreatedOn = DateTime.Now,
      };
  
      Role role = new Role
      {
          Id = "d5e3f676-e489-479d-b739-8ea9a8483496",
          Name = "SystemAdministrator",
          NormalizedName = "SYSTEMADMINISTRATOR",
          ApplicationId = application.Id,
          Order = 1,
          ConcurrencyStamp = "ba953d0b-89dc-4550-9962-c9ba08a3980e",
      };
  
      Role role2 = new Role
      {
          Id = "225c067c-c703-419e-9fc9-8186ded506f8",
          Name = "Administrator",
          NormalizedName = "ADMINISTRATOR",
          ApplicationId = application.Id,
          Order = 2,
          ConcurrencyStamp = "a09ab67f-02d6-4910-8659-3385759d8036",
      };
  
      UserRole userRole = new UserRole
      {
          RoleId = role.Id,
          UserId = user.Id
      };
  
      SystemAdministrator systemAdministrator = new SystemAdministrator
      {
          Id = Guid.NewGuid().ToString(),
          UserId = user.Id,
          CreatedOn = DateTime.Now
      };
  
      //https://www.learnentityframeworkcore.com/migrations/seeding
      PasswordHasher&lt;User&gt; passwordHasher = new PasswordHasher&lt;User&gt;();
      user.PasswordHash = passwordHasher.HashPassword(user, "P@ssw0rd");
  
      modelBuilder.Entity&lt;Application&gt;().HasData(application);
      modelBuilder.Entity&lt;User&gt;().HasData(user);
      var rolesTable = modelBuilder.Entity&lt;Role&gt;().ToTable("Roles");
      var userRolesTable = modelBuilder.Entity&lt;UserRole&gt;().ToTable("UserRoles");
      var userClaimsTable = modelBuilder.Entity&lt;IdentityUserClaim&lt;string&gt;&gt;().ToTable("UserClaims");
      var usersTable = modelBuilder.Entity&lt;User&gt;().ToTable("Users");
  
      modelBuilder.Entity&lt;Role&gt;(builder =&gt;
      {
          builder.Metadata.RemoveIndex(new[] { builder.Property(u =&gt; u.NormalizedName).Metadata });
      });
      modelBuilder.Entity&lt;User&gt;(builder =&gt;
      {
          builder.Metadata.RemoveIndex(new[] { builder.Property(u =&gt; u.NormalizedUserName).Metadata });
      });
      modelBuilder.Entity&lt;User&gt;(builder =&gt;
      {
          builder.Metadata.RemoveIndex(new[] { builder.Property(u =&gt; u.UserName).Metadata });
      });
      modelBuilder.Entity&lt;User&gt;(b =&gt;
          b.HasIndex("NormalizedUserName", "TenantId").HasName("UserNameIndex").IsUnique());
  
      modelBuilder.Entity&lt;Role&gt;().HasData(role);
      modelBuilder.Entity&lt;Role&gt;().HasData(role2);
      modelBuilder.Entity&lt;UserRole&gt;().HasData(userRole);
      modelBuilder.Entity&lt;UserPasswordPolicy&gt;().HasData(upp);
      modelBuilder.Entity&lt;SystemAdministrator&gt;().HasData(systemAdministrator);
  
  }
  </code></pre>
  
  <p>EDIT:</p>
  
  <p>I updated my seed but my migrations still shows an update in the password hash for some reason:</p>
  
  <pre><code>protected override void Up(MigrationBuilder migrationBuilder)
          {
              migrationBuilder.UpdateData(
                  table: "UserPasswordPolicy",
                  keyColumn: "Id",
                  keyValue: "845c4aff-ed80-45c3-a5c3-7dba838e575b",
                  column: "UpdatedOn",
                  value: new DateTime(2020, 4, 21, 7, 9, 46, 923, DateTimeKind.Local).AddTicks(6432));
  
              migrationBuilder.UpdateData(
                  table: "Users",
                  keyColumn: "Id",
                  keyValue: "223862af-978e-41a9-90ca-fda4b0f49c77",
                  column: "PasswordHash",
                  value: "AQAAAAEAACcQAAAAEATcP3mZf4Ok1uuUwpnG4v6ES3XJ4VsyiM3G9hhKgZNwen4Z3ke5DEIvK1acSJOhDQ==");
          }
  </code></pre>