Experimental: try more quoting
This commit is contained in:
parent
e971432cd7
commit
e32ad38fb9
@ -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|
|
||||
|
||||
Loading…
Reference in New Issue
Block a user