Fix Mysql and Postgresql bug

This commit is contained in:
Frédéric Guillot 2014-09-10 16:51:44 +02:00
parent 28ff8dad91
commit cede5d5434
8 changed files with 17 additions and 58 deletions

View File

@ -98,7 +98,7 @@ class CommentHistory extends BaseHistory
LEFT JOIN tasks ON tasks.id=comment_has_events.task_id
WHERE comment_has_events.project_id = ?
ORDER BY comment_has_events.id DESC
LIMIT 0, '.$limit.'
LIMIT '.$limit.' OFFSET 0
';
$rq = $this->db->execute($sql, array($project_id));

View File

@ -105,7 +105,7 @@ class SubtaskHistory extends BaseHistory
LEFT JOIN users AS assignees ON assignees.id=task_has_subtasks.user_id
WHERE subtask_has_events.project_id = ?
ORDER BY subtask_has_events.id DESC
LIMIT 0, '.$limit.'
LIMIT '.$limit.' OFFSET 0
';
$rq = $this->db->execute($sql, array($project_id));

View File

@ -96,7 +96,7 @@ class TaskHistory extends BaseHistory
LEFT JOIN columns ON columns.id=tasks.column_id
WHERE task_has_events.project_id = ?
ORDER BY task_has_events.id DESC
LIMIT 0, '.$limit.'
LIMIT '.$limit.' OFFSET 0
';
$rq = $this->db->execute($sql, array($project_id));

View File

@ -19,8 +19,9 @@ function version_25($pdo)
data TEXT,
FOREIGN KEY(creator_id) REFERENCES users(id) ON DELETE CASCADE,
FOREIGN KEY(project_id) REFERENCES projects(id) ON DELETE CASCADE,
FOREIGN KEY(task_id) REFERENCES tasks(id) ON DELETE CASCADE
);
FOREIGN KEY(task_id) REFERENCES tasks(id) ON DELETE CASCADE,
PRIMARY KEY (id)
) ENGINE=InnoDB CHARSET=utf8
");
$pdo->exec("
@ -36,8 +37,9 @@ function version_25($pdo)
FOREIGN KEY(creator_id) REFERENCES users(id) ON DELETE CASCADE,
FOREIGN KEY(project_id) REFERENCES projects(id) ON DELETE CASCADE,
FOREIGN KEY(subtask_id) REFERENCES task_has_subtasks(id) ON DELETE CASCADE,
FOREIGN KEY(task_id) REFERENCES tasks(id) ON DELETE CASCADE
);
FOREIGN KEY(task_id) REFERENCES tasks(id) ON DELETE CASCADE,
PRIMARY KEY (id)
) ENGINE=InnoDB CHARSET=utf8
");
$pdo->exec("
@ -53,8 +55,9 @@ function version_25($pdo)
FOREIGN KEY(creator_id) REFERENCES users(id) ON DELETE CASCADE,
FOREIGN KEY(project_id) REFERENCES projects(id) ON DELETE CASCADE,
FOREIGN KEY(comment_id) REFERENCES comments(id) ON DELETE CASCADE,
FOREIGN KEY(task_id) REFERENCES tasks(id) ON DELETE CASCADE
);
FOREIGN KEY(task_id) REFERENCES tasks(id) ON DELETE CASCADE,
PRIMARY KEY (id)
) ENGINE=InnoDB CHARSET=utf8
");
}
@ -197,46 +200,6 @@ function version_12($pdo)
);
}
function version_11($pdo)
{
}
function version_10($pdo)
{
}
function version_9($pdo)
{
}
function version_8($pdo)
{
}
function version_7($pdo)
{
}
function version_6($pdo)
{
}
function version_5($pdo)
{
}
function version_4($pdo)
{
}
function version_3($pdo)
{
}
function version_2($pdo)
{
}
function version_1($pdo)
{
$pdo->exec("

View File

@ -5,7 +5,7 @@
<em><?= Helper\escape($task_title) ?></em><br/>
<p><?= Helper\escape($subtask_title) ?> <strong>(<?= Helper\in_list($subtask_status, $subtask_status_list) ?>)</strong></p>
<?php if ($subtask_assignee): ?>
<p><?= t('Assigned to %s with estimate of %s/%sh', $subtask_assignee, $subtask_time_spent, $subtask_time_estimated) ?></p>
<p><?= t('Assigned to %s with an estimate of %s/%sh', $subtask_assignee, $subtask_time_spent, $subtask_time_estimated) ?></p>
<?php else: ?>
<p><?= t('Not assigned, estimate of %sh', $subtask_time_estimated) ?></p>
<?php endif ?>

View File

@ -5,7 +5,7 @@
<em><?= Helper\escape($task_title) ?></em><br/>
<p><?= Helper\escape($subtask_title) ?> <strong>(<?= Helper\in_list($subtask_status, $subtask_status_list) ?>)</strong></p>
<?php if ($subtask_assignee): ?>
<p><?= t('Assigned to %s with estimate of %s/%sh', $subtask_assignee, $subtask_time_spent, $subtask_time_estimated) ?></p>
<p><?= t('Assigned to %s with an estimate of %s/%sh', $subtask_assignee, $subtask_time_spent, $subtask_time_estimated) ?></p>
<?php else: ?>
<p><?= t('Not assigned, estimate of %sh', $subtask_time_estimated) ?></p>
<?php endif ?>

View File

@ -152,7 +152,8 @@ $registry->db = function() use ($registry) {
return $db;
}
else {
die('Unable to migrate database schema!');
$errors = $db->getLogMessages();
die('Unable to migrate database schema: <br/><br/><strong>'.(isset($errors[0]) ? $errors[0] : 'Unknown error').'</strong>');
}
};

View File

@ -36,20 +36,15 @@ class Schema
$function_name = '\Schema\version_'.$i;
if (function_exists($function_name)) {
call_user_func($function_name, $this->db->getConnection());
$this->db->getConnection()->setSchemaVersion($i);
}
else {
throw new \LogicException('To execute a database migration, you need to create this function: "'.$function_name.'".');
}
}
$this->db->closeTransaction();
}
catch (\PDOException $e) {
$this->db->setLogMessage($function_name.' => '.$e->getMessage());
$this->db->cancelTransaction();
return false;
}