2018-06-27 16:11:32 +03:00
|
|
|
module Hasura.RQL.DDL.Deps
|
2021-09-24 01:56:37 +03:00
|
|
|
( reportDeps,
|
|
|
|
reportDepsExt,
|
|
|
|
)
|
|
|
|
where
|
2018-06-27 16:11:32 +03:00
|
|
|
|
2021-09-24 01:56:37 +03:00
|
|
|
import Data.Text.Extended
|
|
|
|
import Hasura.Base.Error
|
|
|
|
import Hasura.Prelude
|
|
|
|
import Hasura.RQL.Types
|
2021-05-11 18:18:31 +03:00
|
|
|
|
2018-06-27 16:11:32 +03:00
|
|
|
reportDeps :: (QErrM m) => [SchemaObjId] -> m ()
|
|
|
|
reportDeps deps =
|
|
|
|
throw400 DependencyError $
|
|
|
|
"cannot drop due to the following dependent objects : "
|
2021-09-24 01:56:37 +03:00
|
|
|
<> reportSchemaObjs deps
|
2018-06-27 16:11:32 +03:00
|
|
|
|
2020-10-27 16:53:49 +03:00
|
|
|
reportDepsExt :: (QErrM m) => [SchemaObjId] -> [Text] -> m ()
|
2018-06-27 16:11:32 +03:00
|
|
|
reportDepsExt deps unknownDeps =
|
|
|
|
throw400 DependencyError $
|
|
|
|
"cannot drop due to the following dependent objects : " <> depObjsTxt
|
|
|
|
where
|
2021-09-24 01:56:37 +03:00
|
|
|
depObjsTxt = commaSeparated $ reportSchemaObjs deps : unknownDeps
|