From d9897c57eb8e2115d393559991be42e90b8701bc Mon Sep 17 00:00:00 2001 From: asohh Date: Sun, 12 Oct 2025 11:26:00 +0200 Subject: [PATCH] added querry to check if the state sequenceNumber is already present --- utils/init_db.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/utils/init_db.php b/utils/init_db.php index aa1d078..a0f98e2 100644 --- a/utils/init_db.php +++ b/utils/init_db.php @@ -68,7 +68,14 @@ CREATE TABLE IF NOT EXISTS sync_state ( v VARCHAR(100) ) "); + +$result = $conn -> query("SELECT * FROM sync_state WHERE k='sequenceNumber'"); + +$table_count = $result -> num_rows; + +if ($table_count == 0){ $conn->query("INSERT INTO sync_state (k, v) VALUES ('sequenceNumber', '0');"); +} echo "Database, users, and tables created successfully.\n";