Skip to content

Data and backup

mcinquin edited this page Oct 12, 2026 · 1 revision

Data and backup

MarkIt stores all application state in PostgreSQL (Docker volume postgres_data). There are no local SQLite files or uploaded media directories to back up beyond the database.

Schema (overview)

User          → user account
Team          → team with invite code
TeamMember    → user↔team membership (role: OWNER/ADMIN/MEMBER)
Phrase        → phrase bank entry (isDefault=true for shared phrases)
BingoCard     → bingo board (rows × cols, freeCenter)
Cell          → board cell (phrase + position)
CheckedCell   → checked cell (by which user, when)

Migrations live under prisma/migrations/. The Docker entrypoint runs prisma migrate deploy then seeds default phrases (and the admin account when ADMIN_* is set).

Commands

npm run db:migrate:deploy  # Apply migrations (prod / Docker)
npm run db:migrate         # Create a migration (dev)
npm run db:push            # Sync schema without a migration (prototyping)
npm run db:seed            # Load phrases + admin if configured
npm run db:studio          # Open Prisma Studio
npm run db:generate        # Regenerate the Prisma client

Backup and restore

Run dumps on the host against the markit_db container. Keep scripts/cron local — they are not versioned in this repository.

Backup

docker exec markit_db pg_dump -U markit markit > backup_$(date +%Y%m%d).sql

Daily cron example:

0 3 * * * docker exec markit_db pg_dump -U markit markit > /var/backups/markit/backup_$(date +\%Y\%m\%d).sql

Restore

Stop writers (or the app), then restore:

docker compose stop app
docker exec -i markit_db psql -U markit markit < backup_YYYYMMDD.sql
docker compose start app

For a clean restore into an empty database, drop/recreate the DB first or restore into a fresh volume.

Related

Clone this wiki locally