迁移文件中的所有额外垃圾是怎么回事?

发布于 2024-11-09 18:13:48 字数 1510 浏览 4 评论 0原文

我今天开始测试 grails 数据库迁移插件。我与域进行了初始同步,然后基于运行 diff 命令创建了新的更改日志。这应该像重命名列并向该列(重新)分配索引一样简单。所以我希望看到以下内容……

changeSet(author: "gdboling (generated)", id: "1306242441630-1") {
    addColumn(tableName: "manuscript_review_reviewer") {
        column(name: "reviewer_id", type: "bigint") {
            constraints(nullable: "false")
        }
    }
}
changeSet(author: "gdboling (generated)", id: "1306242441630-2") {
    addPrimaryKey(columnNames: "manuscript_review_id, reviewer_id", constraintName: "manuscript_rePK", tableName: "manuscript_review_reviewer")
}
changeSet(author: "gdboling (generated)", id: "1306242441630-3") {
    dropPrimaryKey(tableName: "manuscript_review_reviewer")
}
changeSet(author: "gdboling (generated)", id: "1306242441630-4") {
    dropForeignKeyConstraint(baseTableName: "manuscript_review_reviewer", baseTableSchemaName: "manning_main_dev", constraintName: "FK9BEFBBB34863C659")
}
changeSet(author: "gdboling (generated)", id: "1306242441630-179") {
    addForeignKeyConstraint(baseColumnNames: "reviewer_id", baseTableName: "manuscript_review_reviewer", constraintName: "FK9BEFBBB3A28B41DF", deferrable: "false", initiallyDeferred: "false", referencedColumnNames: "id", referencedTableName: "user", referencesUniqueColumn: "false")
}
changeSet(author: "gdboling (generated)", id: "1306242441630-212") {
    dropColumn(columnName: "user_id", tableName: "manuscript_review_reviewer")
}

一切都很好。但是,我还看到很多与我的更改无关的 dropIndex 和 createIndex 块。有谁知道为什么会出现这种情况?

I started testing out the grails database-migration plugin today. I did an initial sync with the domain and then created a new changelog based on running the diff command. This should have been as simple as renaming a column and (re)assigning the index to that column. So I expect to see the following...

changeSet(author: "gdboling (generated)", id: "1306242441630-1") {
    addColumn(tableName: "manuscript_review_reviewer") {
        column(name: "reviewer_id", type: "bigint") {
            constraints(nullable: "false")
        }
    }
}
changeSet(author: "gdboling (generated)", id: "1306242441630-2") {
    addPrimaryKey(columnNames: "manuscript_review_id, reviewer_id", constraintName: "manuscript_rePK", tableName: "manuscript_review_reviewer")
}
changeSet(author: "gdboling (generated)", id: "1306242441630-3") {
    dropPrimaryKey(tableName: "manuscript_review_reviewer")
}
changeSet(author: "gdboling (generated)", id: "1306242441630-4") {
    dropForeignKeyConstraint(baseTableName: "manuscript_review_reviewer", baseTableSchemaName: "manning_main_dev", constraintName: "FK9BEFBBB34863C659")
}
changeSet(author: "gdboling (generated)", id: "1306242441630-179") {
    addForeignKeyConstraint(baseColumnNames: "reviewer_id", baseTableName: "manuscript_review_reviewer", constraintName: "FK9BEFBBB3A28B41DF", deferrable: "false", initiallyDeferred: "false", referencedColumnNames: "id", referencedTableName: "user", referencesUniqueColumn: "false")
}
changeSet(author: "gdboling (generated)", id: "1306242441630-212") {
    dropColumn(columnName: "user_id", tableName: "manuscript_review_reviewer")
}

All that is well and good. However, I'm also seeing a lot of dropIndex and createIndex blocks that have nothing to do with my change. Anyone know why this would be the case?

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

眼趣 2024-11-16 18:13:48

http://jira.grails.org/browse/GPDATABASEMIGRATION 上写一个问题,其中包含以下信息:重现(数据库供应商,最好是一些代码和您的数据库模式),我将看看可以做什么。最坏的情况是您需要将多个元素折叠为一个元素 - 这对于自动化来说是一件棘手的事情,通常需要一些人工干预。

Write up an issue at http://jira.grails.org/browse/GPDATABASEMIGRATION with information to reproduce (database vendor and ideally some code and your database schema) and I'll see what can be done. Worst-case scenario is you'll need to collapse multiple elements into one - this is tricky stuff to automate and usually some human intervention is required.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文