I've changed 2 columns type by specifying the attribute
[Column(TypeName = "date")]
on the properties:
public DateTime LastModified { get; set; } = DateTime.Now;
public DateTime OriginalCreated { get; set; } = DateTime.Now;
When I run the application (MVC) I get an error:
Additional information: The object 'DF__StoryMode__Origi__25869641' is dependent on column 'OriginalCreated'.
ALTER TABLE ALTER COLUMN OriginalCreated failed because one or more objects access this column.
I followed this answer and dropped the two constraints, but they have been recreated again.
I tried to use new database by changing the Initial Catalog
in the web.config
file and still getting the same error!
EDIT
Solution: I set the two properties to have default values, thus EF create Default constraints for them in the database, and that is why the constraints are recreating themselves every time I run the application, EF creates them. So I commented out that portion and updated the database with the new data type, and it works