-- Drop view
DROP VIEW IF EXISTS function_stats;

-- Drop triggers
DROP TRIGGER IF EXISTS update_functions_updated_at ON functions;
DROP FUNCTION IF EXISTS update_updated_at_column();

-- Drop indexes
DROP INDEX IF EXISTS idx_executions_created_at;
DROP INDEX IF EXISTS idx_executions_executor_id;
DROP INDEX IF EXISTS idx_executions_status;
DROP INDEX IF EXISTS idx_executions_function_id;

DROP INDEX IF EXISTS idx_functions_created_at;
DROP INDEX IF EXISTS idx_functions_runtime;
DROP INDEX IF EXISTS idx_functions_app_id;

-- Drop tables
DROP TABLE IF EXISTS executions;
DROP TABLE IF EXISTS functions;

-- Drop extension (only if no other tables use it)
-- DROP EXTENSION IF EXISTS "uuid-ossp";