Maj SQL
This commit is contained in:
1 parent
5c43bf9e7c
commit
be12cadea6
1 file changed
+46
-15
+46
-15
@@ -219,18 +219,6 @@ created_at DATETIME DEFAULT CURRENT_TIMESTAMP
|
|||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- 8. RATE LIMITING DE CONNEXION (durcissement securite du 20/09/2026)
|
-- 8. RATE LIMITING DE CONNEXION (durcissement securite du 20/09/2026)
|
||||||
--
|
|
||||||
-- Compteur d'echecs de connexion stocke en base (et non en session
|
|
||||||
-- PHP), afin qu'un attaquant ne puisse pas remettre son compteur a
|
|
||||||
-- zero en vidant ses cookies ou en ouvrant une navigation privee.
|
|
||||||
-- Utilise par admin/admin_auth.php (is_login_locked_out,
|
|
||||||
-- record_login_attempt) et admin/login.php.
|
|
||||||
--
|
|
||||||
-- Deux seuils appliques cote PHP a partir de cette meme table :
|
|
||||||
-- - 5 echecs sur le couple (identifiant, IP) en 15 min -> verrouillage cible
|
|
||||||
-- - 30 echecs sur l'IP seule (tous identifiants confondus) en 15 min
|
|
||||||
-- -> verrouillage large, plus permissif pour ne pas bloquer tout
|
|
||||||
-- le monde depuis une IP partagee (ex: sortie Tailscale commune)
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
CREATE TABLE IF NOT EXISTS login_attempts (
|
CREATE TABLE IF NOT EXISTS login_attempts (
|
||||||
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||||
@@ -244,10 +232,53 @@ KEY idx_username_ip_time (username_normalized, ip_address, attempted_at),
|
|||||||
KEY idx_ip_time (ip_address, attempted_at)
|
KEY idx_ip_time (ip_address, attempted_at)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||||
|
|
||||||
-- Purge recommandee via cron (pas dans ce fichier), pour eviter que
|
-- ---------------------------------------------------------------------
|
||||||
-- la table ne grossisse indefiniment :
|
-- 9. TABLES ADDITIONNELLES (Couches, Backups, Historique d'imports)
|
||||||
-- DELETE FROM login_attempts WHERE attempted_at < NOW() - INTERVAL 30 DAY;
|
-- ---------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Pour admin/map_layers.php
|
||||||
|
CREATE TABLE IF NOT EXISTS map_layers (
|
||||||
|
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
name VARCHAR(100) NOT NULL,
|
||||||
|
layer_key VARCHAR(50) NOT NULL,
|
||||||
|
color VARCHAR(7) NOT NULL,
|
||||||
|
is_visible TINYINT(1) DEFAULT 1,
|
||||||
|
sort_order INT DEFAULT 0,
|
||||||
|
description TEXT
|
||||||
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
|
-- Pour admin/backup.php
|
||||||
|
CREATE TABLE IF NOT EXISTS backup_log (
|
||||||
|
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
admin_username VARCHAR(100) NOT NULL,
|
||||||
|
label VARCHAR(255) NOT NULL,
|
||||||
|
note TEXT,
|
||||||
|
size_bytes_reported BIGINT
|
||||||
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
|
-- Pour admin/import_history.php
|
||||||
|
CREATE TABLE IF NOT EXISTS import_batches (
|
||||||
|
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
filename VARCHAR(255) NOT NULL,
|
||||||
|
imported_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
imported_by VARCHAR(100),
|
||||||
|
status VARCHAR(50),
|
||||||
|
rows_total INT DEFAULT 0,
|
||||||
|
rows_imported INT DEFAULT 0,
|
||||||
|
rows_rejected INT DEFAULT 0,
|
||||||
|
country_id INT,
|
||||||
|
FOREIGN KEY (country_id) REFERENCES countries(id)
|
||||||
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS import_errors (
|
||||||
|
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
batch_id INT NOT NULL,
|
||||||
|
line_number INT,
|
||||||
|
message TEXT,
|
||||||
|
raw_line TEXT,
|
||||||
|
FOREIGN KEY (batch_id) REFERENCES import_batches(id) ON DELETE CASCADE
|
||||||
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- =====================================================================
|
-- =====================================================================
|
||||||
-- Fin du schema. A ce stade, la base contient :
|
-- Fin du schema. A ce stade, la base contient :
|
||||||
|
|||||||
Reference in new issue
Block a user