fix(migration): typo

This commit is contained in:
Gregor Kleen 2020-05-05 21:09:06 +02:00
parent 0e43851336
commit fb7c7efebd

View File

@ -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