Skip to content

Instantly share code, notes, and snippets.

@sawirricardo
Created May 23, 2025 02:18
Show Gist options
  • Save sawirricardo/e1b45302804fa19b527607093fafcea0 to your computer and use it in GitHub Desktop.
Save sawirricardo/e1b45302804fa19b527607093fafcea0 to your computer and use it in GitHub Desktop.
better alternative and more efficient db:wipe for postgres
--This is more efficient than cleaning views, tables and types like `db:wipe` does.
--This cleans up the whole schema, removing custom functions as well.
DROP SCHEMA public CASCADE;
CREATE SCHEMA public;
GRANT ALL ON SCHEMA public TO postgres;
GRANT ALL ON SCHEMA public TO public;
COMMENT ON SCHEMA public IS 'standard public schema';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment