From e6cf9b40aeb03cc6e6a9b44c40426ca83370f89d Mon Sep 17 00:00:00 2001 From: Esenjin Date: Thu, 9 Jan 2025 12:12:54 +0100 Subject: [PATCH] =?UTF-8?q?pr=C3=A9paration=20de=20l'impl=C3=A9mentation?= =?UTF-8?q?=20de=20gestion=20des=20logs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- init-db.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/init-db.php b/init-db.php index 1930a43..f3eeb37 100644 --- a/init-db.php +++ b/init-db.php @@ -47,10 +47,23 @@ if ($count === 0) { echo "Admin par défaut créé (username: admin, password: admin). Pensez à changer ces identifiants !"; } +// Après la création des tables existantes, ajouter : +$db->exec('CREATE TABLE IF NOT EXISTS admin_logs ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + admin_id INTEGER NOT NULL, + action_type TEXT NOT NULL, + action_description TEXT NOT NULL, + target_path TEXT, + created_at DATETIME DEFAULT CURRENT_TIMESTAMP, + FOREIGN KEY (admin_id) REFERENCES admins(id) +)'); + // Créer les index nécessaires $db->exec('CREATE INDEX IF NOT EXISTS idx_share_keys_expires_at ON share_keys(expires_at)'); $db->exec('CREATE INDEX IF NOT EXISTS idx_share_keys_album_identifier ON share_keys(album_identifier)'); $db->exec('CREATE INDEX IF NOT EXISTS idx_album_identifiers_identifier ON album_identifiers(identifier)'); +$db->exec('CREATE INDEX IF NOT EXISTS idx_admin_logs_admin_id ON admin_logs(admin_id)'); +$db->exec('CREATE INDEX IF NOT EXISTS idx_admin_logs_created_at ON admin_logs(created_at)'); $db->close(); echo "Base de données initialisée avec succès !";