Serialize changelogs as formatted sql

Description

Support serializing changeSets as formatted sql. This will allow commands like

--changeLogFile=out.mysql.sql generateSql

which will output the SQL to bootstrap a database.

Will require a path of [FILENAME].[DATABASE_SHORT_NAME].sql so liquibase can know the type of database to generate SQL for. Example: changelog.h2.sql

Environment

All

Activity

Show:

Tuomas Kiviaho August 7, 2014 at 7:00 AM

I felt lucky and tried it anyways. I am able to see each supposed DatabaseObject coming from MissingObjectChangeGenerator.class at generatedChangeSetDatabase() so the problem isn't with incorrect connection. The problem that I'm experiencing is that the following method

private void addToChangeSets(Change[] changes, List<ChangeSet> changeSets, ObjectQuotingStrategy quotingStrategy) { if (changes != null) { ChangeSet changeSet = new ChangeSet(generateId(), getChangeSetAuthor(), false, false, null, changeSetContext, null, quotingStrategy, null); for (Change change : changes) { changeSet.addChange(change); } changeSets.add(changeSet); } }

is providing a hardcoded null as filePath for ChangeSet. Above I suggested if this.changeSetPath could be provided instead so that the process wouldn't at least stop for this particular reason.

Nathan Voxland August 5, 2014 at 8:14 PM

Your error seems to be an incorrect connection, but doing a diffChangeLog to a formatted SQL file isn't implemented yet, this issue is still open.

Tuomas Kiviaho July 29, 2014 at 9:58 AM

Should DiffToChangeLog provide it's changeSetPath as ChangeSet filePath at addToChangeSets. Currently 3.2.2 leads to "No changeset file path set. Cannot determine target database type" although I have provided a proper *.databasetype.sql formatted path.

Details

Reporter

Fix versions

Affects versions

Priority

Created March 3, 2014 at 3:27 PM
Updated June 10, 2015 at 7:31 PM

Flag notifications