-- Migration 0071 : Ajout du visa responsable sur chiffrage_entete
-- Permet au responsable d'apposer son visa sur un chiffrage validé

IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'chiffrage_entete')
   AND NOT EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'chiffrage_entete' AND COLUMN_NAME = 'visa_par')
BEGIN
    EXEC('ALTER TABLE chiffrage_entete ADD visa_par NUMERIC(12,0) NULL DEFAULT NULL');
    EXEC('ALTER TABLE chiffrage_entete ADD visa_nom VARCHAR(100) NULL DEFAULT NULL');
    EXEC('ALTER TABLE chiffrage_entete ADD visa_date DATETIME NULL DEFAULT NULL');
    EXEC('ALTER TABLE chiffrage_entete ADD visa_commentaire VARCHAR(500) NULL DEFAULT NULL');
    PRINT 'Colonnes visa ajoutees a chiffrage_entete';
END

PRINT 'Migration 0071 terminee';
