kino
Operations

Database

Two schemas in one Postgres — the application's and the workflow's — and the commands that touch each one.

What you do here: keep the database in step with the code, knowing that kino uses two schemas in the same database.

The two schemas

SchemaWhat it holdsWho creates it
Application (Prisma)Users, sessions, organizations, members, invitations, API keys, projects, render jobs, and the AI and storage configurationprisma db push (or a migration)
Workflow worldThe durable execution tables (workflow_runs and friends)db:bootstrap

Both point at the same DATABASE_URL. The server needs both before it accepts a request: the app schema because everything reads from it, the workflow one because rendering is a durable workflow.

The commands

pnpm --filter @package/db push       # syncs the schema, without migration history
pnpm --filter @package/db migrate    # dev migration (creates a migration file)
pnpm --filter @package/db generate   # (re)generates the Prisma client
pnpm --filter @package/db studio     # the browser UI over the data

pnpm --filter @apps/server db:bootstrap   # creates the workflow tables

Both push and migrate run generate right after (there is a postpush), so the client is never behind the schema.

At boot

The stack's migrate service runs exactly:

pnpm --filter @package/db push && pnpm --filter @apps/server db:bootstrap

and exits. It is idempotent, which is what allows it to run on every start — the server waits for it to complete successfully before coming up. See What runs.

What is worth knowing

  • The Prisma client is generated, not committed. It is not in the lockfile, so every build runs pnpm --filter @package/db generate before compiling. In the images, that is explicit in the Dockerfile.
  • push has no migration history. It is the pragmatic path while the schema still moves fast; migrate is what produces migration files. Keep the same choice per environment — mixing the two is how a database ends up out of step.
  • Workflow steps that touch the database are verified in production mode. In dev, the SDK's step bundle inlines Prisma and the step does not load; in the packaged server it runs. If you are changing something that renders, test it in the production path.
  • The server and migrate containers do not carry a database of their own: the data is in the postgres service's volume. Backing kino up means backing that volume (or the database) up — plus the bucket.
  • Nothing here manages the organization's bucket. That is Storage, and it is configuration, not schema.
  • What runs — the start order the migrate service sits in.
  • Environment — DATABASE_URL and WORKFLOW_POSTGRES_URL.
  • Storage — the other place where files live.

On this page