Liquibase 列数据类型混乱
我有一个正在生产中的现有数据库。我已经使用 liquibase 导出了架构,并创建了一个基本脚本,以便在为新客户安装时使用。 Liquibase 将 mssql 中的所有 id 列导出为 BIGINT,但实际上它们在数据库中是 NUMERIC。
现在,当我添加创建新表和旧表的前键的升级脚本时,我收到错误:列与外键中引用列的数据类型不同。
发生的情况是,仅升级(并且不会进行全新安装)的客户将在数据库中拥有 NUMERIC 列,并且它将与新的 BIGINT 列发生冲突。
问题是我应该做什么,因为对于每种数据库类型它也是不同的类型。我迷路了
I have an existing database in production. I have exported the schema with liquibase and created a base script to be used when installing for a new customer.
Liquibase exported all my id columns in mssql as BIGINT, but in reality they were NUMERIC in the database.
Now When I am adding an upgrade script that creates a new table and a foreight key to an old table, I am receiving an error: Column is not the same data type as referencing column in foreign key.
What happens is that customer that will only upgrade (and wont have a clean install) will have NUMERIC column in database and it will clash with the new BIGINT column.
The question is what should I do, because for each database type it is also different types. I am lost
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
模式导出的工作是获取变更日志的起点。 liquibase 的下一个版本的重点是改进导出支持,但即使如此,您导出的数据库的类型和您的“意思”之间也会存在差异 - 特别是在跨数据库的意义上。
正常用法是调用generateChangeLog,然后通读创建的内容并根据您对数据库的理解根据需要修改它以修复数据类型等。从那时起,您将执行正常的 liquibase 流程,在需要数据库更改时手动附加到更改日志,然后针对数据库运行修改后的更改日志。
The job of the schema export is to get a starting point for a changeLog. The next version of liquibase is focused on improving the export support, but even with that there will be differences between what the database you are exporting has a type and what you "mean"--especially in a cross-datbase sense.
The normal usage is to call generateChangeLog, then read through what is created and modify it as needed to fix up data types etc. based on your understanding of the database. From that point on, you do the normal liquibase flow of manually appending to your changeLog as you need database changes and then running the modified changelog against the database.