mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-09-11 10:46:25 +03:00
Maintain downgrade commands in a text file, update when tagging (#3933)
This commit is contained in:
parent
2921a56808
commit
8df0151f99
@ -37,6 +37,10 @@ find "$ROOT/install-manifests" \
|
||||
-type f -exec sed -i -E \
|
||||
's#(hasura/graphql-engine:)v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(\-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?(.*)*$#\1'"${TAG}"'\9#' {} \;
|
||||
|
||||
# add the latest tag to the catalog_versions file
|
||||
[ -n "$(tail -c1 "$ROOT/src-rsr/catalog_versions.txt")" ] && echo >> "$ROOT/src-rsr/catalog_versions.txt"
|
||||
echo $TAG $(cat "$ROOT/src-rsr/catalog_version.txt") >> "$ROOT/src-rsr/catalog_versions.txt"
|
||||
|
||||
git add "$ROOT/install-manifests" \
|
||||
"$ROOT/scripts/cli-migrations"
|
||||
|
||||
|
@ -9,9 +9,11 @@ import qualified Data.String as DataString
|
||||
import qualified Data.Text as T
|
||||
import qualified Data.Text.Encoding as TE
|
||||
import qualified Database.PG.Query as Q
|
||||
import qualified Language.Haskell.TH.Syntax as TH
|
||||
import qualified Text.PrettyPrint.ANSI.Leijen as PP
|
||||
|
||||
import Data.Char (toLower)
|
||||
import Data.FileEmbed (embedStringFile)
|
||||
import Data.Time.Clock.Units (milliseconds)
|
||||
import Network.Wai.Handler.Warp (HostPreference)
|
||||
import Options.Applicative
|
||||
@ -1084,23 +1086,13 @@ serveOptionsParser =
|
||||
-- and catalog schema versions.
|
||||
downgradeShortcuts :: [(String, String)]
|
||||
downgradeShortcuts =
|
||||
[ ("v1.0.0-beta.1", "16")
|
||||
, ("v1.0.0-beta.2", "17")
|
||||
, ("v1.0.0-beta.3", "17")
|
||||
, ("v1.0.0-beta.4", "19")
|
||||
, ("v1.0.0-beta.5", "19")
|
||||
, ("v1.0.0-beta.6", "22")
|
||||
, ("v1.0.0-beta.7", "24")
|
||||
, ("v1.0.0-beta.8", "26")
|
||||
, ("v1.0.0-beta.9", "26")
|
||||
, ("v1.0.0-beta.10", "27")
|
||||
, ("v1.0.0-rc.1", "28")
|
||||
, ("v1.0.0", "28")
|
||||
, ("v1.1.0-beta.1", "29")
|
||||
, ("v1.1.0-beta.2", "30")
|
||||
, ("v1.1.0-beta.3", "31")
|
||||
, ("v1.1.0", "31")
|
||||
]
|
||||
$(do let s = $(embedStringFile "src-rsr/catalog_versions.txt")
|
||||
|
||||
parseVersions = map (parseVersion . words) . lines
|
||||
|
||||
parseVersion [tag, version] = (tag, version)
|
||||
parseVersion other = error ("unrecognized tag/catalog mapping " ++ show other)
|
||||
TH.lift (parseVersions s))
|
||||
|
||||
downgradeOptionsParser :: Parser DowngradeOptions
|
||||
downgradeOptionsParser =
|
||||
|
@ -2,7 +2,7 @@
|
||||
--
|
||||
-- To add a new migration:
|
||||
--
|
||||
-- 1. Bump the catalog version number in "Hasura.Server.Migrate.Version".
|
||||
-- 1. Bump the catalog version number in @src-rsr/catalog_version.txt@.
|
||||
-- 2. Add a migration script in the @src-rsr/migrations/@ directory with the name
|
||||
-- @<old version>_to_<new version>.sql@.
|
||||
-- 3. Create a downgrade script in the @src-rsr/migrations/@ directory with the name
|
||||
|
@ -9,10 +9,18 @@ module Hasura.Server.Migrate.Version
|
||||
|
||||
import Hasura.Prelude
|
||||
|
||||
import qualified Data.Text as T
|
||||
import qualified Data.Text as T
|
||||
import qualified Language.Haskell.TH.Syntax as TH
|
||||
|
||||
import Data.FileEmbed (embedStringFile)
|
||||
|
||||
-- | 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 = 32
|
||||
latestCatalogVersion =
|
||||
$(do let s = $(embedStringFile "src-rsr/catalog_version.txt")
|
||||
TH.lift (read s :: Integer))
|
||||
|
||||
latestCatalogVersionString :: T.Text
|
||||
latestCatalogVersionString = T.pack $ show latestCatalogVersion
|
||||
|
1
server/src-rsr/catalog_version.txt
Normal file
1
server/src-rsr/catalog_version.txt
Normal file
@ -0,0 +1 @@
|
||||
32
|
16
server/src-rsr/catalog_versions.txt
Normal file
16
server/src-rsr/catalog_versions.txt
Normal file
@ -0,0 +1,16 @@
|
||||
v1.0.0-beta.1 16
|
||||
v1.0.0-beta.2 17
|
||||
v1.0.0-beta.3 17
|
||||
v1.0.0-beta.4 19
|
||||
v1.0.0-beta.5 19
|
||||
v1.0.0-beta.6 22
|
||||
v1.0.0-beta.7 24
|
||||
v1.0.0-beta.8 26
|
||||
v1.0.0-beta.9 26
|
||||
v1.0.0-beta.10 27
|
||||
v1.0.0-rc.1 28
|
||||
v1.0.0 28
|
||||
v1.1.0-beta.1 29
|
||||
v1.1.0-beta.2 30
|
||||
v1.1.0-beta.3 31
|
||||
v1.1.0 31
|
Loading…
Reference in New Issue
Block a user