From 7ddb79d78d1260310e2a95bbc7c8da1220988a99 Mon Sep 17 00:00:00 2001 From: fr33domlover Date: Sun, 16 Oct 2022 23:42:41 +0000 Subject: [PATCH] DB: If no workflow exists, add a dummy one --- migrations/507_2022-10-16_workflow.model | 5 +++++ src/Vervis/Migration.hs | 6 ++++++ src/Vervis/Migration/Model.hs | 3 +++ 3 files changed, 14 insertions(+) create mode 100644 migrations/507_2022-10-16_workflow.model diff --git a/migrations/507_2022-10-16_workflow.model b/migrations/507_2022-10-16_workflow.model new file mode 100644 index 0000000..9919f51 --- /dev/null +++ b/migrations/507_2022-10-16_workflow.model @@ -0,0 +1,5 @@ +Workflow + ident WflIdent + name Text Maybe + desc Text Maybe + scope WorkflowScope diff --git a/src/Vervis/Migration.hs b/src/Vervis/Migration.hs index 5b17e5b..1f0a48a 100644 --- a/src/Vervis/Migration.hs +++ b/src/Vervis/Migration.hs @@ -2798,6 +2798,12 @@ changes hLocal ctx = , removeField "LocalMessage" "author" -- 506 , renameField "LocalMessage" "authorNew" "author" + -- 507 + , unchecked $ lift $ do + mw <- selectFirst ([] :: [Filter Workflow507]) [] + when (isNothing mw) $ + insert_ $ + Workflow507 (text2wfl "dummy507") Nothing Nothing WSPublic ] migrateDB diff --git a/src/Vervis/Migration/Model.hs b/src/Vervis/Migration/Model.hs index 7cf5319..5c5127b 100644 --- a/src/Vervis/Migration/Model.hs +++ b/src/Vervis/Migration/Model.hs @@ -679,3 +679,6 @@ makeEntitiesMigration "498" makeEntitiesMigration "504" $(modelFile "migrations/504_2022-10-16_message_author.model") + +makeEntitiesMigration "507" + $(modelFile "migrations/507_2022-10-16_workflow.model")