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
I changed a column's type during development of a new application. Here's the line that was generated by migrations when I changed the data type on a property from int to long, neither of which were nullable:
ALTER TABLE "Booklets" ALTER COLUMN "File_Size" TYPE BIGINT NOT NULL
;
Apparently, it added the NOT NULL as part of the column definition, when the column was already NOT NULL. The problem is that Firebird doesn't allow changing from NULL to NOT NULL in the ALTER COLUMN clause, so the syntax was considered wrong and an exception was thrown.
(As an aside, the generated script from EF's Update-Database -Script command doesn't work when I try to read it into iSql using the IN command on the prompt, so I can't even change it and read it in that way. I'll have to apply the changes by hand until this is fixed.)
The text was updated successfully, but these errors were encountered:
I just realized that I never changed the null constraint at all in my code, just the type. But apparently the null constraint is considered a part of the type definition in EF, so it considered the type change to be from INT NOT NULL to BIGINT NOT NULL and created the statement accordingly.
description: I changed a column's type and null constraint during development of a new application. I found out later that Firebird doesn't support that through the ALTER TABLE ALTER COLUMN syntax, and that other options are available here: http://www.firebirdfaq.org/faq103/
Here's the line that was generated by migrations when I changed the data type on a property from Nullable<int> to long:
ALTER TABLE "Booklets" ALTER COLUMN "File_Size" TYPE BIGINT NOT NULL
;
Apparently, according to that page, all admin tools change the value on the system table. Maybe we should do that here too.
=>
I changed a column's type during development of a new application. Here's the line that was generated by migrations when I changed the data type on a property from int to long, neither of which were nullable:
ALTER TABLE "Booklets" ALTER COLUMN "File_Size" TYPE BIGINT NOT NULL
;
Apparently, it added the NOT NULL as part of the column definition, when the column was already NOT NULL. The problem is that Firebird doesn't allow changing from NULL to NOT NULL in the ALTER COLUMN clause, so the syntax was considered wrong and an exception was thrown.
(As an aside, the generated script from EF's Update-Database -Script command doesn't work when I try to read it into iSql using the IN command on the prompt, so I can't even change it and read it in that way. I'll have to apply the changes by hand until this is fixed.)
summary: Invalid SQL generated for migration if changing a column from null to not null => Invalid SQL generated for migration if changing a column type
Submitted by: Charles J Christie II (sonicbhoc)
I changed a column's type during development of a new application. Here's the line that was generated by migrations when I changed the data type on a property from int to long, neither of which were nullable:
ALTER TABLE "Booklets" ALTER COLUMN "File_Size" TYPE BIGINT NOT NULL
;
Apparently, it added the NOT NULL as part of the column definition, when the column was already NOT NULL. The problem is that Firebird doesn't allow changing from NULL to NOT NULL in the ALTER COLUMN clause, so the syntax was considered wrong and an exception was thrown.
(As an aside, the generated script from EF's Update-Database -Script command doesn't work when I try to read it into iSql using the IN command on the prompt, so I can't even change it and read it in that way. I'll have to apply the changes by hand until this is fixed.)
The text was updated successfully, but these errors were encountered: