[Pkg-owncloud-commits] [php-sabredav] 13/66: Renaming cards to cards_old with a random number for easier repating updates.

David Prévot taffit at moszumanska.debian.org
Wed May 27 13:56:44 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to tag 3.0.0-alpha1
in repository php-sabredav.

commit 485b59bc227b52e2d4c950269def349eef2a7d90
Author: Evert Pot <me at evertpot.com>
Date:   Mon Apr 13 17:36:18 2015 -0400

    Renaming cards to cards_old with a random number for easier repating
    updates.
---
 bin/migrateto20.php | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/bin/migrateto20.php b/bin/migrateto20.php
index aa003e8..cb2dc56 100755
--- a/bin/migrateto20.php
+++ b/bin/migrateto20.php
@@ -357,17 +357,18 @@ try {
     $create = false;
     $row = $pdo->query("SELECT * FROM cards LIMIT 1")->fetch();
     if (!$row) {
+        $random = mt_rand(1000,9999);
         echo "There was no data in the cards table, so we're re-creating it\n";
-        echo "The old table will be renamed to cards_old, just in case.\n";
+        echo "The old table will be renamed to cards_old$random, just in case.\n";
 
         $create = true;
 
         switch($driver) {
             case 'mysql' :
-                $pdo->exec("RENAME TABLE cards TO cards_old");
+                $pdo->exec("RENAME TABLE cards TO cards_old$random");
                 break;
             case 'sqlite' :
-                $pdo->exec("ALTER TABLE cards RENAME TO cards_old");
+                $pdo->exec("ALTER TABLE cards RENAME TO cards_old$random");
                 break;
 
         }
@@ -376,6 +377,7 @@ try {
 } catch (Exception $e) {
 
     echo "Exception while checking cards table. Assuming that the table does not yet exist.\n";
+    echo "Debug: ", $e->getMessage(), "\n";
     $create = true;
 
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/php-sabredav.git



More information about the Pkg-owncloud-commits mailing list