Skip to content

Wallos: Open-source, self-hostable personal subscription tracker. Visualize your recurring expenses, manage your budget, and save money.

Make DB migrator work for both docker and baremetal

ellite98e97ef08db4
diff --git a/endpoints/db/migrate.php b/endpoints/db/migrate.php
index b8eeea5..b4a9b9b 100644
--- a/endpoints/db/migrate.php
+++ b/endpoints/db/migrate.php
@@ -1,6 +1,20 @@
<?php
+function errorHandler($severity, $message, $file, $line) {
+ throw new ErrorException($message, 0, $severity, $file, $line);
+}
+
+// Set the custom error handler
+set_error_handler('errorHandler');
/** @var \SQLite3 $db */
-require_once 'includes/connect.php';
+try {
+ require_once 'includes/connect_endpoint_crontabs.php';
+} catch (Exception $e) {
+ require_once '../../includes/connect_endpoint.php';
+} finally {
+ // Restore the default error handler
+ restore_error_handler();
+}
+
$completedMigrations = [];