i cant say i have personal experience with migration scripts but in theory, as long as it has the same size you can just replace every entity on the surface with the new one and set some value thats stored in the save game as the toggle if the mod should disable the old entity or not and also disable the recipe to produce it and replace any already existing items in inventories with the new one.
i think what someone else did also was if you cant just slot it in the same place to give the first player who joins the safe on the same force that owns the entity just a replacement and they can put it down them selfs if they have to re design anyways.
however it would probably require to permanently keep the script in case someone skips some versions in updating or give a warning for people to download a specific version first so the script can run and then update to newer versions if a newer version is available.