File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change 19
19
@echo " test - Run tests"
20
20
@echo " pg_tap - Run pg_tap tests"
21
21
22
+ # Reset database
23
+ .PHONY : reset-database
24
+ reset-database :
25
+ @echo " Resetting..."
26
+ PGPASSWORD=$(PG_PASSWORD ) psql -h $(PG_HOST ) -p $(PG_PORT ) -U $(PG_USER ) -d $(PG_DB ) -v ON_ERROR_STOP=1 -f $(TEST_DIR ) /reset.sql
27
+
22
28
# Set up Supabase
23
29
.PHONY : setup-supabase
24
30
setup-supabase :
Original file line number Diff line number Diff line change
1
+ -- KeyHippo Database Reset Script
2
+ -- Drop schemas
3
+ DROP TABLE IF EXISTS public .test_accounts CASCADE;
4
+
5
+ DROP SCHEMA IF EXISTS keyhippo CASCADE;
6
+
7
+ DROP SCHEMA IF EXISTS keyhippo_internal CASCADE;
8
+
9
+ DROP SCHEMA IF EXISTS keyhippo_rbac CASCADE;
10
+
11
+ DROP SCHEMA IF EXISTS keyhippo_impersonation CASCADE;
12
+
13
+ -- Drop custom types
14
+ DROP TYPE IF EXISTS keyhippo .app_permission CASCADE;
15
+
16
+ DROP TYPE IF EXISTS keyhippo .app_role CASCADE;
17
+
18
+ -- Delete all rows from auth.users
19
+ DELETE FROM auth .users ;
20
+
21
+ -- Drop the trigger on auth.users
22
+ DROP TRIGGER IF EXISTS assign_default_role_trigger ON auth .users ;
23
+
24
+ -- Notify PostgREST to reload configuration
25
+ NOTIFY pgrst,
26
+ ' reload config' ;
You can’t perform that action at this time.
0 commit comments