# Database backup

`mv_rent_backup.sql` is a plain-SQL PostgreSQL dump of the `mv_rent` database
(schema + data), created with:

```bash
pg_dump --no-owner --no-privileges --clean --if-exists mv_rent -f db/mv_rent_backup.sql
```

It includes `DROP ... IF EXISTS` before each object, so restoring overwrites the
target database's contents.

> ⚠️ Contains application data: user emails and **bcrypt-hashed** passwords
> (not plaintext). Keep this repository private.

## Restore

**Into a local Postgres:**
```bash
createdb mv_rent 2>/dev/null   # if it doesn't exist yet
psql -h localhost -U postgres -d mv_rent -f db/mv_rent_backup.sql
```

**Into the Docker Compose deployment (server or local):**
```bash
cd /opt/mvrent        # or your project dir
docker compose exec -T db psql -U postgres -d mv_rent < db/mv_rent_backup.sql
```

Stop the `app` container first if you want a clean restore without it writing
concurrently: `docker compose stop app && …restore… && docker compose start app`.
