This is going to be a problem. The migration script is run as root but apache needs to own these directories so it can write to them. If this script causes the creation of the type directory, apache is gonna have kittens.