Improve SQL migrations when old default swimlanes have the same name as a normal swimlanes

This commit is contained in:
Frederic Guillot
2017-06-19 21:54:12 -04:00
parent 25b8961632
commit 418f5522a2
2 changed files with 11 additions and 0 deletions

View File

@@ -13,6 +13,13 @@ function migrate_default_swimlane(PDO $pdo)
$project['default_swimlane'] = 'Default swimlane';
}
$rq = $pdo->prepare('SELECT 1 FROM swimlanes WHERE name=? AND project_id=?');
$rq->execute(array($project['default_swimlane'], $project['id']));
if ($rq->fetchColumn()) {
$project['default_swimlane'] = $project['default_swimlane'].' (Default swimlane)';
}
// Create new default swimlane
$rq = $pdo->prepare('INSERT INTO swimlanes (project_id, name, is_active, position) VALUES (?, ?, ?, ?)');
$rq->execute(array(