Migrate the data of your Laravel app
Back to home
On this page
Migrate your data
If you are moving an existing site to Upsun, then in addition to code you also need to migrate your data. That means your database and your files.
Import the database
First, obtain a database dump from your current site, such as using the
Next, import the database into your Upsun site by running the following command:
upsun sql < dump.sqlThat connects to the database service through an SSH tunnel and imports the SQL.
Import files
First, download your files from your current hosting environment. The easiest way is likely with rsync, but consult your host’s documentation.
This guide assumes that you have already downloaded
all of your user files to your local files/user directory and your public files to files/public
, but adjust accordingly for their actual locations.
Next, upload your files to your mounts
using the upsun mount:upload command.
Run the following command from your local Git repository root,
modifying the --source path if needed.
upsun mount:upload --mount src/main/resources/files/user --source ./files/user
upsun mount:upload --mount src/main/resources/files/public --source ./files/publicThis uses an SSH tunnel and rsync to upload your files as efficiently as possible. Note that rsync is picky about its trailing slashes, so be sure to include those.
You’ve now added your files and database to your Upsun environment. When you make a new branch environment off of it, all of your data is fully cloned to that new environment so you can test with your complete dataset without impacting production.