-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreset.sql
More file actions
19 lines (16 loc) · 913 Bytes
/
reset.sql
File metadata and controls
19 lines (16 loc) · 913 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
-- =============================================
-- Aegis: Full Reset — Drop all tables, functions & policies
-- Run this to wipe the schema entirely, then re-run seed.sql
-- =============================================
-- 1. Drop RLS policies (must drop before tables)
DROP POLICY IF EXISTS "Service role can read customers" ON customers;
DROP POLICY IF EXISTS "Service role can read billing" ON billing;
DROP POLICY IF EXISTS "Service role can read support_tickets" ON support_tickets;
DROP POLICY IF EXISTS "Service role can read internal_docs" ON internal_docs;
-- 2. Drop the read-only RPC function
DROP FUNCTION IF EXISTS execute_readonly_query(TEXT);
-- 3. Drop tables in reverse FK dependency order
DROP TABLE IF EXISTS support_tickets CASCADE;
DROP TABLE IF EXISTS billing CASCADE;
DROP TABLE IF EXISTS internal_docs CASCADE;
DROP TABLE IF EXISTS customers CASCADE;