Skip to main content
Charley requires PostgreSQL 16. The schema is fully idempotent — you can apply it multiple times safely.

Applying the Schema

psql $DATABASE_RW_URL -f db/schema.sql
The schema creates the following tables:
TableDescription
orgsOrganizations / workspaces
org_membersMembers with roles
licensesBilling plan and subscription state
devicesEnrolled endpoint devices
telemetry_rollupsHourly and daily analytics aggregates
device_enrollment_codesOne-time enrollment codes
org_invitesPending email invitations
notificationsIn-app notification feed
org_sso_configSAML/OIDC SSO configuration
org_alert_endpointsWebhook alert destinations
org_slack_integrationsSlack workspace connections

Seed Data (Development)

To populate the database with a test organization and sample telemetry:
psql $DATABASE_RW_URL -f db/seed.sql
The seed creates:
  • 1 test organization
  • 1 ORG_ADMIN member (matched by email — update seed.sql to match your Auth0 user’s email)
  • 2 test devices
  • 30 days of daily telemetry rollups
  • 48 hours of hourly telemetry rollups
Only apply seed.sql to development databases. It inserts fixed IDs that will conflict if applied to a database that already has data.

Running Locally with Docker

The repository includes a docker-compose.yml for local development:
# Start Postgres only
./dev.sh --local-db

# Start Postgres + pgAdmin GUI
./dev.sh --local-db --tools
pgAdmin is available at http://localhost:5050 when started with --tools.

Connection Details (local Docker)

FieldValue
Hostlocalhost
Port5432
Databasecharley
Usercharley
Passwordsecret

Migrations

There is no migration framework in the current codebase — the schema is maintained as a single idempotent schema.sql. For production schema changes, apply DDL statements manually or through your database management tooling.