-- MSIN-4401 — Flag comptes créés via invitation promoteur
-- Idempotent. Safe pilote.

SET @col_exists := (
  SELECT COUNT(*) FROM information_schema.COLUMNS
  WHERE TABLE_SCHEMA = DATABASE()
    AND TABLE_NAME = 'inscriptions_comptes'
    AND COLUMN_NAME = 'com_invite_team'
);
SET @ddl := IF(@col_exists = 0,
  'ALTER TABLE `inscriptions_comptes` ADD COLUMN `com_invite_team` tinyint(1) unsigned NOT NULL DEFAULT 0 COMMENT ''MSIN-4401 compte cree via invitation promoteur acces v2'' AFTER `com_actif`',
  'DO 0');
PREPARE stmt FROM @ddl;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
