MDL-38558 add preupgrade script support

This is intended things like undoing of local hacks, it is similar to older pre 2.0 upgrade hack.