minor
This commit is contained in:
parent
479601a8cf
commit
41e52609c5
@ -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
|
||||
)
|
||||
]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user