1 package com.atlassian.activeobjects.external;
2
3 /**
4 * This is the interface to implement for writing upgrade tasks.
5 */
6 public interface ActiveObjectsUpgradeTask {
7 /**
8 * This gives the version the upgrade task will upgrade the model to. This is this version that is used by the
9 * Active Objects plugin to figure out whether this upgrade task should be run and in which order.
10 *
11 * @return the version of the model after the upgrade task has been run successfully.
12 */
13 ModelVersion getModelVersion();
14
15 /**
16 * <p>Upgrades the database model of this Active Objects plugin to the {@link #getModelVersion() given version}.</p>
17 * <p>If any exception is thrown during the upgrade then sub-sequent upgrades won't run and this upgrade task will
18 * be re-tried next time.</p>
19 *
20 * @param currentVersion the current version of the model currently in the database.
21 * @param ao a configured instance of the Active Objects, which is not associated with any entity (yet).
22 */
23 void upgrade(ModelVersion currentVersion, ActiveObjects ao);
24 }