Page 1 of 1

bug: updating schema with BIT NOT NULL columns

Posted: Mon 27 Feb 2012 16:46
by mindplay
With the latest release, it appears the Update Database Wizard now sees every BIT NOT NULL column as changed, every time - generating redundant updates like these:

Code: Select all

ALTER TABLE dbo.Role
   ALTER COLUMN IsExternal BIT NOT NULL
I'm several hundred similar statements when I run the update wizard - all of these columns are BIT and NOT NULL already, and it appears every BIT NOT NULL column in the schema is causing this statement...

Posted: Sat 03 Mar 2012 12:43
by Shalex
We cannot reproduce the problem with Entity Developer v 4.2.138 using the following table:

Code: Select all

create table bitnotnull(
Id int primary key,
IsExternal BIT NOT NULL
);
If upgrade to 4.2.138 doesn't help, please post here the DDL script of the table for reproducing the issue.

Posted: Mon 05 Mar 2012 13:57
by mindplay
It looks like it's the default value causing this problem, not the column-type.

Try setting your Column Default Value to 0 or 1 - when reviewing the change actions in the Update to Database Wizard, I now see a description like this:

Code: Select all

DefaultValue(old="0", new='0') was changed.
Looks like a problem with single vs double quotes?

Posted: Mon 05 Mar 2012 14:02
by mindplay
Actually, forget that - it looks like the default value isn't generated at all:

Code: Select all

ALTER TABLE dbo.Contact
   ALTER COLUMN Active BIT NOT NULL
GO
It looks like the default value is only generated by the Create Schema Wizard - the Update Schema Wizard does not output default values at all.