Create linibase database from scratch

When I run a liquibase update from scratch, it takes a while as the process starts each changelog one by one. Sometimes my own changes to the database diverge so much that it’s easiest to restore the database if I want to start over, for example.

The rebuild would be fastest if I did it from a mysql dump of the lipibase result at some point in the changelists and I ignored the previously changed changelists. So I would delete everything in the main change editor except my master build dump changelog which will be the whole database and I keep the real changes in myself for version control purposes.

Is there a correct / designated / safe way to do this from lipibase?

+3


source to share


1 answer


Unfortunately, there is no standard way to "restart" the change file, because your environment and setup can dramatically affect which one works best for you.

Often, the simplest approach is not to completely rerun the change file, but to make changes to it instead. Databases tend to be fast in DDL, especially on an empty database, and so it often happens that a clean database rebuild is a small part of the changeSets. Overriding indexes are often a large part of the problem, but there can be other things as well. Have a look at which changeSets are taking registration time and maybe you can find some that cancel each other out or are no longer needed but still take most of the time.

If that works best for you to start from scratch, the process is basically the same as using Liquibase for an existing project. See the documentation at http://www.liquibase.org/documentation/existing_project.html for ideas on options with this.



With mysql, one option would be to use mysqldump and then use a single changeSet <execute>

to invoke the mysql shell command.

As far as your existing database strings are concerned, Liquibase uses this path as part of the changeSet id, so if your new changefile has a different name or path, Liquibase will already see the changeSets as new. Alternatively, you can start your new changefile with <changeSet>

, which doesdelete from databasechangelog

+1


source







All Articles