# Decision: incremental pull of configurations and projects via server_updated_at **Date:** 2026-10-26 **Status:** active ## Context Opening the configurations or projects list (`GET /api/configs`, `/api/projects`, `/api/projects/:uuid/configs`, on-demand with a 30s cooldown) and the manual sync ran `ImportConfigurationsToLocal` / `ImportProjectsToLocal`, which read **every** server row and rewrote it locally. Measured on production (2026-10-26): configurations 22.2s (4158 rows, ~3.2 MB, 4078 rewritten for one actual change), projects 4.6s (1692 rows), holding a pool connection the whole time. `qt_configurations` had no change column; `qt_projects.updated_at` is set by clients (`SaveProjectPreservingUpdatedAt`), so a change made offline and pushed later carries an old timestamp and cannot drive a filter. ## Decision - Server migration `035_add_server_updated_at.sql` adds `server_updated_at TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6)` plus index `(server_updated_at, id)` to `qt_configurations` and `qt_projects`. MariaDB maintains it; no client writes it and it is **not** in `models.Configuration` / `models.Project`, so writes from any client version (GORM `Create`/`Save`, raw `UPDATE` with column lists) keep working and bump the marker on every real change. - Client (`internal/services/sync/pull_cursor.go`): - if the column is missing (server not migrated yet) every pull is full, exactly as before; presence is re-checked until found, then cached for the process; - the first pull of each table per process is full (restores rows lost locally once per app start), later pulls read `server_updated_at >= cursor - 120s` in one query; - the cursor is the server's `NOW(6)` read *before* the pull, stored in `app_settings` (`server_pull_cursor: