2011-05-24 43 views
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塊與我的更改無關。任何人都知道爲什麼會這樣?

回答

1

http://jira.grails.org/browse/GPDATABASEMIGRATION上寫下一個問題,提供重現信息(數據庫供應商以及理想情況下的一些代碼和數據庫模式),然後我會看看可以做些什麼。最糟糕的情況是您需要將多個元素合併爲一個 - 這是棘手的問題,需要自動執行,通常需要人爲干預。

相關問題