On occasion, Novu may introduce features that require changes to the database schema or data. This usually happens when a feature has a hard dependency on some data being available on a database entity. You can use migrations to make these changes to your database.

Running Migrations

To run data migrations, enter the following sequence of commands in your terminal from the novuhq/novu repository root:

npm run setup:project
cd apps/api
npm run migration -- ./migrations/<MIGRATION_PATH>.ts
# e.g. npm run migration -- ./migrations/add-user-contact/add-user-phone.ts

Some features may have multiple migrations, in which case you will need to run each migration in the order shown below.

Migrations History

Below you will find a list of migrations introduced in previous versions of Novu, alongside the migration path to use in the script above.

VersionFeatureMigration Path(s)
v0.23API keys encryption./encrypt-api-keys/encrypt-api-keys-migration.ts
Integration Store./novu-integrations/novu-integrations.migration.ts
v0.16In-App Integration./in-app-integration/in-app-integration.migration.ts
Secure Flag Fix./secure-to-boolean/secure-to-boolean-migration.ts
v0.15Database TTL./expire-at/expire-at.migration.ts
v0.12Organization Invite Fix./normalize-users-email/normalize-users-email.migration.ts
v0.9Seen/Read Support./seen-read-support/seen-read-support.migration.ts
v0.8Secure Credentials./fcm-credentials/fcm-credentials-migration.ts
v0.4Change Promotion./changes-migration.ts