Add DB schema from production dump; apply on db start, fix env passthrough to artisan serve

This commit is contained in:
kurogeek committed 2026-10-15 09:54:18 +00:00
1 parent 4d77464988
commit d38f9a1a83
3 files changed
+171 -10

No files matched your search

+11 -4
View File
@@ -17,17 +17,24 @@ nix run # installs vendors on first run, starts MariaDB, serves b
- site: http://127.0.0.1:8000
- CMS: http://127.0.0.1:8001
The site's article pages need the production schema, which only exists in the prod DB:
### Database
`dev/schema.sql` is the schema (10 tables, no `category` table — `category_id` 1/2 is hardcoded).
It is derived from the production dump and applied automatically on every `db start`
(idempotent), so a fresh checkout serves empty pages with no 500s. There are no Laravel
migrations for these tables; edit `dev/schema.sql` when prod changes.
To work with real content, load a production dump (drops and recreates the local DB):
```sh
mysqldump greaterc_db2024 > dump.sql # on the server
nix run . -- db import dump.sql
nix run . -- db import .dev/greaterc_db2024.sql # phpMyAdmin export, kept out of git
nix run . -- db reset # back to empty schema
```
`nix run . -- <cmd>` forwards to the `dev` script; `nix develop` drops you into a shell with
`dev`, `php`, `composer`, `mariadb`, `node` on PATH (direnv: `.envrc` → `use flake`).
Other commands: `dev db start|stop|status|shell`, `dev serve frontend|backend`,
Other commands: `dev db start|stop|status|shell|reset|import`, `dev serve frontend|backend`,
`dev artisan <app> ...`, `dev down`. See `dev help`.
The local DB listens on `127.0.0.1:3307` (override with `DEV_DB_PORT`); the `dev` script