Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi
I've been using dbdeploy at work, and I found I needed to be able to create the changelog table. I see from the open issues that there are a couple of requests for such a feature.
I've refactored most of the template code into a TemplateProcessor class, and created freemarker templates for the table creation scripts. QueryExecuter has a new "doesTableExist" method, which in the end used some complex JDBC calls. This is used to determine whether the changelog table needs to be created.
DatabaseSchemaVersionManager has a new subclass, EmptyDatabaseSchemaVersionManager which doesn't throw an error if the changelog table doesn't exist; this is only used if the user specifies that the changelog table may be created if necessary.
The two ChangelogAppliers now have an additional constructor parameter; ChangelogTableCreator which when set will produce the necessary SQL to create the changelog table. When null, the original behaviour is maintained.
I've also got a few more ideas in the pipeline; tool-appropriate logging to replace the System.err.println()s and maybe some database-specific override mechanism.
Let me know if you need any more detail, but I think the changes are fairly simple.
Regards
Alan