mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-02-16 18:52:06 +00:00
Format and style
Format SQL query in clean database, run npm run format
This commit is contained in:
@@ -10,16 +10,17 @@ const cleanDatabase = async () => {
|
||||
* schema then loops through each table and truncates it.
|
||||
*/
|
||||
await prisma.$executeRaw`
|
||||
DO $$
|
||||
DECLARE
|
||||
statements CURSOR FOR
|
||||
DO $$
|
||||
DECLARE
|
||||
statements CURSOR FOR
|
||||
SELECT tablename FROM pg_tables
|
||||
WHERE schemaname = 'public';
|
||||
BEGIN
|
||||
FOR statement IN statements LOOP
|
||||
EXECUTE 'TRUNCATE TABLE ' || quote_ident(statement.tablename) || ' CASCADE;';
|
||||
END LOOP;
|
||||
END;
|
||||
WHERE schemaname = 'public'
|
||||
AND tablename != '_prisma_migrations';
|
||||
BEGIN
|
||||
FOR statement IN statements LOOP
|
||||
EXECUTE 'TRUNCATE TABLE ' || quote_ident(statement.tablename) || ' CASCADE;';
|
||||
END LOOP;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
`;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user