Refactor partnumber book catalog storage

This commit is contained in:
Mikhail Chusavitin
2026-03-07 22:10:05 +03:00
parent b2b2f4774c
commit 08de9006ef
8 changed files with 304 additions and 68 deletions

View File

@@ -69,6 +69,7 @@ make build-all # cross-compile Linux/macOS/Windows
# Migrations
go run ./cmd/pfs -migrate
make backup-db
# Version
./bin/pfs -version
@@ -87,6 +88,7 @@ make clean
| Target | Action |
|--------|--------|
| `run` | `go run ./cmd/pfs` |
| `backup-db` | Run `go run ./cmd/dbbackup` using current `config.yaml` |
| `build` | Dev build with debug info |
| `build-release` | `-s -w` stripped + version ldflags |
| `build-linux` | GOOS=linux GOARCH=amd64 |
@@ -121,6 +123,32 @@ SQL migrations in `migrations/` (25 files). Applied automatically on startup.
Manual run: `go run ./cmd/pfs -migrate`
Before any migration or DB repair:
```bash
make backup-db
```
Backup helper:
```bash
go run ./cmd/dbbackup
# optional:
go run ./cmd/dbbackup --config /path/to/config.yaml --out-dir /path/to/backups
```
Default output path:
```text
<PriceForge state dir>/backups/
```
Example on macOS:
```text
~/Library/Application Support/PriceForge/backups/
```
Migration runner: `internal/models/sql_migrations.go`
---