I have a 5 yr old site I’m trying to migrate over to Trellis, Bedrock, and Sage. I’ve done a full backup of the site via my cPanel from my old hosting provider and I’m in the process of setting up my dev environment now.
I have the media library uploads folder
.sql file of the entire database
I’m leaving my site up for the time being until I can figure out how to transition the whole thing over to this new setup. I have a couple questions regarding how to make the move as smooth as possible.
When I setup the Trellis development environment. I’ve gave it generic names for the database, but copied the table prefixes to match the old db. I was wondering if there is certain tables I should just drop from the old environment before importing the db into the new setup.
Also, I can imagine that I have to make a bunch of search and replace queries to make the paths route correctly for the sample.dev domain if I want the images to work correctly.
My next question has to do with where am I suppose to be putting the media library uploads folder?
The images seem to translate well when I put them inside the site/web/app/wp-content/uploads folder for display reasons, but that’s it.
When I go to run regenerate thumbnails, it basically says that none of the images exist at the home path
Very good question indeed!
I never did such a thing, but I can advise you to take a look at WP Migrate DB Pro
It’s a library where you can sync databases with eachother, providing a good way to search and replace the string which you want. Also they have an extensions which can sync media files too. I am using this plugin too for syncing between different environments (i.e dev, staging, production). But the syncing is only done on sites with the new architecture. I am curious about your results, if you decide to use this plugin for converting the old site db to the new architecture.
Thanks ben and naz. I started looking through the Trellis documentation and saw there’s a db_import config setting. I was able to import my sql file easily using that.
I did have to drop the main options table though. The configurations the my old DB had would throw errors over and over every time I tried to import it in. Once I remove that table, everything was much easier to do minor adjustments.
The wp_options table contains the site URL and home URL, which I’m guessing needed to change from your old install ( add the /wp ), without this change the site will not work.
In the future you can do this with wp-cli’s search-replace function.
In vagrant, cd to the directory of your web root: wp search-replace 'old thing' 'new thing' --dry-run <-- will do a test search-replace so you can check to make sure you typed everything correctly and it will also show you any PHP errors, if there are any, that you probably want to address before performing the search-replace. wp search-replace 'old thing' 'new thing' <— will perform the search and replace on the current database being used by the site wp search-replace 'old thing' 'new thing' --export=file.sql <–will export a file with your replacements instead of performing them on the database currently being used. Might be useful in some situations like exporting back to a cpanel architecture.
Or you can use WP DB Migrate Pro, which essentially does the same thing and it also has a feature that will move the DB for you, but their automatic migration feature is only useful if you already have/can install it on and access it on the old server.