DropIndex Ommits架构在通过EntityFramework CodeFirst生成迁移脚本时

发布于 2025-02-03 18:51:27 字数 902 浏览 4 评论 0原文

通过命令行,脚本迁移或dotnet ef迁移脚本,我从现有迁移文件中生成迁移脚本有问题。

迁移文件包含以下内容:

migrationBuilder.DropIndex(
    name: "IX_CAR_CAR_ID",
    schema: "AUTO",
    table: "CARS",
    column: "CAR_ID");

生成的SQL脚本包含在数据库更新过程中失败的SQL。

应在drop索引命令中包含架构:drop索引“ auto”。

预期结果

sql脚本 在drop索引命令中不包含架构:drop索引“ ix_car_car_id”


我已经通过手动修改迁移文件修改了该架构,因此,而不是MigrationBuilder.DropIndex,I使用

migration> migration> migrationbuilder.sql(” drop index \“ auto \”。\ \“ ix_car_car_id \”)。

好吧,这为我解决了问题,但我想没有删除原因。

我尝试使用MSSQL Server相同,结果是有效的:

drop index [ix_car_car_id]在[auto]上。[cars];> 因此,我认为这可能是仅相关的问题。

使用:

Microsoft.EntityFrameWorkCore版本5.0.17

Oracle.EntityFrameWorkCore版本5.21.61

我的问题:任何人知道这是否可能是Oracle或EntityFramework软件包之一中的错误?

I have a problem with generating migration script from existing migration files, via command line, either Script-Migration or dotnet ef migrations script.

The migration file contains the following:

migrationBuilder.DropIndex(
    name: "IX_CAR_CAR_ID",
    schema: "AUTO",
    table: "CARS",
    column: "CAR_ID");

The generated SQL script contains SQL that fails during database update.

Expected result:

SQL script should contain schema in the drop index command: DROP INDEX "AUTO"."IX_CAR_CAR_ID"

Actual result:

SQL script does not contain schema in the drop index command: DROP INDEX "IX_CAR_CAR_ID"


I have fixed that by manual modification of the migration file, so instead of migrationBuilder.DropIndex, I use

migrationBuilder.Sql("DROP INDEX \"AUTO\".\"IX_CAR_CAR_ID\"").

Well, that solves the problem for me, but does not remove the cause, I suppose.

I have tried the same with MsSQL server and the result is valid:

DROP INDEX [IX_CAR_CAR_ID] ON [AUTO].[CARS];
so, I assume it might be Oracle only related issue.

Using:

Microsoft.EntityFrameworkCore version 5.0.17

Oracle.EntityFrameworkCore version 5.21.61

My question: does anybony know whether this could be a bug in one of the Oracle or EntityFramework packages?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文