2019-10-11 08:13:57 +03:00
|
|
|
-- | 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
|
2019-10-21 19:01:05 +03:00
|
|
|
-- "Hasura.Server.Migrate".
|
|
|
|
module Hasura.Server.Migrate.Version
|
2019-10-11 08:13:57 +03:00
|
|
|
( latestCatalogVersion
|
|
|
|
, latestCatalogVersionString
|
|
|
|
) where
|
|
|
|
|
|
|
|
import Hasura.Prelude
|
|
|
|
|
2020-02-24 17:33:56 +03:00
|
|
|
import qualified Data.Text as T
|
|
|
|
import qualified Language.Haskell.TH.Syntax as TH
|
2019-10-11 08:13:57 +03:00
|
|
|
|
2021-03-16 20:35:35 +03:00
|
|
|
import Data.FileEmbed (embedStringFile, makeRelativeToProject)
|
2020-02-24 17:33:56 +03:00
|
|
|
|
|
|
|
-- | The current catalog schema version. We store this in a file
|
|
|
|
-- because we want to append the current verson to the catalog_versions file
|
2020-05-13 15:33:16 +03:00
|
|
|
-- when tagging a new release, in @tag-release.sh@.
|
2019-10-11 08:13:57 +03:00
|
|
|
latestCatalogVersion :: Integer
|
2020-05-13 15:33:16 +03:00
|
|
|
latestCatalogVersion =
|
2021-03-16 20:35:35 +03:00
|
|
|
$(do let s = $(makeRelativeToProject "src-rsr/catalog_version.txt" >>= embedStringFile)
|
2020-05-13 15:33:16 +03:00
|
|
|
TH.lift (read s :: Integer))
|
2019-10-11 08:13:57 +03:00
|
|
|
|
2020-10-27 16:53:49 +03:00
|
|
|
latestCatalogVersionString :: Text
|
2019-10-11 08:13:57 +03:00
|
|
|
latestCatalogVersionString = T.pack $ show latestCatalogVersion
|