Skip to main content

Migrations and DB

Openlane uses schema-driven development backed by PostgreSQL.

Stack

  1. ent for schema modeling
  2. atlas for schema diffing and migration generation
  3. goose for migration execution support

Supported Drivers

  1. pgx
  2. 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 atlas:create

Typical output updates:

  1. db/migrations
  2. db/migrations-goose-postgres

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