How do I migrate an unmanaged database to managed? Or vice versa?

As you grow, you might want to migrate your database to a managed service, or you might want to save money by moving to an unmanaged database.

Written by Chris Oliver
Updated over a week ago
If you wish to migrate from an unmanaged database to a managed database, you can follow these steps to create a manage database and migrate your data and application to it.

This same approach works the other direction if you would like to migrate from a managed database to an unmanaged database to save money.
  1. You might want to enable maintenance mode on your app so no new records are created during the backup and restore process.
  2. Create a Managed database.
    You can use the Database section to create a managed database, or directly through DigitalOcean, Amazon, Crunchy Data, or any other database service. Your choice.
  3. Use TablePlus to backup your unmanaged database.
  4. Restore your backup to the new DigitalOcean database cluster.
  5. Detach the unmanaged database from your app. This will remove the DATABASE_URL but keep the database.
  6. Attach the managed database to your app. This will add the DATABASE_URL that points to the managed database on DO. 
    If you created the database manually, you will need to set the DATABASE_URL on your app that points to your hosting provider's database.
  7. Disable maintenance mode if you used it.

Was this article helpful?