mirror of
https://github.com/InvoiceShelf/InvoiceShelf.git
synced 2026-09-04 06:11:05 +00:00
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:
@@ -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]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user