开发者

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

开发者 https://www.devze.com 2023-02-22 17:34 出处:网络
Is it possible to create an initial database changelog x开发者_运维知识库ml file from the existing state of the database?

Is it possible to create an initial database changelog x开发者_运维知识库ml file from the existing state of the database?

I believe I've generated the schema using generateChangeLog, but it doesn't seem to return the stored procedures (or the data).

I'm using SQL Sever 2008


You can return the data using a diffTypes flag that includes "DATA". See http://www.liquibase.org/documentation/diff.html.

Liquibase cannot currently output stored procedures, however. 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

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


I just yesterday discovered SQL Power Architect, which seems to be able to generate Liquibase configurations: 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/

0

精彩评论

暂无评论...
验证码 换一张
取 消