【发布时间】:2016-08-03 06:13:48
【问题描述】:
我如何为 grails 数据库迁移插件编写一个 changelog.groovy,如果某个 id 范围内的行不存在,它将向表中插入行?例如。
cool_stuff 表有 编号 | 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 中完成吗?
标签: grails database-migration liquibase