Files
lasuite-drive/bin/clear_records.sql
T
Julien Maupetit d314565644 🔨(project) improve psql script
Make psql script more versatile and avoid unnecessary environment
variables parsing.
2026-09-09 11:07:24 +02:00

10 lines
337 B
SQL

DO $$
DECLARE r RECORD;
BEGIN
FOR r IN (SELECT tablename FROM pg_tables WHERE schemaname = 'public' AND tablename != 'django_migrations' AND tablename != 'django_site')
LOOP
RAISE NOTICE 'Truncating table %', r.tablename;
EXECUTE 'TRUNCATE TABLE ' || quote_ident(r.tablename) || ' CASCADE';
END LOOP;
END $$;