0
如何爲Grails數據庫遷移插件編寫changelog.groovy插件,該插件將行插入表中,如果某行尚不存在一定範圍的ID?例如。grails數據庫遷移插件 - 如何有條件地插入行
cool_stuff table has id | some_other_id |
cool_stuff表中填充了數據。給定一個範圍cool_stuff的ID,1 - 2000年,我想:
- 遍歷相應的ID,查詢cool_stuff表,看是否cool_stuff ID和組合some_other_id = 2存在
- 如果它不「噸存在,插入一行與cool_stuff ID和some_other_id = 2
這可以在changelog.xml而不是changelog.groovy中完成嗎? – ddelponte