-- Version: 20260629181500
-- Objetivo: agregar columna JSON maincompany.ui_mobile_layouts (si no existe)

SET @db_name := DATABASE();

SET @column_exists := (
  SELECT COUNT(*)
  FROM information_schema.COLUMNS
  WHERE TABLE_SCHEMA = @db_name
    AND TABLE_NAME = 'maincompany'
    AND COLUMN_NAME = 'ui_mobile_layouts'
);

SET @sql := IF(
  @column_exists = 0,
  'ALTER TABLE `maincompany` ADD `ui_mobile_layouts` JSON DEFAULT NULL',
  'SELECT ''Column ui_mobile_layouts already exists'' AS info'
);

PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;

