diff --git a/src/Model/Migration.hs b/src/Model/Migration.hs index 09c1fb331..51f41aec6 100644 --- a/src/Model/Migration.hs +++ b/src/Model/Migration.hs @@ -645,19 +645,8 @@ customMigrations = Map.fromListWith (>>) , whenM (tableExists "course_participant") $ do [executeQQ| ALTER TABLE "course_participant" ADD COLUMN "state" text NOT NULL DEFAULT 'active'; - ALTER TABLE "course_participant" ALTER COLUMN "state" text DROP DEFAULT; + ALTER TABLE "course_participant" ALTER COLUMN "state" DROP DEFAULT; |] - -- let getUsers = rawQuery [st|SELECT "id", "display_name", "surname" FROM "user"|] [] - -- updateUser (uid, firstName) = [executeQQ|UPDATE "user" SET "first_name" = #{firstName} WHERE "id" = #{uid}|] - -- splitFirstName :: [PersistValue] -> Maybe (UserId, Text) - -- splitFirstName [fromPersistValue -> Right uid, fromPersistValue -> Right displayName, fromPersistValue -> Right surname] = Just . (uid, ) $ if - -- | Just givenName <- Text.stripSuffix surname displayName - -- <|> Text.stripPrefix surname displayName - -- -> Text.strip givenName - -- | otherwise - -- -> Text.replace surname "…" displayName - -- splitFirstName _ = Nothing - -- runConduit $ getAuditLog .| C.mapM_ ensureParticipant let getAuditLog = rawQuery [st|SELECT "info", "time" FROM "transaction_log";|] [] ensureParticipant :: [PersistValue] -> ReaderT SqlBackend m () ensureParticipant [fmap Aeson.fromJSON . fromPersistValue -> Right (Aeson.Success TransactionCourseParticipantEdit{..}), fromPersistValue -> Right (time :: UTCTime)] = do