From 323679e7716ca5ffda93526b165230a217f24e58 Mon Sep 17 00:00:00 2001 From: Miguel Ribeiro Date: Wed, 14 Feb 2024 16:54:16 +0100 Subject: [PATCH] Automatically run migration script when loading the registration page. --- .gitignore | 1 + scripts/registration.js | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/.gitignore b/.gitignore index 7506f36..9143a9f 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ !/images/uploads/logos/wallos.png .DS_Store .idea/ +.vscode/ diff --git a/scripts/registration.js b/scripts/registration.js index 3c7545b..5bd231a 100644 --- a/scripts/registration.js +++ b/scripts/registration.js @@ -52,7 +52,18 @@ function changeLanguage(selectedLanguage) { location.reload(); } +function runDatabaseMigration() { + let url = "endpoints/db/migrate.php"; + fetch(url) + .then(response => { + if (!response.ok) { + throw new Error(translate('network_response_error')); + } + }); +} + window.onload = function () { restoreFormFields(); removeFromStorage(); + runDatabaseMigration(); }; \ No newline at end of file