Running a database migration
Last updated
Last updated
ℹ️ When Confidencial server software for the first time or upgrading an existing Confidencial instance, you will occasionally need to run a database migration. Database migrations create (or update) the table structure within a database. Migrations may need to be run for the or the . In either case, Confidencial will provide the requisite files to run the migration, usually in the form of a zip file.
⚠️ These instructions assume the database server has been instantiated, the database within that server has been created, and the database account you are using to access the database has full permissions on the database. See the relevant deployment instructions for more detail on how to do this.
⚠️ If running a migration on a database with existing data, BE SURE TO RUN A BACKUP/SNAPSHOT OF YOUR DATABASE BEFORE PROCEEDING
on a machine that has network access to the target database
In addition to target database access, this machine must also have internet access to be able to install additional packages
We will refer to this machine as the migration machine. The migration machine can be the database server itself, but it doesn’t need to be.
Unzip the migration files in a directory on the migration machine
We will refer to this folder as the migration folder
From the migration folder, run the following command
This will create a file in the migration folder called .env.kss.production
Open .env.kss.production
in a text editor and add the connection parameters for the target database
This file tells the migration code how to connect to the target database
⚠️ Note that values for `KNEX_USER`, `KNEX_PASSWORD`, and `KNEX_DB_NAME` are wrapped in single quotes. This is done to ensure that special characters and spaces are handled properly.
From the migration folder, run the following commands
These commands will install the necessary packages from the internet and then execute database commands to create (or update) the tables in the target database
✅ This completes database migration. If you encounter issues during this process, please .