We were using .Net Core 1 and we migrated to Preview 2 (both with Entity).
Before migration, we used to set a default value for a boolean in Entity Framework like this:
modelBuilder.Entity<Customer>()
.ToTable("Customer")
.Property(a => a.Active)
.HasDefaultValue(true);
After migration, we didn't change anything but now we are getting an error when entity tries to create this table. It looks like it is trying to create a default value as string like "True" and not as a bit, like before.
Does anyone knows what have changed?
ERROR on update-database
The 'bool' property 'Active' on entity type 'Customer' is configured with a database-generated default. This default will always be used when the property has the value 'false', since this is the CLR default for the 'bool' type. Consider using the nullable 'bool?' type instead so that the default will only be used when the property value is 'null'.
Script generated:
CREATE TABLE `Customer` (
`Id` int NOT NULL,
`Active` bit NOT NULL DEFAULT 'True'
)