Is there a way to hard-delete custom objects using the Force.com migration tool? When you deploy a DestructiveChanges payload, the objects are "soft-deleted" and not erased from the platform. This creates an issue when you subsequently try to push back in those objects.
Is there a way to do this?
Best Answer
A hidden gem in the Metadata API deploy operation takes a DeployOptions structure, in it is a purgeOnDelete setting that will do what you need!
Extending Salesforce Migration Tool to Support PurgeOnDelete.. For some reason this excellent feature has still not been exposed by the Salesforce Migration Tools via the sf:deploy Ant Task. However with a bit of Java skills you can create a new deploy Ant Task by extending the current one, to expose the attribute to your Ant build scripts, for example...
Prebuilt ant-salesforce.jar with deploypurge in it. You can download a modified ant-salesforce.jar here from the FinancialForce.com Developers Github repo (be warned this is API v22.0, though you can use it to deploy code at any version).
Building your own extended ant-salesforce.jar. If you want rebuild a new version, then you need to download this Java class, compile it, unzip the ant-salesforce.jar (rename .jar to .zip), put it in and zip it back up again and your all set!