Import a database

Bring your app's data to Cubli with a Postgres or MySQL dump.

Moving an app to Cubli? Then you want to bring its data. Your databases at Cubli have no public address. So you deliver a dump, and Cubli restores it inside Cubli.

Note: everything already in the database is replaced. That is why you type the database’s name first.

1. Make a dump at your old host

Postgres:

pg_dump --no-owner --no-acl -Fc -f dump.pgdump <database>

Without -Fc you get plain SQL; that works too.

MySQL:

mysqldump <database> | gzip > dump.sql.gz

Gzipped is always fine. The dump may be at most 2 GB.

2. Put it in your Cubli database

With the Cubli CLI, from your own computer:

npx @cubli/cli db import dump.pgdump --database <database id>

The dashboard shows the command with the right id: open the database in your project and choose Import data. The CLI asks you to type the database’s name, uploads the dump and follows the restore. --yes skips that question, for example in a script.

Working with an AI tool connected to Cubli? Ask: “Import this dump into my database”. The tool asks for your yes first, because the content is replaced.

3. Check your app

When it is done, the database says Imported. Open your app and check that everything is there.

If your app uses a key to encrypt data in the database, set it as a variable too, with the same value as at your old host. Otherwise your app cannot read that data.

Did it fail?

You then see the end of the log, in your terminal and with the import in the dashboard. For Postgres, a dump with --no-owner --no-acl usually helps. If the dump is larger than 2 GB, compress it with gzip.

Stuck? Mail support@cubli.io.

Was this helpful?

Stuck? Mail support@cubli.io, or ask from your dashboard: Help