Skip to content

Database Migrations

JITSudo uses Goose for PostgreSQL schema migrations. Migration files live in migrations/.

Terminal window
# Via Make target (requires DATABASE_URL)
make migrate
# Via binary directly
./bin/migrate

In Docker Compose, migrations run automatically via the migrate service before the server and worker start.

The migration history creates these core tables:

TablePurpose
tenantsMulti-tenant root, includes aws_role_arn
tenant_domainsEmail domain → tenant mapping
requestsAccess request lifecycle (status, duration, break_glass, timeout)
request_messagesThreaded messages on requests
grantsApproved access grants with provisioning state
policy_rulesCedar policy rules (decomposed fields + conditions)
api_keysPer-tenant API authentication keys
audit_logCompliance audit trail (actor, action, resource, metadata)
notification_channelsEvent notification configuration with filters
aws_resourcesCached AWS resource metadata
oidc_configPer-tenant OIDC provider configuration
system_settingsKey-value system settings
usersLocal user accounts

All tables include tenant_id foreign keys for isolation. Core tables support JSONB metadata columns for flexible extension.