mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-18 04:51:35 +03:00
b167120f96
We'll see if this improves compile times at all, but I think it's worth doing as at least the most minimal form of module documentation. This was accomplished by first compiling everything with -ddump-minimal-imports, and then a bunch of scripting (with help from ormolu) **EDIT** it doesn't seem to improve CI compile times but the noise floor is high as it looks like we're not caching library dependencies anymore PR-URL: https://github.com/hasura/graphql-engine-mono/pull/2730 GitOrigin-RevId: 667eb8de1e0f1af70420cbec90402922b8b84cb4
42 lines
1.1 KiB
Haskell
42 lines
1.1 KiB
Haskell
module Hasura.Backends.Postgres.DDL.Source.Version
|
|
( getSourceCatalogVersion,
|
|
latestSourceCatalogVersion,
|
|
latestSourceCatalogVersionText,
|
|
setSourceCatalogVersion,
|
|
)
|
|
where
|
|
|
|
import Database.PG.Query qualified as Q
|
|
import Hasura.Backends.Postgres.Connection
|
|
import Hasura.Prelude
|
|
|
|
latestSourceCatalogVersion :: Integer
|
|
latestSourceCatalogVersion = 2
|
|
|
|
latestSourceCatalogVersionText :: Text
|
|
latestSourceCatalogVersionText = tshow latestSourceCatalogVersion
|
|
|
|
setSourceCatalogVersion :: MonadTx m => m ()
|
|
setSourceCatalogVersion =
|
|
liftTx $
|
|
Q.unitQE
|
|
defaultTxErrorHandler
|
|
[Q.sql|
|
|
INSERT INTO hdb_catalog.hdb_source_catalog_version(version, upgraded_on)
|
|
VALUES ($1, NOW())
|
|
ON CONFLICT ((version IS NOT NULL))
|
|
DO UPDATE SET version = $1, upgraded_on = NOW()
|
|
|]
|
|
(Identity latestSourceCatalogVersionText)
|
|
False
|
|
|
|
getSourceCatalogVersion :: MonadTx m => m Text
|
|
getSourceCatalogVersion =
|
|
liftTx $
|
|
runIdentity . Q.getRow
|
|
<$> Q.withQE
|
|
defaultTxErrorHandler
|
|
[Q.sql| SELECT version FROM hdb_catalog.hdb_source_catalog_version |]
|
|
()
|
|
False
|