Skip to content

Instantly share code, notes, and snippets.

@mkorman
Last active February 29, 2016 16:48
Show Gist options
  • Save mkorman/9047aef73e9ab8e87dcb to your computer and use it in GitHub Desktop.
Save mkorman/9047aef73e9ab8e87dcb to your computer and use it in GitHub Desktop.
global class PostInstallScript implements InstallHandler {
global void onInstall (InstallContext context)
{
// Initialize package (and new feature) on fresh installs
if (context.previousVersion() == null)
{
InitializePackage();
InitializeFeature13();
}
// Migrate data, but only for versions older than 1.2
else if (context.previousVersion().CompareTo(new Version (1,2)) < 0)
{
UpgradeForFeature12();
UpgradeForFeature13();
}
// Migrate existing data, for versions older than 1.3
else if (context.previousVersion().CompareTo(new Version (1,3)) < 0)
{
UpgradeForFeature13();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment