mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-17 20:41:49 +03:00
16 lines
415 B
Haskell
16 lines
415 B
Haskell
{-# LANGUAGE OverloadedStrings #-}
|
|
|
|
module Hasura.RQL.DDL.Utils where
|
|
|
|
import qualified Database.PG.Query as Q
|
|
|
|
clearHdbViews :: Q.Query
|
|
clearHdbViews =
|
|
"DO $$ DECLARE \
|
|
\ r RECORD; \
|
|
\ BEGIN \
|
|
\ FOR r IN (SELECT viewname FROM pg_views WHERE schemaname = 'hdb_views') LOOP \
|
|
\ EXECUTE 'DROP VIEW IF EXISTS hdb_views.' || quote_ident(r.viewname) || ' CASCADE'; \
|
|
\ END LOOP; \
|
|
\ END $$ "
|