Database Support
- PostgreSQL
- PGlite
Editions
- Enterprise & Cloud Edition (Must use PostgreSQL)
- Community Edition (Can use PostgreSQL or PGlite)
How To Generate
Setup AP_DB_TYPE
Set the
AP_DB_TYPE environment variable to POSTGRES after making sure have latest state by running Activepieces first.Generate Migration
Run the migration generation command:Replace
<MIGRATION_NAME> with a descriptive name for your migration.Update Migration File
The command will generate a new migration file in CI will fail if
packages/server/api/src/app/database/migration/postgres/.The generated file uses MigrationInterface — you need to update it:- Change
implements MigrationInterfacetoimplements Migration - Update the import from
typeormto importMigrationfrom../../migration - Add
breaking = false(ortrueif the migration drops columns/tables or transforms data irreversibly) - Add
release = '<version>'matching the upcoming release version (checkpackage.jsonin the repo root) - Implement the
down()method with queries that reverse theup()changes (unlessbreaking = true) - Register it in
postgres-connection.ts
breaking, release, or down() are missing on new migrations.PGlite Compatibility
While PGlite is mostly PostgreSQL-compatible, some features are not supported. When using features likeCONCURRENTLY for index operations, you need to conditionally handle PGlite: