2

我今天开始测试 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 块。有谁知道为什么会这样?

4

1 回答 1

1

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

于 2011-05-24T18:39:12.510 回答