Closed ChrisK91 closed 1 year ago
Could you try to script the migration: http://ef.readthedocs.org/en/latest/cli/powershell.html#script-migration
This generates the following SQL:
ALTER TABLE [FileInfo] ADD [Quality] int NOT NULL DEFAULT 0;
GO
INSERT INTO [__EFMigrationsHistory] ([MigrationId], [ProductVersion])
VALUES ('20160213114504_Migration02', '7.0.0-rc1-16348');
GO
In the first query, omitting the semicolon (NOT NULL DEFAULT 0
;), creates a valid query which I can rund using e.g. LINQPad. It seems, that SqlCe doesnt like that semicolon.
The original SQL
ALTER TABLE [FileInfo] ADD [Quality] int NOT NULL DEFAULT 0;
parses fine in the SQL Compact Toolbox editor...
So maybe the issue with the semicolon is LinQPad related In other words, could you try to run the generated script against a test dabase file in the "SQL Server Compact Toolbox" extinsion?
I've now installed the Toolbox as well... And indeed, it works if I run the query from within the toolbox window. However the Update-Database still results in said error. I wonder if these different tools use different versions of SqlCe...
No, they all use the same version - I will try to investigate! Maybe the script generation is different from Update-Database...
Thanks for reporting this bug, it is fixed in the latest source, and the fix will be included in RC2 https://github.com/ErikEJ/EntityFramework.SqlServerCompact/pull/308
Awesome, thank you for your help :+1:
Update-Database results in error after second migration
After adding a second migration file via
Add-Migration
, theUpdate-Database
results in anThere was an error parsing the query. [ Token line number = 1,Token line offset = 2,Token in error = ; ]
using SqlServerCeFunctional impact
Makes manual updates to database file necessary
Minimal repro steps
Install-Package EntityFramework.MicrosoftSqlServer –Pre
Install-Package EntityFramework.Commands –Pre
Install-Package EntityFramework.SqlServerCompact40 –Pre
Add a minimal default database
Add-Migration Migration01
Update-Database
FileInfo
to contain anotherint
-ColumnAdd-Migration Migration02
Update-Database
Expected result
The Migration should be applied succesfully
Actual result
The Migration fails with
There was an error parsing the query. [ Token line number = 1,Token line offset = 2,Token in error = ; ]