From 418f5522a2edf3c30d0b090634c4b33e2d2930e6 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Mon, 19 Jun 2017 21:54:12 -0400 Subject: Improve SQL migrations when old default swimlanes have the same name as a normal swimlanes --- ChangeLog | 4 ++++ app/Schema/Migration.php | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/ChangeLog b/ChangeLog index 9f38c881..eb4f91f9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,6 +9,10 @@ New features: * Add configurable list of predefined subjects when sending a task or a a comment by email * Add command line argument to filter overdue notification for a given project +Improvements: + +* Improve SQL migrations when old default swimlanes have the same name as a normal swimlanes + Bug fixes: * Add missing subtask permissions for project viewer role diff --git a/app/Schema/Migration.php b/app/Schema/Migration.php index 654303f4..21ef4427 100644 --- a/app/Schema/Migration.php +++ b/app/Schema/Migration.php @@ -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( -- cgit v1.2.3