ALTER TABLE servers DROP CONSTRAINT IF EXISTS servers_etat_check;
UPDATE servers SET etat = 'production' WHERE etat = 'en_production';
UPDATE servers SET etat = 'implementation' WHERE etat IN ('en_implementation', 'en_cours');
UPDATE servers SET etat = 'obsolete' WHERE etat IN ('decommissionne', 'en_decommissionnement', 'eteint', 'eol');
ALTER TABLE servers ADD CONSTRAINT servers_etat_check CHECK (etat IN ('production', 'implementation', 'stock', 'obsolete'));
ALTER TABLE servers ALTER COLUMN etat SET DEFAULT 'production';
SELECT etat, COUNT(*) FROM servers GROUP BY etat ORDER BY 2 DESC;
