Skip to main content

Migrations and DB

Openlane uses schema-driven development backed by PostgreSQL.

Stack​

ToolRole
entSchema modeling
atlasSchema diffing and migration generation
gooseMigration execution support

Supported database drivers are pgx and postgres (lib/pq).

Local Configuration Example​

db:
debug: true
driver_name: pgx
primary_db_source: "postgres://postgres:password@postgres:5432?sslmode=disable"
run_migrations: true

Migration Workflow​

Generate migrations after schema changes:

task db:create

This writes the atlas migrations under db/migrations and the goose migrations under db/migrations-goose-postgres, one file for the base schema and one for the history schema. On every core pull request, the Atlas CI integration also comments with any issues it detects in the schema changes or migrations.

See the db README for tooling details and MIGRATION.md for the v2 permissions tuple migration.

info

For new schemas, follow the codegen flow first, then generate migrations