index : flyspray | |
Archlinux32 customized Flyspray installation | gitolite user |
summaryrefslogtreecommitdiff |
author | Andreas Baumann <mail@andreasbaumann.cc> | 2020-02-01 09:05:48 +0100 |
---|---|---|
committer | Andreas Baumann <mail@andreasbaumann.cc> | 2020-02-01 09:05:48 +0100 |
commit | 6854cb3f4d8219cf1829e32122eb2502a916eae9 (patch) | |
tree | 350feb504587d932e02837a1442b059759927646 /setup/upgrade/0.9.9/upgrade_assignments.php |
-rw-r--r-- | setup/upgrade/0.9.9/upgrade_assignments.php | 31 |
diff --git a/setup/upgrade/0.9.9/upgrade_assignments.php b/setup/upgrade/0.9.9/upgrade_assignments.php new file mode 100644 index 0000000..a9aa53c --- /dev/null +++ b/setup/upgrade/0.9.9/upgrade_assignments.php @@ -0,0 +1,31 @@ +<?php + /**********************************************************\ + | This script moves data from {dbprefix)tasks.assigned_to | + | to {dbprefix}assigned. This is to implement multiple | + | assignees per task as described in FS#329. It only needs | + | to be run once to do the conversion. | + \***********************************************************/ + +$check_sql = $db->query("SELECT task_id, assigned_to + FROM {tasks} + WHERE assigned_to > '0'"); + +while ($row = $db->fetchRow($check_sql)) +{ + $check = $db->query('SELECT assigned_id FROM {assigned} WHERE task_id = ? AND user_id = ?', + array($row['task_id'], $row['assigned_to'])); + if ($db->fetchOne($check)) { + continue; + } + + $db->query('INSERT INTO {assigned} + (task_id, user_id) + VALUES (?,?)', + array($row['task_id'], $row['assigned_to'])); + + $db->query('UPDATE {tasks} + SET assigned_to = 0 + WHERE task_id = ?', + array($row['task_id'])); +} +?> |