FAQ - m-szalik/dbpatch GitHub Wiki
My patches are applied with wrong order
See important convention.
My patch (that contains stored procedures or functions) is miss interpreted.
If your patch is miss interpreted you can add hint for dbpach plugin to your patch that indicate sql statements. To do this add single line comment starting with block text before statement and single line comment after it. Example below:
-- block - my create function block
CREATE FUNCTION add(integer, integer) RETURNS integer
AS 'select $1 + $2;'
LANGUAGE SQL
IMMUTABLE
RETURNS NULL ON NULL INPUT;
-- single line comment indicate end of block
You can see how your patch is interpreted using mvn dbpatch:help-parse -Ddbpatch.file=/path/to/sqlFile
What does the symbol next to patch name mean?
When you run goal dbpatch:list you can see all patches that are available for configuration you selected in pom file. Before file name you can see symbol that indicate database patch state. Those symbols are:
- * (star) for patches that was applied to your database
- + (plus) for patches that should be applied to your database
- P for patches that are in progress or an error occurred during applying
Where patch states are stored?
State of each patch is stored in your database in table db_patches. The table contains data about any applied patch. If column patch_db_date is null it means that patch contains invalid statement, and an error occurred during execution of the patch.
How to deactivate dbpatcher?
You can set system property maven.dbpatch.skip to deactivate dbPatch.
mvn -Dmaven.dbpatch.skip=true <your maven goal>
How to define patch directories (configuration property patchDirs)?
A patchDirs property coma separated list of directories or file paths. Patch can also contain wild card characters to define file selection mask (example: /sqls/good-*.sql or /sqls/nov???.sql). If mask is not defined the default mask is used - .sql . So if your patchDirs property contains element like /sqls/ only patches matched to /sqls/.sql will be executed.
How to rollback changes?
Rollback goal requires additional property. It ban be one of:
- use
-Dmaven.dbpatch.stop=patchName
to roll back all patches up to patchName (inclusive) - use
-Dmaven.dbpatch.single=patchName
to roll back patchName only
Can I use it without maven?
Yes. You can use it as simple application with a GUI.
See command line mode.
Not working with Oracle
Oracle users must add to configuration a dialect
property db.dialect=oracle
. Where db
is a profile id.
Not working with Sybase
Oracle users must add to configuration a dialect
property db.dialect=sybase
. Where db
is a profile id.