Description
openedon Jan 19, 2018
Hello,
I have a project with multiple migrations.
One of the migration have multiple procedures like this :
private static string SCRIPT_TableUserSynchronizationRepository_GetFirstPendingUserSynchronizations = @"CREATE PROCEDURE procedure_GetFirstPendingUserSynchronizations [...] END";
When i execute the command line "dotnet ef migrations script" everything work fine !
But when i execute the code generated by the command "dotnet ef migrations script --idempotent" i have several errors !
EF generate this kind of code :
IF NOT EXISTS(SELECT * FROM [__EFMigrationsHistory] WHERE [MigrationId] = N'20171124083142_addStoredProcedures') BEGIN CREATE PROCEDURE procedure_GetFirstPendingUserSynchronizations [...] END END; GO
And the error is "Incorrect syntax near the keyword 'Procedure'".
I have found a workaround by putting the "CREATE PROCEDURE" in "EXE(' [...]').
https://stackoverflow.com/questions/16729520/incorrect-syntax-near-the-keyword-procedure.
I use SQL Server 2016 (localdb)
Is it an EF Core bug ?