feat(schema): consolidate the 2.x migration chain into one guarded base migration

A single consolidation migration replaces the 150 removed historical files.
It decides — from reads alone — whether to build the boundary schema fresh,
skip on a fully-migrated 2.x database, or refuse a partial or inconsistent
history untouched. Fresh installs run it first and the live v3 chain after;
pre-2.x installs are directed through the latest 2.x release. The same
verdict backs a self-updater preflight so an unsafe upgrade is refused
before any file is copied. Schema verified identical to the boundary
fixtures on SQLite, MariaDB and PostgreSQL.
This commit is contained in:
Darko Gjorgjijoski
2026-08-20 19:17:28 +02:00
parent 721e21beef
commit 04af1e5c73
7 changed files with 9800 additions and 1 deletions
@@ -95,11 +95,25 @@ class UpdateController extends Controller
return response()->json(Updater::cleanStaleFiles());
}
/**
* Run the pending migrations, unless the schema guard refuses first.
*
* A refusal is the operator's problem to fix, not a crash: it comes back
* with the guard's explanation in the same shape the unzip step uses for
* its own failures.
*/
public function migrate(Request $request): JsonResponse
{
$this->authorizeUpdates();
Updater::migrateUpdate();
try {
Updater::migrateUpdate();
} catch (Exception $failure) {
return response()->json([
'success' => false,
'error' => $failure->getMessage(),
], 500);
}
return response()->json(['success' => true]);
}