迁移文件中所有额外的垃圾是啥?
Posted
技术标签:
【中文标题】迁移文件中所有额外的垃圾是啥?【英文标题】:What is with all the extra junk in the migration file?迁移文件中所有额外的垃圾是什么? 【发布时间】:2011-09-01 02:17:06 【问题描述】:我今天开始测试 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】:在http://jira.grails.org/browse/GPDATABASEMIGRATION 上写一个问题,提供要重现的信息(数据库供应商,最好是一些代码和您的数据库架构),我会看看可以做什么。最坏的情况是您需要将多个元素合并为一个 - 这是自动化的棘手工作,通常需要一些人工干预。
【讨论】:
以上是关于迁移文件中所有额外的垃圾是啥?的主要内容,如果未能解决你的问题,请参考以下文章