It is noted in the docs that if an exception occurs during an upgrade task, sub-sequent upgrade tasks won’t run.
I’ve observed this occurring during development, and noticed that if an exception occurs during an upgrade task, it rolls back any DB model changes and reverts to the previous model version.
Adding new columns to any existing Entity
interfaces should add the new column to the associated DB table, as normal. I wish to seed these new columns with default data, generated during an upgrade task, run alongside those implicitly added new columns.
If the upgrade task fails, the new columns are never added to the DB.
Any new features added elsewhere in the plugin that rely on these new columns now breaks, as only the DB changes are rolled back, not the entire plugin upgrade process.
Admittedly I observed this during testing while I had forgotten to call ao.migrate(SomeEntity.class)
. But, I would imagine the rollback occurs if any exceptions are thrown during the task, which are difficult to account for.
TL;DR: Is there a way to prevent other plugin behaviour from breaking if an upgrade task fails to update the DB model? Or, should I even be concerned about this possibility at all?
Many thanks!