迁移文件中的所有额外垃圾是什么?

时间:2011-05-24 16:18:07

标签: grails database-migration liquibase

我今天开始测试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块。任何人都知道为什么会这样吗?

1 个答案:

答案 0 :(得分:1)

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