Liquibase-常见列? [英] Liquibase - common columns?

查看:67
本文介绍了Liquibase-常见列?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的数据库中,每个表都有4个公共列-DATE_CREATEDUSER_CREATEDDATE_MODIFIEDUSER_MODIFIED,我想将此规则隐式传播到所有新表.

In my db every table has 4 common columns - DATE_CREATED, USER_CREATED, DATE_MODIFIED, USER_MODIFIED, and I want to propagate this rule to all new tables implicitly.

是否可以这样做而不必手动生成liquibase脚本?

Is it possible to do it without having to generate liquibase script manually?

推荐答案

(据我所知),使用liquibase是不可能的.

This is not possible using liquibase (as far as I know).

原因很简单:

如果您改变主意并稍后添加/删除默认列之一,该怎么办?如果要更改所有表,那么liquibase无法做到这一点,因为这意味着更改所有变更集,这是不允许的.

What if you change your mind and add/remove one of the default columns later? If you want to change all tables then this is not possible with liquibase as this would mean changing all changesets, which is not allowed.

使用DSL生成您的liquibase脚本,然后可以向每个实体添加一组特定的列,但是使用liquibase的工作方式很难采用自动方式.

Use a DSL to generate your liquibase scripts then you can add a certain set of columns to every entity but an automatic way would be difficult with the way liquibase works.

这篇关于Liquibase-常见列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆