Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AlterTable invalid SQL [DNET661] #618

Closed
firebird-automations opened this issue Dec 29, 2015 · 6 comments
Closed

AlterTable invalid SQL [DNET661] #618

firebird-automations opened this issue Dec 29, 2015 · 6 comments

Comments

@firebird-automations
Copy link

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;

@firebird-automations
Copy link
Author

Modified by: @cincuranet

status: Open [ 1 ] => In Progress [ 3 ]

@firebird-automations
Copy link
Author

Commented by: @cincuranet

Why do you think the should be a `D_BOOL` domain created/used by default?

@firebird-automations
Copy link
Author

Modified by: @cincuranet

Link: This issue block progress on DNET685 [ DNET685 ]

@firebird-automations
Copy link
Author

Modified by: @cincuranet

Link: This issue block progress on DNET685 [ DNET685 ] =>

@firebird-automations
Copy link
Author

Modified by: @cincuranet

Link: This issue is related to DNET685 [ DNET685 ]

@firebird-automations
Copy link
Author

Modified by: @cincuranet

status: In Progress [ 3 ] => Closed [ 6 ]

resolution: Won't Fix [ 2 ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants