some dbupdater improvements; fix schema 136 syntax for mysql

This commit is contained in:
Andrew Dolgov 2019-03-06 19:42:27 +03:00
parent 0d04e21006
commit 0881d0a00d
3 changed files with 24 additions and 17 deletions

View File

@ -52,7 +52,7 @@ class DbUpdater {
$this->pdo->query($line); // PDO returns errors as exceptions now $this->pdo->query($line); // PDO returns errors as exceptions now
} catch (PDOException $e) { } catch (PDOException $e) {
if ($html_output) { if ($html_output) {
print_error("Error: " . implode(", ", $this->pdo->errorInfo())); print "<div class='text-error'>Error: " . implode(", ", $this->pdo->errorInfo()) . "</div>";
} else { } else {
Debug::log("Error: " . implode(", ", $this->pdo->errorInfo())); Debug::log("Error: " . implode(", ", $this->pdo->errorInfo()));
} }

View File

@ -1133,25 +1133,32 @@ class Handler_Public extends Handler {
if ($op == "performupdate") { if ($op == "performupdate") {
if ($updater->isUpdateRequired()) { if ($updater->isUpdateRequired()) {
print "<h2>" . __("Performing updates") . "</h2>"; print "<h2>" . T_sprintf("Performing updates to schema version %d", SCHEMA_VERSION) . "</h2>";
print "<h3>" . T_sprintf("Updating to schema version %d", SCHEMA_VERSION) . "</h3>";
for ($i = $updater->getSchemaVersion() + 1; $i <= SCHEMA_VERSION; $i++) { for ($i = $updater->getSchemaVersion() + 1; $i <= SCHEMA_VERSION; $i++) {
print_notice(T_sprintf("Performing update up to version %d...", $i)); print "<ul>";
print "<li class='text-info'>" . T_sprintf("Updating to version %d", $i) . "</li>";
print "<li>";
$result = $updater->performUpdateTo($i, true); $result = $updater->performUpdateTo($i, true);
print "</li>";
if (!$result) { if (!$result) {
print "<span class='err'>".__("FAILED!")."</span></li></ul>"; print "</ul>";
print_warning("One of the updates failed. Either retry the process or perform updates manually."); print_error("One of the updates failed. Either retry the process or perform updates manually.");
print "<a href='index.php'>".__("Return to Tiny Tiny RSS")."</a>"; print "<form method='POST'>
<input type='hidden' name='subop' value='performupdate'>
<button type='submit' dojoType='dijit.form.Button' class='alt-danger' onclick='return confirmOP()'>".__("Try again")."</button>
<a href='index.php'>".__("Return to Tiny Tiny RSS")."</a>
</form>";
return; return;
} else { } else {
print "<span class='ok'>".__("OK!")."</span></li>"; print "<li class='text-success'>" . __("Completed.") . "</li>";
print "</ul>";
} }
} }

View File

@ -1,9 +1,9 @@
begin; begin;
alter table ttrss_archived_feeds add column created datetime; alter table ttrss_archived_feeds add column created datetime;
update ttrss_version set schema_version = 136;
alter table ttrss_archived_feeds alter column created set not null;
update ttrss_archived_feeds set created = NOW(); update ttrss_archived_feeds set created = NOW();
alter table ttrss_archived_feeds change created created bool not null;
update ttrss_version set schema_version = 136;
commit; commit;