From e32ad38fb9e3687a62de13ba95f91697352660c7 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Thu, 6 Sep 2018 14:57:42 +0200 Subject: [PATCH] Experimental: try more quoting --- src/Model/Migration.hs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/Model/Migration.hs b/src/Model/Migration.hs index c45d3f4a3..0d857c129 100644 --- a/src/Model/Migration.hs +++ b/src/Model/Migration.hs @@ -109,41 +109,41 @@ customMigrations = Map.fromListWith (>>) -- Convert columns containing SchoolId whenM (tableExists "user_admin") $ do [executeQQ| - ALTER TABLE "user_admin" DROP CONSTRAINT user_admin_school_fkey; - ALTER TABLE "user_admin" ALTER COLUMN school TYPE citext USING school::citext; + ALTER TABLE "user_admin" DROP CONSTRAINT "user_admin_school_fkey"; + ALTER TABLE "user_admin" ALTER COLUMN "school" TYPE citext USING "school"::citext; |] forM_ schoolTable $ \(Single idnr, Single ssh) -> [executeQQ| - UPDATE "user_admin" SET school = #{ssh} WHERE school = #{tshow idnr}; + UPDATE "user_admin" SET "school" = #{ssh} WHERE "school" = #{tshow idnr}; |] [executeQQ| - ALTER TABLE "user_admin" ADD CONSTRAINT "user_admin_school_fkey" + ALTER TABLE "user_admin" ADD CONSTRAINT "user_admin_school_fkey" FOREIGN KEY (school) REFERENCES school(shorthand); |] whenM (tableExists "user_lecturer") $ do [executeQQ| - ALTER TABLE "user_lecturer" DROP CONSTRAINT user_lecturer_school_fkey; - ALTER TABLE "user_lecturer" ALTER COLUMN school TYPE citext USING school::citext; + ALTER TABLE "user_lecturer" DROP CONSTRAINT "user_lecturer_school_fkey"; + ALTER TABLE "user_lecturer" ALTER COLUMN "school" TYPE citext USING "school"::citext; |] forM_ schoolTable $ \(Single idnr, Single ssh) -> [executeQQ| - UPDATE "user_lecturer" SET school = #{ssh} WHERE school = #{tshow idnr}; + UPDATE "user_lecturer" SET "school" = #{ssh} WHERE "school" = #{tshow idnr}; |] [executeQQ| ALTER TABLE "user_lecturer" ADD CONSTRAINT "user_lecturer_school_fkey" - FOREIGN KEY (school) REFERENCES school(shorthand);; + FOREIGN KEY (school) REFERENCES school(shorthand); |] whenM (tableExists "course") $ do [executeQQ| - ALTER TABLE "course" DROP CONSTRAINT course_school_fkey; - ALTER TABLE "course" ALTER COLUMN school TYPE citext USING school::citext; + ALTER TABLE "course" DROP CONSTRAINT "course_school_fkey"; + ALTER TABLE "course" ALTER COLUMN "school" TYPE citext USING "school"::citext; |] forM_ schoolTable $ \(Single idnr, Single ssh) -> [executeQQ| - UPDATE "course" SET school = #{ssh} WHERE school = #{tshow idnr}; + UPDATE "course" SET "school" = #{ssh} WHERE "school" = #{tshow idnr}; |] [executeQQ| - ALTER TABLE "course" ADD CONSTRAINT "course_school_fkey" + ALTER TABLE "course" ADD CONSTRAINT "course_school_fkey" FOREIGN KEY (school) REFERENCES school(shorthand); |] [executeQQ|