-- Migration: 001_initial_schema (DOWN)
-- Drop all tables and extensions created in the up migration

-- Drop tables in reverse order of creation (due to foreign key constraints)
DROP TABLE IF EXISTS granted_permissions;
DROP TABLE IF EXISTS static_tokens;
DROP TABLE IF EXISTS available_permissions;
DROP TABLE IF EXISTS applications;

-- Drop triggers and functions
DROP TRIGGER IF EXISTS update_applications_updated_at ON applications;
DROP TRIGGER IF EXISTS update_static_tokens_updated_at ON static_tokens;
DROP TRIGGER IF EXISTS update_available_permissions_updated_at ON available_permissions;
DROP FUNCTION IF EXISTS update_updated_at_column();

-- Drop extension (be careful with this in production)
-- DROP EXTENSION IF EXISTS "uuid-ossp";
