-
Notifications
You must be signed in to change notification settings - Fork 189
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
idempotent script can't be executed once a table has been dropped #200
Comments
I'm not able to reproduce this problem. I'm using the Oracle EF Core 5.21.3 provider with EF Core Tools 5.0.10. I see that the EXECUTE IMMEDIATE is being generated with the INSERT statement.
|
Hello, Thanks for your answer, It will be easier to explain the problem with an example: https://github.com/knalinne/OracleEfCoreTest If you look at the Migrations, in the Domain folder you find 4 migrations:
You'll also find in the root of the repository the generated idempotent script (idempotent-script.sql) As you can see, an EXECUTE IMMEDIATE is being generated for INSERT statements, but only when inserting in the migration table. For the data generated from the builder.HasData(...) method in the context configuration, the insert statements do not use an EXECUTE IMMEDIATE. Example:
If you try to execute the idempotent script several times, it will only works the first time, then you'll get the error:
|
Thanks! I've been able to reproduce the problem. I've filed bug 33360423 to have one of our EF Core engineers review it. |
Glad I could help. |
This bug has been fixed, which should make it into the next patch release, 21.4. |
Hello @alexkeh , After migrating to version 5.21.4, it seems the generated idempotent script is no longer valid. the script to create the Users table was :
after migrating to 5.21.4, the generated script is:
As you can see, "1, 1" has been added on the Id column, when executing the script I get the error: ORA-00907: missing right parenthesis. Any idea ? Thanks for your help |
Sorry, the fix didn't make it into 21.4 as I expected. We ended up using an earlier label for that release. The fix will be in either 21.4.1 or 21.5. I'm verifying which release. |
For Oracle EF Core 6, the fix is in 21.4.1 release. For Oracle EF Core 5, the fix is in the 21.5 release. |
Versions of tools
dotnet: 5.0.302
ef tools: 5.0.10
Oracle: 12C
Issue
We use the idempotent script to update our production database.
Since we dropped an old table, the script always raise errors because some "INSERT" won't compile as the table no longer exists.
In the generated idempotent script, we have a block like this:
it doesn't compile because the "TYPE" table no longer exists.
According to this issue: dotnet/efcore#12911, the idempotent script should generate "execute immediate ..." query in the idempotent script.
in the example below, it should be something like:
The text was updated successfully, but these errors were encountered: