mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-21 06:21:39 +03:00
91710bba58
While debugging issues with HLS, Reed Mullanix noticed that we don't use relative paths. This leads to problems when using HLS + Emacs due to a bug in `lsp-mode` which prevents it from finding the correct project root. However, it is still a good practice to use relative paths in TH for other reasons, including being able to import these modules in GHCI. This PR should make it so HLS-1.0 & emacs provide type inference, imports, etc., in all modules in our codebase. GitOrigin-RevId: 5f53b9a7ccf46df1ea7be94ff0a5c6ec861f4ead
27 lines
1.1 KiB
Haskell
27 lines
1.1 KiB
Haskell
-- | A module that defines the current catalog version and nothing else. This is necessary to
|
|
-- circumvent the unfortunate “GHC stage restriction,” which prevents us from using a binding in a
|
|
-- compile-time splice unless it is defined in a different module. The actual migration code is in
|
|
-- "Hasura.Server.Migrate".
|
|
module Hasura.Server.Migrate.Version
|
|
( latestCatalogVersion
|
|
, latestCatalogVersionString
|
|
) where
|
|
|
|
import Hasura.Prelude
|
|
|
|
import qualified Data.Text as T
|
|
import qualified Language.Haskell.TH.Syntax as TH
|
|
|
|
import Data.FileEmbed (embedStringFile, makeRelativeToProject)
|
|
|
|
-- | The current catalog schema version. We store this in a file
|
|
-- because we want to append the current verson to the catalog_versions file
|
|
-- when tagging a new release, in @tag-release.sh@.
|
|
latestCatalogVersion :: Integer
|
|
latestCatalogVersion =
|
|
$(do let s = $(makeRelativeToProject "src-rsr/catalog_version.txt" >>= embedStringFile)
|
|
TH.lift (read s :: Integer))
|
|
|
|
latestCatalogVersionString :: Text
|
|
latestCatalogVersionString = T.pack $ show latestCatalogVersion
|