diff options
author | Yorhel <git@yorhel.nl> | 2015-05-03 09:23:04 +0200 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2015-05-03 09:23:06 +0200 |
commit | 39cbaf0cd0a6f1dc16aa56a2f82d8ecd08136212 (patch) | |
tree | 3f991b22318ade9a3804b98162adf189a0fb94cb /util | |
parent | fdda38d11baba8a24d97d4c19b75eee158666bfa (diff) |
Remove "script" role from vn<->staff links
Note that it's still in the postgresql ENUM type. Removing that is
possible, but not very trivial.
Diffstat (limited to 'util')
-rw-r--r-- | util/updates/update_2.25.sql | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/util/updates/update_2.25.sql b/util/updates/update_2.25.sql index 5188cca2..f9168cf7 100644 --- a/util/updates/update_2.25.sql +++ b/util/updates/update_2.25.sql @@ -1,2 +1,14 @@ ALTER TYPE credit_type ADD VALUE 'scenario' BEFORE 'script'; + +BEGIN; +-- There are no entries in the database where a single aid has both a script +-- and a staff role, and where a note has been associated with the script role. +-- So this conversion does not attempt to merge notes when merging roles. +UPDATE vn_staff vs SET role = 'staff', note = CASE WHEN note = '' THEN 'Scripting' ELSE note END + WHERE role = 'script' AND NOT EXISTS(SELECT 1 FROM vn_staff v2 where v2.vid = vs.vid AND v2.aid = vs.aid AND role = 'staff'); +UPDATE vn_staff vs SET note = CASE WHEN note = '' THEN 'Scripting' ELSE note || ', Scripting' END + WHERE role = 'staff' AND EXISTS(SELECT 1 FROM vn_staff v2 where v2.vid = vs.vid AND v2.aid = vs.aid AND role = 'script'); +DELETE FROM vn_staff WHERE role = 'script'; +COMMIT; + |