Skip to content

Commit

Permalink
Add dropping all data types from database on clean DB functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
dagual authored Oct 11, 2023
1 parent 87d3688 commit 4869fec
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/lib/dbAdapters/postgresql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,16 @@ BEGIN
EXECUTE 'DROP SEQUENCE IF EXISTS ' || quote_ident(r.relname) || ' CASCADE';
END LOOP;
END $$;
-- Dropping all data types from database
DO $$ DECLARE
r RECORD;
BEGIN
FOR r IN (SELECT typname FROM pg_type WHERE typnamespace = (SELECT oid FROM pg_namespace WHERE nspname = current_schema())) LOOP
EXECUTE 'DROP TYPE IF EXISTS ' || quote_ident(r.typname) || ' CASCADE';
END LOOP;
END $$;
`;
}
}

0 comments on commit 4869fec

Please sign in to comment.