You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In EF6 migrations, when changing a SMALLINT field to a Bool field, the code generated is :
AlterColumn("Firebird.I_T", "BOOLCOL", c => c.Boolean()) ->
ALTER TABLE "MYTABLE" ALTER COLUMN "BOOLCOL" TYPE SMALLINT CHECK("BOOLCOL" IN (0,1))
This is a invalid format, instead a "Bool" domain should be created
CEATE DOMAIN D_BOOL AS SMALLINT CHECK (VALUE in (0,1));
Then
ALTER TABLE "MYTABLE" ALTER COLUMN "BOOLCOL" TYPE D_BOOL
Also, when doing migrations, if a nullable / non nullable is included, we get :
AlterColumn("Firebird.I_T", "SYS", c => c.Boolean(nullable: false));
ALTER TABLE "I_T" ALTER COLUMN "SYS" TYPE SMALLINT NOT NULL CHECK("SYS" IN (0,1))
Which is not valid neither. Firebird does not support changing null to non null.
Instead it should be
UPDATE RDB$RELATION_FIELDS SET RDB$NULL_FLAG = NULL
WHERE RDB$FIELD_NAME = 'SYS' AND RDB$RELATION_NAME = 'I_T';
ALTER TABLE "I_T" ALTER COLUMN "SYS" TYPE D_BOOL;
The text was updated successfully, but these errors were encountered:
Submitted by: Ludovic C. (ludydoo)
Is related to DNET685
In EF6 migrations, when changing a SMALLINT field to a Bool field, the code generated is :
AlterColumn("Firebird.I_T", "BOOLCOL", c => c.Boolean()) ->
ALTER TABLE "MYTABLE" ALTER COLUMN "BOOLCOL" TYPE SMALLINT CHECK("BOOLCOL" IN (0,1))
This is a invalid format, instead a "Bool" domain should be created
CEATE DOMAIN D_BOOL AS SMALLINT CHECK (VALUE in (0,1));
Then
ALTER TABLE "MYTABLE" ALTER COLUMN "BOOLCOL" TYPE D_BOOL
Also, when doing migrations, if a nullable / non nullable is included, we get :
AlterColumn("Firebird.I_T", "SYS", c => c.Boolean(nullable: false));
ALTER TABLE "I_T" ALTER COLUMN "SYS" TYPE SMALLINT NOT NULL CHECK("SYS" IN (0,1))
Which is not valid neither. Firebird does not support changing null to non null.
Instead it should be
UPDATE RDB$RELATION_FIELDS SET RDB$NULL_FLAG = NULL
WHERE RDB$FIELD_NAME = 'SYS' AND RDB$RELATION_NAME = 'I_T';
ALTER TABLE "I_T" ALTER COLUMN "SYS" TYPE D_BOOL;
The text was updated successfully, but these errors were encountered: