Read more about TypeORM migrations here:
https://orkhan.gitbook.io/typeorm/docs/migrations
Database Support
- PostgreSQL
- SQLite
Why Do we have SQLite?
We support SQLite to simplify development and self-hosting. It’s particularly helpful for:
- Developers creating pieces who want a quick setup
- Self-hosters using platforms to manage docker images but doesn’t support docker compose.
Editions
- Enterprise & Cloud Edition (Must use PostgreSQL)
- Community Edition (Can use PostgreSQL or SQLite)
If you are generating a migration for an entity that will only be used in Cloud & Enterprise editions, you only need to create the PostgreSQL migration file. You can skip generating the SQLite migration.
How To Generate
1
Uncomment Database Connection Export
Uncomment the following line in
packages/server/api/src/app/database/database-connection.ts
:2
Configure Database Type
Edit your For PostgreSQL migrations:
.env
file to set the database type:3
Generate Migration
Run the migration generation command:Replace
<MIGRATION_NAME>
with a descriptive name for your migration.4
Move Migration File
The command will generate a new migration file in
packages/server/api/src/app/database/migrations
.
Review the generated file and:- For PostgreSQL migrations: Move it to
postgres-connection.ts
- For SQLite migrations: Move it to
sqlite-connection.ts
5
Re-comment Export
After moving the file, remember to re-comment the line from step 1:
Always test your migrations by running them both up and down to ensure they work as expected.