-- Migration: Drop duplicate audit tables from public schema
-- Description: Audit tables were created in both 'audit' schema and 'public' schema.
--              This migration drops the duplicate tables from public schema to avoid conflicts.

BEGIN;

-- Drop duplicate audit tables from public schema
-- These tables should only exist in the 'audit' schema

DROP TABLE IF EXISTS public.auth_audit_logs CASCADE;
DROP TABLE IF EXISTS public.refresh_token_audit_logs CASCADE;
DROP TABLE IF EXISTS public.entity_change_logs CASCADE;
DROP TABLE IF EXISTS public.system_audit_logs CASCADE;

-- Drop default view tables from public schema (if they exist)
DROP TABLE IF EXISTS public.auth_audit_logs_default CASCADE;
DROP TABLE IF EXISTS public.refresh_token_audit_logs_default CASCADE;
DROP TABLE IF EXISTS public.entity_change_logs_default CASCADE;
DROP TABLE IF EXISTS public.system_audit_logs_default CASCADE;

COMMIT;
