postgres-commands
Postgresql Drop All Tables

drop all tables inside postgress database.

vercel postgress
DO
$$ DECLARE
r RECORD;
BEGIN
FOR r IN (SELECT schemaname, tablename FROM pg_tables WHERE schemaname NOT IN ('pg_catalog', 'information_schema')) LOOP
    EXECUTE 'DROP TABLE IF EXISTS ' || quote_ident(r.schemaname) || '.' || quote_ident(r.tablename) || ' CASCADE';
END LOOP;

END $$;