-- Rollback Phase 3: External Role Management - Module System

-- ============================================
-- DROP: New module system tables
-- ============================================
DROP TABLE IF EXISTS role_module_variant_mapping;
DROP TABLE IF EXISTS module_variants;
DROP TABLE IF EXISTS role_module_widgets;
DROP TABLE IF EXISTS role_module_permissions;
DROP TABLE IF EXISTS module_actions;
DROP TABLE IF EXISTS role_module_access;
DROP TABLE IF EXISTS modules;
DROP TABLE IF EXISTS persona_types;

-- ============================================
-- REMOVE COLUMNS FROM ROLES
-- ============================================
ALTER TABLE roles DROP COLUMN IF EXISTS persona_type;
ALTER TABLE roles DROP COLUMN IF EXISTS onboarding_schema_key;
ALTER TABLE roles DROP COLUMN IF EXISTS verification_required;
ALTER TABLE roles DROP COLUMN IF EXISTS switch_services_enabled;
ALTER TABLE roles DROP COLUMN IF EXISTS is_publicly_discoverable;
ALTER TABLE roles DROP COLUMN IF EXISTS external_role_description;
ALTER TABLE roles DROP COLUMN IF EXISTS sort_order;
