Changed so forced upgrade includes dropping tables
This commit is contained in:
parent
dbed0b91db
commit
f4f52e997b
1 changed files with 10 additions and 6 deletions
|
|
@ -66,7 +66,7 @@ public class DBUpgradeHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Will create a rename mapping where an existing table will be renamed.
|
* Will create a rename mapping where an existing table will be renamed to the given new name.
|
||||||
*
|
*
|
||||||
* @param oldTableName current name of the table
|
* @param oldTableName current name of the table
|
||||||
* @param newTableName new name that old table will be renamed to.
|
* @param newTableName new name that old table will be renamed to.
|
||||||
|
|
@ -83,9 +83,11 @@ public class DBUpgradeHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* With the default behaviour unnecessary columns will not be removed.
|
* With the default behaviour no longer existing columns and tables will
|
||||||
* But if forced upgrade is set to true then the upgrade handler will
|
* not be removed.
|
||||||
* create a new table and migrate the data from the old one to the new table.
|
* If forced upgrade is set to true then the upgrade handler will
|
||||||
|
* create a new table and migrate over the data from the old to the
|
||||||
|
* new table and finally remove the old table.
|
||||||
*
|
*
|
||||||
* @param enable true to enable forced upgrade
|
* @param enable true to enable forced upgrade
|
||||||
*/
|
*/
|
||||||
|
|
@ -101,9 +103,11 @@ public class DBUpgradeHandler {
|
||||||
|
|
||||||
upgradeRenameTables();
|
upgradeRenameTables();
|
||||||
upgradeCreateTables();
|
upgradeCreateTables();
|
||||||
upgradeDropTables();
|
|
||||||
upgradeAlterTables();
|
upgradeAlterTables();
|
||||||
|
|
||||||
|
if (forceUpgradeEnabled)
|
||||||
|
upgradeDropTables();
|
||||||
|
|
||||||
logger.fine("Committing upgrade transaction...");
|
logger.fine("Committing upgrade transaction...");
|
||||||
target.getConnection().commit();
|
target.getConnection().commit();
|
||||||
} catch(SQLException e) {
|
} catch(SQLException e) {
|
||||||
|
|
@ -261,7 +265,7 @@ public class DBUpgradeHandler {
|
||||||
new TableStructureResultHandler());
|
new TableStructureResultHandler());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class DBColumn{
|
private static class DBColumn {
|
||||||
String name;
|
String name;
|
||||||
String type;
|
String type;
|
||||||
boolean notNull;
|
boolean notNull;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue