Files
Vivier/sql/migration-1.0-vers-1.1.sql
T

63 lines
2.9 KiB
SQL

-- Vivier : passage d'une base 1.0 à 1.1
-- À exécuter une seule fois dans phpMyAdmin, sur une base créée avec l'ancien schema.sql.
-- Ensuite, dans Vivier : menu Comptes, bouton « Réindexer tous les profils ».
SET NAMES utf8mb4;
ALTER TABLE candidats
ADD COLUMN niveau_etudes VARCHAR(20) NULL AFTER disponibilite,
ADD COLUMN encadrement TINYINT(1) NULL AFTER niveau_etudes;
-- ---------------------------------------------------------------
-- Mots-clés et métadonnées de recherche
-- Fournis par l'analyse (manuel = 0) ou ajoutés à la main sur la fiche (manuel = 1).
-- ---------------------------------------------------------------
CREATE TABLE mots_cles (
id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
candidat_id INT UNSIGNED NOT NULL,
type ENUM('role','specialite','secteur','mot_cle') NOT NULL,
mot VARCHAR(80) NOT NULL,
manuel TINYINT(1) NOT NULL DEFAULT 0,
UNIQUE KEY uq_mot (candidat_id, type, mot),
CONSTRAINT fk_mot_candidat FOREIGN KEY (candidat_id) REFERENCES candidats(id) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- ---------------------------------------------------------------
-- Index de recherche : un terme normalisé par ligne, avec son poids.
-- Reconstruit par PHP à chaque import ou modification d'un profil.
-- ---------------------------------------------------------------
CREATE TABLE index_recherche (
candidat_id INT UNSIGNED NOT NULL,
terme VARCHAR(60) CHARACTER SET ascii COLLATE ascii_bin NOT NULL,
poids SMALLINT UNSIGNED NOT NULL,
PRIMARY KEY (candidat_id, terme),
KEY idx_terme (terme),
CONSTRAINT fk_index_candidat FOREIGN KEY (candidat_id) REFERENCES candidats(id) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- ---------------------------------------------------------------
-- Échecs de connexion récents : blocage temporaire après 5 essais
-- ---------------------------------------------------------------
CREATE TABLE tentatives_connexion (
id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
cle VARCHAR(190) NOT NULL,
moment DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
KEY idx_cle (cle, moment)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
INSERT INTO synonymes_recherche (terme, cible_type, cible) VALUES
('développeuse','texte', 'développeur'),
('fullstack','texte', 'full-stack'),
('backend', 'texte', 'back-end'),
('frontend','texte', 'front-end'),
('js', 'texte', 'javascript'),
('ts', 'texte', 'typescript'),
('postgres','texte', 'postgresql'),
('k8s', 'texte', 'kubernetes'),
('po', 'texte', 'product owner'),
('pm', 'texte', 'chef de projet'),
('lead', 'texte', 'technical lead'),
('architect','texte', 'architecte'),
('tester', 'texte', 'testeur'),
('qa', 'texte', 'test');