Skip to main content

Copying an In-Memory Database to a File

Imagine the following situation – you started Goose in in-memory mode but would like to persist the state of your database to disk. To achieve this, attach to a new disk-based database and use the COPY FROM DATABASE ... TO command:

ATTACH 'my_database.db';
COPY FROM DATABASE memory TO my_database;
DETACH my_database;

Ensure that the disk-based database file does not exist before attaching to it.