Isaias Tavares
fc9e634d86
feat(db): back up, restore and copy a Postgres database before migrating it
...
On Postgres the backup port dumps with pg_dump and restores by turning the
dump into a script with pg_restore and having psql clear the current schema
and run it in one transaction. A dump only recreates what it holds, so a
plain pg_restore --clean would leave a later migration's tables behind and
break the migrations the reopen runs; a restore that fails leaves the
database as it was. A restore refuses a pg_restore or psql older than
17.6/16.10/15.14/14.19, whose script would lack the \restrict line that
keeps a psql meta-command smuggled into an uploaded dump from running
(CVE-2025-8714). A restore
refuses a SQLite archive, a dump without TREK's migration history or one a
newer TREK wrote before anything is replaced, and keeps a dump of the
database it replaces.
RESTORE_FROM_BACKUP loads the archive's dump the same way into a database
that holds no table yet, and is ignored with a warning once it holds one.
Before pending migrations the boot now takes a pg_dump copy to
data/pre-migrate-<last migration>-<time>.pgdump under the same
TREK_DB_PRE_MIGRATE_SNAPSHOT(_KEEP) policy as the SQLite file, instead of
refusing; a copy that cannot be written refuses the boot.
The tools run by absolute path (TREK_DB_PG_BIN_DIR, or the usual
directories), never through PATH, with the password in PGPASSWORD; an
sslmode that asks for SSL verifies the certificate as the app pool does.
Dumps are written beside their target and renamed into place, readable by
their owner only, and a tool's stderr reaches errors without the lines that
quote SQL or rows. The image installs postgresql-client-17 from Debian 13.
2026-11-04 22:45:31 -03:00
..
2026-10-28 12:17:54 +01:00
2026-10-30 22:06:07 +01:00
2026-11-03 22:09:54 +01:00
2026-10-10 21:23:37 +02:00
2026-10-10 20:16:13 +02:00
2026-10-31 03:25:55 +00:00
2026-11-01 16:18:21 +01:00
2026-11-04 22:45:02 -03:00
2026-10-18 13:21:52 +02:00
2026-10-10 21:23:37 +02:00
2026-10-12 12:32:24 +02:00
2026-10-28 12:06:50 +01:00
2026-10-30 21:54:19 +01:00
2026-10-10 21:23:37 +02:00
2026-11-01 22:51:27 +01:00
2026-10-22 22:29:35 +02:00
2026-10-22 21:30:39 +00:00
2026-10-23 01:45:16 +00:00
2026-11-02 14:11:27 +01:00
2026-10-23 21:01:00 +02:00
2026-10-10 21:23:37 +02:00
2026-10-31 03:25:56 +00:00
2026-10-30 16:16:09 +01:00
2026-11-02 13:56:32 +01:00
2026-10-10 21:23:37 +02:00
2026-10-22 21:30:39 +00:00
2026-10-22 21:30:39 +00:00
2026-11-01 18:32:43 +01:00
2026-10-10 21:23:37 +02:00
2026-10-28 16:30:54 +01:00
2026-10-22 21:30:38 +00:00
2026-10-22 21:30:39 +00:00
2026-10-22 22:29:35 +02:00
2026-10-22 21:30:26 +00:00
2026-10-10 21:23:37 +02:00
2026-11-03 08:44:45 +01:00
2026-10-10 21:23:37 +02:00
2026-10-10 21:23:37 +02:00
2026-10-10 21:23:37 +02:00
2026-10-10 23:37:19 +02:00
2026-11-03 08:44:45 +01:00
2026-11-01 16:18:21 +01:00
2026-11-01 16:18:21 +01:00
2026-10-10 21:23:37 +02:00
2026-10-10 21:23:37 +02:00
2026-10-10 21:23:37 +02:00
2026-10-10 21:23:37 +02:00
2026-10-10 21:23:37 +02:00
2026-10-29 13:34:28 +01:00
2026-10-20 15:28:22 +02:00
2026-10-20 16:30:55 +02:00
2026-10-31 03:25:13 +00:00
2026-10-31 03:25:12 +00:00
2026-10-31 00:40:23 +00:00
2026-10-10 21:23:37 +02:00
2026-10-10 21:23:37 +02:00
2026-10-22 21:31:23 +00:00
2026-10-31 03:25:13 +00:00
2026-10-31 00:40:23 +00:00
2026-10-31 03:25:13 +00:00
2026-10-10 21:23:37 +02:00
2026-10-10 21:23:37 +02:00
2026-10-12 17:06:52 +02:00
2026-10-10 21:23:37 +02:00
2026-11-01 16:18:21 +01:00
2026-10-10 21:23:37 +02:00
2026-10-10 21:23:37 +02:00
2026-11-01 18:46:58 +01:00
2026-11-04 22:10:18 -03:00
2026-11-04 22:45:31 -03:00
2026-10-22 21:34:15 +00:00
2026-10-25 10:51:56 +01:00
2026-10-22 21:30:39 +00:00
2026-10-25 11:03:03 +01:00
2026-10-24 08:29:51 +02:00
2026-11-03 22:16:41 +00:00
2026-11-03 22:16:41 +00:00
2026-10-10 21:23:37 +02:00
2026-10-10 21:23:37 +02:00
2026-10-30 21:54:19 +01:00
2026-10-10 21:23:37 +02:00
2026-10-10 21:23:37 +02:00
2026-11-03 08:44:45 +01:00
2026-10-10 21:23:37 +02:00
2026-10-10 21:23:37 +02:00
2026-10-10 21:23:37 +02:00
2026-10-21 13:16:43 +02:00
2026-10-22 21:30:39 +00:00
2026-10-25 00:46:24 +00:00
2026-11-01 18:46:58 +01:00
2026-10-20 15:32:47 +02:00
2026-10-20 21:15:45 +02:00
2026-10-20 15:32:47 +02:00
2026-10-20 17:51:27 +02:00
2026-10-22 21:31:23 +00:00
2026-10-22 21:31:23 +00:00
2026-10-22 21:34:14 +00:00
2026-10-12 21:13:57 +00:00
2026-10-12 21:13:57 +00:00
2026-11-01 16:18:21 +01:00
2026-10-10 21:23:37 +02:00
2026-10-10 21:23:37 +02:00
2026-10-10 21:23:37 +02:00
2026-10-10 21:23:37 +02:00
2026-10-22 21:30:39 +00:00
2026-10-22 21:31:23 +00:00
2026-10-21 17:53:39 +02:00
2026-10-10 21:23:37 +02:00
2026-10-21 20:00:07 +02:00
2026-10-21 21:16:36 +02:00
2026-10-10 21:23:37 +02:00
2026-10-22 21:31:23 +00:00
2026-10-22 21:30:38 +00:00
2026-10-10 21:23:37 +02:00
2026-10-10 21:23:37 +02:00
2026-10-22 21:30:39 +00:00
2026-10-10 21:23:37 +02:00
2026-10-10 22:53:59 +02:00
2026-10-10 21:23:37 +02:00
2026-10-10 22:53:59 +02:00
2026-10-12 13:15:17 +02:00
2026-10-24 23:22:15 +00:00
2026-10-10 21:23:37 +02:00
2026-10-22 21:30:12 +00:00
2026-10-10 20:16:06 +02:00
2026-10-10 21:23:37 +02:00
2026-10-10 21:23:37 +02:00
2026-10-10 21:23:37 +02:00
2026-10-22 21:30:12 +00:00
2026-10-10 21:23:37 +02:00
2026-10-14 20:21:37 +02:00
2026-10-19 21:33:40 +02:00
2026-10-19 22:03:54 +02:00
2026-10-22 21:30:39 +00:00
2026-11-01 18:46:58 +01:00
2026-10-10 21:23:37 +02:00
2026-10-10 21:23:37 +02:00
2026-10-22 21:34:15 +00:00
2026-10-28 08:01:53 +02:00
2026-10-24 02:18:08 +00:00
2026-10-23 17:13:08 +02:00
2026-10-24 02:18:07 +00:00
2026-10-22 21:30:38 +00:00
2026-10-22 21:34:14 +00:00
2026-10-23 21:59:43 +02:00
2026-10-24 02:18:08 +00:00
2026-10-20 15:11:08 +02:00
2026-10-10 21:23:37 +02:00
2026-10-10 21:23:37 +02:00
2026-10-22 21:34:15 +00:00
2026-10-24 01:14:03 +00:00
2026-10-26 13:29:35 +01:00
2026-10-24 01:14:03 +00:00
2026-10-22 21:34:15 +00:00
2026-10-24 20:13:41 +02:00
2026-10-22 21:34:15 +00:00
2026-10-23 22:08:13 +00:00
2026-10-21 16:31:40 +02:00
2026-10-21 16:31:40 +02:00
2026-10-21 16:49:47 +02:00
2026-10-22 21:31:23 +00:00
2026-10-10 20:16:10 +02:00
2026-10-18 13:21:53 +02:00
2026-10-24 22:54:44 +02:00
2026-10-10 20:16:04 +02:00
2026-10-21 18:15:24 +02:00
2026-10-21 18:15:24 +02:00
2026-10-21 19:08:25 +02:00
2026-10-22 21:31:23 +00:00
2026-10-24 22:54:45 +02:00
2026-10-21 17:39:33 +02:00
2026-10-21 17:39:33 +02:00
2026-10-21 17:53:39 +02:00
2026-10-24 22:54:43 +02:00
2026-10-29 17:26:51 +01:00
2026-10-10 21:23:37 +02:00
2026-10-10 21:23:37 +02:00
2026-10-10 21:23:37 +02:00
2026-10-22 21:30:39 +00:00
2026-11-01 18:11:43 +01:00
2026-10-10 21:23:37 +02:00
2026-10-10 21:23:37 +02:00
2026-10-10 21:23:37 +02:00
2026-10-10 21:23:37 +02:00
2026-11-03 08:44:45 +01:00
2026-10-10 21:23:37 +02:00
2026-10-10 21:23:37 +02:00
2026-10-21 11:58:39 +02:00
2026-10-10 21:23:37 +02:00
2026-10-10 21:23:37 +02:00
2026-10-30 16:36:22 +01:00
2026-10-31 03:25:56 +00:00
2026-10-10 21:23:37 +02:00
2026-10-10 21:23:37 +02:00
2026-10-10 21:23:37 +02:00
2026-10-12 20:53:08 +02:00
2026-10-10 20:16:04 +02:00
2026-10-10 21:23:37 +02:00
2026-10-21 12:05:38 +02:00
2026-10-29 13:34:28 +01:00
2026-10-30 16:52:12 +01:00
2026-11-04 10:56:36 +01:00
2026-10-12 21:13:58 +00:00
2026-10-29 13:34:28 +01:00
2026-10-10 20:16:04 +02:00
2026-10-12 21:13:58 +00:00
2026-10-21 11:35:03 +02:00
2026-10-20 07:09:56 +00:00
2026-10-30 16:15:59 +01:00
2026-10-31 03:25:56 +00:00
2026-10-30 16:52:12 +01:00
2026-10-10 21:23:37 +02:00
2026-10-10 21:23:37 +02:00
2026-10-10 21:23:37 +02:00
2026-10-10 21:23:37 +02:00
2026-10-18 15:59:33 +02:00
2026-10-10 21:23:37 +02:00
2026-10-10 21:23:37 +02:00
2026-10-10 21:23:37 +02:00
2026-11-03 08:44:45 +01:00
2026-11-03 08:44:45 +01:00
2026-10-10 21:23:37 +02:00
2026-10-22 21:30:39 +00:00
2026-10-10 21:23:37 +02:00
2026-10-20 15:35:32 +02:00
2026-10-22 21:30:12 +00:00
2026-10-24 23:22:15 +00:00
2026-10-10 21:23:37 +02:00
2026-10-10 21:23:37 +02:00
2026-10-22 21:30:12 +00:00
2026-10-12 17:06:58 +02:00
2026-10-24 18:28:41 +02:00
2026-10-10 22:53:59 +02:00
2026-10-10 21:23:37 +02:00
2026-11-01 16:18:21 +01:00
2026-10-31 03:25:56 +00:00
2026-10-29 13:34:28 +01:00
2026-10-19 22:03:54 +02:00
2026-10-21 11:35:03 +02:00
2026-10-22 21:51:44 +00:00
2026-10-22 21:51:44 +00:00
2026-10-22 22:29:35 +02:00
2026-11-01 16:18:21 +01:00
2026-10-10 21:23:37 +02:00
2026-10-10 21:23:37 +02:00
2026-10-10 21:23:37 +02:00
2026-10-10 21:23:37 +02:00
2026-10-22 21:34:15 +00:00
2026-10-30 16:36:22 +01:00
2026-10-30 16:36:22 +01:00
2026-10-31 03:25:56 +00:00
2026-10-10 21:23:37 +02:00
2026-10-31 03:25:56 +00:00
2026-10-31 03:25:56 +00:00
2026-10-29 15:24:49 +01:00
2026-10-10 21:23:37 +02:00
2026-10-10 21:23:37 +02:00
2026-10-10 21:23:37 +02:00
2026-10-10 21:23:37 +02:00
2026-11-01 16:18:21 +01:00
2026-10-10 21:23:37 +02:00
2026-10-28 15:43:52 +01:00
2026-11-01 16:18:21 +01:00
2026-10-10 21:23:37 +02:00
2026-11-04 22:45:31 -03:00
2026-10-22 21:30:12 +00:00
2026-10-10 21:23:37 +02:00
2026-10-10 21:23:37 +02:00
2026-10-10 21:23:37 +02:00
2026-10-10 21:23:37 +02:00
2026-10-10 21:23:37 +02:00
2026-10-10 21:23:37 +02:00
2026-10-10 21:23:37 +02:00
2026-10-10 21:23:37 +02:00
2026-10-10 21:23:37 +02:00
2026-10-10 21:23:37 +02:00
2026-10-10 21:23:37 +02:00
2026-10-10 21:23:37 +02:00
2026-10-22 21:30:39 +00:00
2026-10-12 21:13:57 +00:00
2026-10-22 22:29:35 +02:00
2026-10-22 22:29:35 +02:00
2026-10-10 21:23:37 +02:00
2026-10-12 16:05:17 +02:00
2026-10-31 03:25:55 +00:00
2026-10-10 21:23:37 +02:00
2026-10-30 16:36:22 +01:00
2026-10-10 21:23:37 +02:00
2026-10-22 21:30:39 +00:00
2026-10-22 21:30:39 +00:00
2026-10-10 21:23:37 +02:00
2026-10-10 21:23:37 +02:00
2026-10-10 21:23:37 +02:00
2026-10-10 21:23:37 +02:00
2026-10-22 21:30:39 +00:00
2026-11-03 23:38:52 +00:00
2026-10-10 21:23:37 +02:00
2026-10-10 21:23:37 +02:00
2026-10-12 21:13:57 +00:00
2026-10-10 21:23:37 +02:00
2026-10-10 21:23:37 +02:00
2026-10-23 21:01:13 +02:00
2026-11-04 22:45:31 -03:00
2026-10-22 21:30:12 +00:00
2026-11-01 18:11:43 +01:00
2026-10-10 21:23:37 +02:00
2026-10-10 21:23:37 +02:00
2026-10-10 21:23:37 +02:00
2026-10-10 21:23:37 +02:00
2026-10-25 10:51:57 +01:00
2026-10-22 21:34:14 +00:00
2026-10-10 21:23:37 +02:00
2026-10-25 00:46:24 +00:00
2026-10-10 21:23:37 +02:00
2026-10-22 21:30:39 +00:00
2026-10-22 21:30:39 +00:00
2026-10-10 21:23:37 +02:00
2026-10-20 15:22:55 +02:00
2026-10-20 15:22:55 +02:00
2026-10-20 16:30:55 +02:00
2026-10-20 15:22:55 +02:00
2026-10-23 21:01:13 +02:00
2026-10-20 15:23:55 +02:00
2026-10-20 17:00:27 +02:00
2026-10-20 16:30:55 +02:00
2026-10-20 17:00:27 +02:00
2026-10-23 21:59:02 +02:00
2026-10-20 15:14:30 +02:00
2026-10-23 21:59:02 +02:00
2026-10-20 15:14:01 +02:00
2026-10-21 21:16:36 +02:00
2026-10-20 18:19:00 +02:00
2026-10-20 15:14:29 +02:00
2026-10-21 21:16:36 +02:00
2026-10-22 22:29:35 +02:00
2026-10-22 22:29:35 +02:00
2026-10-23 21:59:02 +02:00
2026-10-27 15:02:24 +01:00
2026-10-20 18:40:48 +02:00
2026-10-20 16:30:55 +02:00
2026-10-20 15:11:08 +02:00
2026-10-20 21:12:09 +02:00
2026-10-20 10:37:29 +02:00
2026-10-20 15:35:08 +02:00
2026-10-20 16:30:55 +02:00
2026-10-23 19:13:51 +02:00
2026-10-20 21:15:45 +02:00
2026-10-23 21:58:43 +02:00
2026-10-24 13:54:48 +02:00
2026-10-19 10:22:04 +02:00
2026-10-20 15:06:01 +02:00
2026-10-23 21:59:02 +02:00
2026-10-23 22:00:05 +02:00
2026-10-24 02:18:08 +00:00
2026-10-23 22:00:05 +02:00
2026-10-26 12:47:09 +01:00
2026-10-23 21:59:02 +02:00
2026-10-20 21:12:09 +02:00
2026-10-20 07:09:56 +00:00
2026-10-21 13:53:21 +02:00
2026-10-20 07:09:57 +00:00
2026-10-20 07:09:57 +00:00
2026-10-20 07:09:57 +00:00
2026-10-23 21:59:43 +02:00
2026-10-20 15:30:18 +02:00
2026-11-03 20:42:14 +01:00
2026-11-01 16:18:21 +01:00
2026-10-23 18:21:54 +02:00
2026-10-17 02:07:22 +00:00
2026-10-17 02:31:01 +00:00
2026-10-20 17:51:27 +02:00
2026-10-16 23:14:52 +02:00
2026-10-20 21:43:47 +02:00
2026-10-20 18:19:00 +02:00
2026-10-20 07:09:57 +00:00
2026-10-27 21:30:18 +01:00
2026-10-28 08:01:53 +02:00
2026-10-29 15:36:37 +01:00
2026-10-31 03:25:56 +00:00
2026-10-10 21:23:37 +02:00
2026-11-01 13:59:28 +01:00
2026-10-20 21:12:09 +02:00
2026-10-31 03:25:56 +00:00
2026-10-20 21:15:21 +02:00
2026-10-10 21:23:37 +02:00
2026-10-10 21:23:37 +02:00
2026-10-10 21:23:37 +02:00
2026-10-22 21:51:44 +00:00
2026-10-24 08:58:56 +02:00
2026-10-18 20:02:09 +02:00
2026-11-01 16:18:21 +01:00
2026-10-10 21:23:37 +02:00
2026-11-01 16:18:21 +01:00
2026-10-10 20:16:06 +02:00
2026-11-01 16:18:21 +01:00
2026-10-12 21:13:57 +00:00
2026-10-20 15:35:08 +02:00
2026-10-20 07:09:56 +00:00
2026-10-12 21:13:57 +00:00
2026-11-01 16:18:21 +01:00
2026-10-10 21:23:37 +02:00
2026-11-01 18:46:58 +01:00
2026-11-01 16:18:21 +01:00
2026-10-12 14:12:36 +02:00
2026-10-22 21:31:23 +00:00
2026-10-24 17:31:47 +02:00
2026-10-10 21:23:37 +02:00
2026-10-10 21:23:37 +02:00
2026-10-20 15:35:32 +02:00
2026-10-20 15:35:32 +02:00
2026-10-20 15:35:32 +02:00
2026-10-20 16:30:55 +02:00
2026-10-26 01:03:35 +01:00
2026-10-25 18:59:43 +01:00
2026-10-16 23:44:58 +02:00
2026-10-10 21:23:37 +02:00
2026-10-10 21:23:37 +02:00
2026-10-10 21:23:37 +02:00
2026-10-10 21:23:37 +02:00
2026-10-10 21:23:37 +02:00