-- Script para limpar tabelas de módulos de negócio
-- Manter apenas: users, password_resets, failed_jobs, personal_access_tokens, permissions, roles, model_has_permissions, model_has_roles, role_has_permissions

-- Lista de tabelas a manter
SET @tables_to_keep = 'users,password_resets,failed_jobs,personal_access_tokens,permissions,roles,model_has_permissions,model_has_roles,role_has_permissions,migrations';

-- Gerar comandos DROP para todas as outras tabelas
SET @sql = (
    SELECT GROUP_CONCAT(
        CONCAT('DROP TABLE IF EXISTS `', table_name, '`;')
        SEPARATOR '\n'
    )
    FROM information_schema.tables
    WHERE table_schema = DATABASE()
    AND table_name NOT IN (
        'users', 'password_resets', 'failed_jobs', 'personal_access_tokens',
        'permissions', 'roles', 'model_has_permissions', 'model_has_roles', 
        'role_has_permissions', 'migrations'
    )
);

-- Executar (descomentar para executar)
-- PREPARE stmt FROM @sql;
-- EXECUTE stmt;
-- DEALLOCATE PREPARE stmt;

SELECT @sql AS drop_commands;
