[Pkg-owncloud-commits] [php-sabredav] 31/42: Ensuring that the sync-token field gets initialized with a value.

David Prévot taffit at moszumanska.debian.org
Fri Nov 28 22:47:50 UTC 2014


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

taffit pushed a commit to branch master
in repository php-sabredav.

commit 9f9db43a40dc277f869dbc4de62fd231913235d9
Author: Evert Pot <evert at rooftopsolutions.nl>
Date:   Wed Nov 19 23:46:00 2014 -0500

    Ensuring that the sync-token field gets initialized with a value.
---
 ChangeLog.md        | 2 ++
 bin/migrateto20.php | 4 +++-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/ChangeLog.md b/ChangeLog.md
index d5698c2..3727de4 100644
--- a/ChangeLog.md
+++ b/ChangeLog.md
@@ -7,6 +7,8 @@ ChangeLog
 * Added `Sabre\CalDAV\CalendarRoot` as an alias for
   `Sabre\CalDAV\CalendarRootNode`. The latter is going to be deprecated in 2.1,
   so this makes it slightly easier to write code that works in both branches.
+* #497: Making sure we're initializing the sync-token field with a value after
+  migration.
 
 
 2.0.5 (2014-10-14)
diff --git a/bin/migrateto20.php b/bin/migrateto20.php
index adb733a..aa003e8 100755
--- a/bin/migrateto20.php
+++ b/bin/migrateto20.php
@@ -187,11 +187,13 @@ foreach(['calendar', 'addressbook'] as $itemType) {
             switch($driver) {
 
                 case 'mysql' :
-                    $pdo->exec("ALTER TABLE $tableName ADD synctoken INT(11) UNSIGNED NOT NULL DEFAULT '0'");
+                    $pdo->exec("ALTER TABLE $tableName ADD synctoken INT(11) UNSIGNED NOT NULL DEFAULT '1'");
                     $pdo->exec("ALTER TABLE $tableName DROP ctag");
+                    $pdo->exec("UPDATE $tableName SET synctoken = '1'");
                     break;
                 case 'sqlite' :
                     $pdo->exec("ALTER TABLE $tableName ADD synctoken integer");
+                    $pdo->exec("UPDATE $tableName SET synctoken = '1'");
                     echo "Note: there's no easy way to remove fields in sqlite.\n";
                     echo "The ctag field is no longer used, but it's kept in place\n";
                     break;

-- 
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