docs: add SQL-only schema update script for v2610.1

update(2610.1).sql brings an existing database up to the current schema
without PHP: base tables (CREATE IF NOT EXISTS), the v2603.x migrations
(last_event_at column, uq_event removal) and the v2610.1 index changes
(idx_occurred, idx_src_ip_occ, drop idx_src_ip). All steps are idempotent
via information_schema checks + PREPARE/EXECUTE, so the file is safe to
re-run and portable across MySQL 8 and MariaDB.
This commit is contained in:
daprogs committed 2026-10-19 12:12:00 -04:00
1 parent 5649930060
commit d382c77995
2 files changed
+165 -2

No files matched your search

+11 -2
View File
@@ -42,6 +42,7 @@ Each portspoof_py instance runs independently and exposes a JSON API. portspoof_
portspoof_concentrator/
├── config.php Database credentials and app-wide constants
├── schema.sql MySQL DDL (applied by setup.php)
├── update(2610.1).sql SQL-only schema update for existing databases (this release)
├── setup.php One-time install / migration script
├── index.php Aggregated dashboard
├── nodes.php Add / edit / delete portspoof_py nodes
@@ -501,13 +502,21 @@ curl -H "Authorization: Bearer your-token" "https://yourserver/api/connections.p
## Upgrading
If you deployed before `last_event_at` was added to the schema, run `setup.php` again:
When upgrading, migrate the database to the new schema with either of:
**Via the PHP setup script:**
```bash
php /var/www/portspoof_concentrator/setup.php
```
It will add the missing column, drop the legacy `uq_event` unique key, and add the `occurred_at` / `(src_ip, occurred_at)` indexes if present. No data is lost.
**Via SQL (no PHP required):**
```bash
mysql -u portspoof -p portspoof_concentrator < "update(2610.1).sql"
```
Both apply all pending migrations idempotently (the `last_event_at` column, the legacy `uq_event` key removal, and the `occurred_at` / `(src_ip, occurred_at)` indexes) and can be re-run safely. No data is lost. Note that on a large `connections` table the `ADD KEY` steps take time proportional to the table size.
---