From 41e52609c5a9160ea6689170b4fa5cf0f047fe8c Mon Sep 17 00:00:00 2001 From: SJost Date: Tue, 28 Aug 2018 15:19:16 +0200 Subject: [PATCH] minor --- src/Model/Migration.hs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Model/Migration.hs b/src/Model/Migration.hs index 3328e0939..7dc0f1de6 100644 --- a/src/Model/Migration.hs +++ b/src/Model/Migration.hs @@ -123,17 +123,17 @@ customMigrations = Map.fromListWith (>>) ALTER TABLE "user_lecturer" DROP CONSTRAINT user_lecturer_school_fkey; ALTER TABLE "course" DROP CONSTRAINT course_school_fkey; |] - let convert1 = [executeQQ| - ALTER TABLE "user_admin" ALTER COLUMN "school" TYPE citext USING to_char(); - ALTER TABLE "user_lecturer" ALTER COLUMN "school" TYPE citext USING to_char(); - ALTER TABLE "course" ALTER COLUMN "school" TYPE citext USING to_char(); - |] +-- let convert1 = [executeQQ| +-- ALTER TABLE "user_admin" ALTER COLUMN school TYPE citext USING CAST(school AS citext); +-- ALTER TABLE "user_lecturer" ALTER COLUMN school TYPE citext USING CAST(school AS citext); +-- ALTER TABLE "course" ALTER COLUMN school TYPE citext USING CAST(school AS citext); +-- |] -- Convert Number-Strings to Shorthands let convert2 = forM_ schoolTable (\(Single idnr, Single ssh) -> [executeQQ| - UPDATE "user_admin" SET "school" = #{ssh} WHERE "school" = #{idnr}; - UPDATE "user_lecturer" SET "school" = #{ssh} WHERE "school" = #{idnr}; - UPDATE "user_course" SET "school" = #{ssh} WHERE "school" = #{idnr}; + UPDATE "user_admin" SET "school" = #{ssh} WHERE school = #{idnr}; + UPDATE "user_lecturer" SET "school" = #{ssh} WHERE school = #{idnr}; + UPDATE "user_course" SET "school" = #{ssh} WHERE school = #{idnr}; |] ) -- Recreate constraints @@ -145,7 +145,7 @@ customMigrations = Map.fromListWith (>>) ALTER TABLE "course" ADD CONSTRAINT "course_school_fkey" FOREIGN KEY (school) REFERENCES school(shorthand); |] - let convert = convert0 >> convert1 >> convert2 >> convert3 + let convert = convert0 >> convert2 >> convert3 convert ) ]