# Database Management

> Guide for managing the Docklift SQLite database using Prisma. Use when this capability is needed.

- Skill: `tomevault-io/database-management` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add tomevault-io/database-management`
- Raw SKILL.md: https://api.skillmd.com/api/skills/tomevault-io/database-management/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: tomevault-io (https://skillmd.com/u/tomevault-io)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/tomevault-io/database-management

---


# Database Management Guide

Docklift uses SQLite as its database, managed by Prisma ORM.

## Schema Location

The Prisma schema is located at:
`backend/prisma/schema.prisma`

## Core Commands

Run these commands from the `backend/` directory:

### View Data
-   **Open Studio**:
    ```bash
    bun run db:studio
    ```
    Opens a web GUI to view and edit the database content.

### Schema Changes
1.  **Edit Schema**: Modify `backend/prisma/schema.prisma`.
2.  **Generate Client**:
    ```bash
    bun run db:generate
    ```
    Updates the generated TypeScript client in `node_modules`.
3.  **Push Changes**:
    ```bash
    bun run db:push
    ```
    Applies the schema changes to the local SQLite database file (`backend/prisma/dev.db` or similar).

### Reset
-   **Reset Database**:
    ```bash
    bun run db:push --force-reset
    ```
    **WARNING**: This will delete all data.

## Key Models

-   **User**: Admin users for the application.
-   **Project**: Represents a deployed application (container).
-   **Deployment**: History of builds/deploys for a project.
-   **EnvVariable**: Environment variables for projects.
-   **Settings**: System-wide settings.

## Troubleshooting

-   If the database seems out of sync with the client, run `bun run db:generate`.
-   If you encounter migration errors, `db:push` usually resolves dev inconsistencies for SQLite.

---
> Converted and distributed by [TomeVault](https://tomevault.io/claim/ssujitx) — claim your Tome and manage your conversions.
<!-- tomevault:4.0:skill_md:2026-04-11 -->

