简体   繁体   English

使用Liquibase从现有数据库(包括存储的proc)创建数据库changelog xml文件

[英]Creating a database changelog xml file from an existing database (including stored procs) using Liquibase

Is it possible to create an initial database changelog xml file from the existing state of the database? 是否可以从数据库的现有状态创建初始数据库changelog xml文件?

I believe I've generated the schema using generateChangeLog, but it doesn't seem to return the stored procedures (or the data). 我相信我已经使用generateChangeLog生成了架构,但是它似乎没有返回存储过程(或数据)。

I'm using SQL Sever 2008 我正在使用SQL Sever 2008

You can return the data using a diffTypes flag that includes "DATA". 您可以使用包含“ DATA”的diffTypes标志返回数据。 See http://www.liquibase.org/documentation/diff.html . 参见http://www.liquibase.org/documentation/diff.html

Liquibase cannot currently output stored procedures, however. 但是,Liquibase当前无法输出存储过程。 For that you will need to use a different tool and include them in the generated changelog using the tag. 为此,您将需要使用其他工具,并使用标签将它们包括在生成的变更日志中。

download liquibase.jar , database driver and save to one directory (Ex:/home/mySystem/liquibase), in the command line change the directory to (/home/mySystem/liquibase) and run the below mentioned command 下载数据库驱动程序liquibase.jar并保存到一个目录(例如:/ home / mySystem / liquibase),在命令行中将目录更改为(/ home / mySystem / liquibase)并运行以下提到的命令

java -jar liquibase.jar --driver=org.postgresql.Driver --classpath=postgresql-42.1.3.jar --changeLogFile=db.changelog.xml --url="jdbc:postgresql://localhost:5432/<databasename>" --username=<username> --password=<password> update

Reference link: 参考链接:

http://www.liquibase.org/documentation/generating_changelogs.html http://www.liquibase.org/documentation/generating_changelogs.html

I just yesterday discovered SQL Power Architect, which seems to be able to generate Liquibase configurations: http://www.sqlpower.ca/page/architect 我昨天刚刚发现了SQL Power Architect,它似乎能够生成Liquibase配置: http ://www.sqlpower.ca/page/architect

For more info on this combination see this blog post: http://blog.mgm-tp.com/2010/11/data-modeling-part2/ 有关此组合的更多信息,请参见此博客文章: http : //blog.mgm-tp.com/2010/11/data-modeling-part2/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM