Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Refactored schema version tracking from manually managed to automatic.
3 changes: 1 addition & 2 deletions services/gundeck/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ mkDerivation {
mtl
network-uri
psqueues
raw-strings-qq
resourcet
retry
safe-exceptions
Expand Down Expand Up @@ -153,7 +154,6 @@ mkDerivation {
cassandra-util
containers
exceptions
extended
gundeck-types
HsOpenSSL
http-client
Expand All @@ -167,7 +167,6 @@ mkDerivation {
network-uri
optparse-applicative
random
raw-strings-qq
retry
safe
tagged
Expand Down
34 changes: 15 additions & 19 deletions services/gundeck/gundeck.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ flag static
default: False

library
-- cabal-fmt: expand src
exposed-modules:
Gundeck.API
Gundeck.API.Internal
Expand All @@ -42,6 +43,17 @@ library
Gundeck.Redis
Gundeck.Redis.HedisExtensions
Gundeck.Run
Gundeck.Schema.Run
Gundeck.Schema.V1
Gundeck.Schema.V10
Gundeck.Schema.V2
Gundeck.Schema.V3
Gundeck.Schema.V4
Gundeck.Schema.V5
Gundeck.Schema.V6
Gundeck.Schema.V7
Gundeck.Schema.V8
Gundeck.Schema.V9
Gundeck.ThreadBudget
Gundeck.ThreadBudget.Internal
Gundeck.Util
Expand Down Expand Up @@ -130,6 +142,7 @@ library
, mtl >=2.2
, network-uri >=2.6
, psqueues >=0.2.2
, raw-strings-qq
, resourcet >=1.1
, retry >=0.5
, safe-exceptions
Expand Down Expand Up @@ -318,20 +331,7 @@ executable gundeck-integration

executable gundeck-schema
main-is: Main.hs
other-modules:
Paths_gundeck
V1
V10
V2
V3
V4
V5
V6
V7
V8
V9

hs-source-dirs: schema/src
hs-source-dirs: schema
default-extensions:
NoImplicitPrelude
AllowAmbiguousTypes
Expand Down Expand Up @@ -380,12 +380,8 @@ executable gundeck-schema
-threaded -Wredundant-constraints -Wunused-packages

build-depends:
base
, cassandra-util
, extended
gundeck
, imports
, raw-strings-qq
, types-common

if flag(static)
ld-options: -static
Expand Down
24 changes: 24 additions & 0 deletions services/gundeck/schema/Main.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
-- This file is part of the Wire Server implementation.
--
-- Copyright (C) 2022 Wire Swiss GmbH <opensource@wire.com>
--
-- This program is free software: you can redistribute it and/or modify it under
-- the terms of the GNU Affero General Public License as published by the Free
-- Software Foundation, either version 3 of the License, or (at your option) any
-- later version.
--
-- This program is distributed in the hope that it will be useful, but WITHOUT
-- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-- FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
-- details.
--
-- You should have received a copy of the GNU Affero General Public License along
-- with this program. If not, see <https://www.gnu.org/licenses/>.

module Main where

import Gundeck.Schema.Run qualified as Run
import Imports

main :: IO ()
main = Run.main
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,23 @@
-- You should have received a copy of the GNU Affero General Public License along
-- with this program. If not, see <https://www.gnu.org/licenses/>.

module Main where
module Gundeck.Schema.Run where

import Cassandra.Schema
import Control.Exception (finally)
import Gundeck.Schema.V1 qualified as V1
import Gundeck.Schema.V10 qualified as V10
import Gundeck.Schema.V2 qualified as V2
import Gundeck.Schema.V3 qualified as V3
import Gundeck.Schema.V4 qualified as V4
import Gundeck.Schema.V5 qualified as V5
import Gundeck.Schema.V6 qualified as V6
import Gundeck.Schema.V7 qualified as V7
import Gundeck.Schema.V8 qualified as V8
import Gundeck.Schema.V9 qualified as V9
import Imports
import System.Logger.Extended qualified as Log
import Util.Options
import V1 qualified
import V10 qualified
import V2 qualified
import V3 qualified
import V4 qualified
import V5 qualified
import V6 qualified
import V7 qualified
import V8 qualified
import V9 qualified

main :: IO ()
main = do
Expand All @@ -40,18 +40,25 @@ main = do
migrateSchema
l
o
[ V1.migration,
V2.migration,
V3.migration,
V4.migration,
V5.migration,
V6.migration,
V7.migration,
V8.migration,
V9.migration,
V10.migration
]
migrations
`finally` Log.close l
where
desc = "Gundeck Cassandra Schema Migrations"
defaultPath = "/etc/wire/gundeck/conf/gundeck-schema.yaml"

lastSchemaVersion :: Int32
lastSchemaVersion = migVersion $ last migrations

migrations :: [Migration]
migrations =
[ V1.migration,
V2.migration,
V3.migration,
V4.migration,
V5.migration,
V6.migration,
V7.migration,
V8.migration,
V9.migration,
V10.migration
]
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
-- You should have received a copy of the GNU Affero General Public License along
-- with this program. If not, see <https://www.gnu.org/licenses/>.

module V1
module Gundeck.Schema.V1
( migration,
)
where
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
-- You should have received a copy of the GNU Affero General Public License along
-- with this program. If not, see <https://www.gnu.org/licenses/>.

module V10
module Gundeck.Schema.V10
( migration,
)
where
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
-- You should have received a copy of the GNU Affero General Public License along
-- with this program. If not, see <https://www.gnu.org/licenses/>.

module V2
module Gundeck.Schema.V2
( migration,
)
where
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
-- You should have received a copy of the GNU Affero General Public License along
-- with this program. If not, see <https://www.gnu.org/licenses/>.

module V3
module Gundeck.Schema.V3
( migration,
)
where
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
-- You should have received a copy of the GNU Affero General Public License along
-- with this program. If not, see <https://www.gnu.org/licenses/>.

module V4
module Gundeck.Schema.V4
( migration,
)
where
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
-- You should have received a copy of the GNU Affero General Public License along
-- with this program. If not, see <https://www.gnu.org/licenses/>.

module V5
module Gundeck.Schema.V5
( migration,
)
where
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
-- You should have received a copy of the GNU Affero General Public License along
-- with this program. If not, see <https://www.gnu.org/licenses/>.

module V6
module Gundeck.Schema.V6
( migration,
)
where
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
-- You should have received a copy of the GNU Affero General Public License along
-- with this program. If not, see <https://www.gnu.org/licenses/>.

module V7
module Gundeck.Schema.V7
( migration,
)
where
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
-- You should have received a copy of the GNU Affero General Public License along
-- with this program. If not, see <https://www.gnu.org/licenses/>.

module V8
module Gundeck.Schema.V8
( migration,
)
where
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
-- You should have received a copy of the GNU Affero General Public License along
-- with this program. If not, see <https://www.gnu.org/licenses/>.

module V9
module Gundeck.Schema.V9
( migration,
)
where
Expand Down