I want to add a new property to an object in my EF model. The property is called "Deleted" and should have default value "false". All previous entries in the database need to be assigned this default value. I am using automatic migration, so changing the Up and Drop functions in the migration is not possible (that i know of, at least).
I have tried to just create the new property in the group class, but when the SQL code is ran (ALTER TABLE "dbo"."Group" ADD "Deleted" boolean NOT NULL
) in psql, I get the error
ERROR: column "Deleted" contains null-values
.
Note that I cannot intercept this call and insert constraints in the SQL command, it is called in the automatic migration. I have looked at this solution but as i am not using manual migration, I never have the chance to edit the Migration file. Any tips is greatly appreachiated! I have looked for many solutions, including using custom migration SQL generators, but none of it worked. The problem seems to be that all of the already existing entries in the database table get assigned null
as the value for "Deleted".