[php-doctrine-DoctrineDBAL] backport fixes for OwnCloud from upstream master

Adam Williamson adamwill at fedoraproject.org
Sat Dec 28 20:50:49 UTC 2013


commit 6d2fadead97ae093adda1c592bdae4587cfd12f4
Author: Adam Williamson <awilliam at redhat.com>
Date:   Sat Dec 28 12:49:36 2013 -0800

    backport fixes for OwnCloud from upstream master

 075c68b7518e27d46d7f700a1d42ebf43f6ebdfd.patch |   34 ++++++++++++++++++++++++
 63f6a806b597f5ec8b2bcc2e4591d64af843b68c.patch |   30 +++++++++++++++++++++
 69b377bbbf61ec97163579e7c28ea47521fc1fad.patch |   31 +++++++++++++++++++++
 php-doctrine-DoctrineDBAL.spec                 |   29 +++++++++++++++++++-
 4 files changed, 123 insertions(+), 1 deletions(-)
---
diff --git a/075c68b7518e27d46d7f700a1d42ebf43f6ebdfd.patch b/075c68b7518e27d46d7f700a1d42ebf43f6ebdfd.patch
new file mode 100644
index 0000000..b70256c
--- /dev/null
+++ b/075c68b7518e27d46d7f700a1d42ebf43f6ebdfd.patch
@@ -0,0 +1,34 @@
+From 075c68b7518e27d46d7f700a1d42ebf43f6ebdfd Mon Sep 17 00:00:00 2001
+From: Bart Visscher <bartv at thisnet.nl>
+Date: Thu, 18 Jul 2013 20:19:32 +0200
+Subject: [PATCH] When changing from a non-primary index to a primary index,
+ the dropped index isn't named PRIMARY
+
+---
+ lib/Doctrine/DBAL/Platforms/MySqlPlatform.php             |  9 +++++++++
+ tests/Doctrine/Tests/DBAL/Platforms/MySqlPlatformTest.php | 13 +++++++++++++
+ 2 files changed, 22 insertions(+)
+
+diff --git a/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php b/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php
+index a48ac46..7337cb1 100644
+--- a/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php
++++ b/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php
+@@ -642,6 +642,15 @@ protected function getPreAlterTableIndexForeignKeySQL(TableDiff $diff)
+                 }
+             }
+         }
++        foreach ($diff->changedIndexes as $changedKey => $changedIndex) {
++            if ($changedIndex->isPrimary() && $changedKey != 'PRIMARY') {
++                $index = $diff->changedIndexes[$changedKey];
++                $index = new Index($changedKey, $index->getColumns(), $index->isUnique(), false);
++                $diff->removedIndexes[$changedKey] = $index;
++                $diff->addedIndexes['PRIMARY'] = $diff->changedIndexes[$changedKey];
++                unset($diff->changedIndexes[$changedKey]);
++            }
++        }
+ 
+         $sql = array_merge($sql, parent::getPreAlterTableIndexForeignKeySQL($diff));
+ 
+-- 
+1.8.5.1
+
diff --git a/63f6a806b597f5ec8b2bcc2e4591d64af843b68c.patch b/63f6a806b597f5ec8b2bcc2e4591d64af843b68c.patch
new file mode 100644
index 0000000..fffb369
--- /dev/null
+++ b/63f6a806b597f5ec8b2bcc2e4591d64af843b68c.patch
@@ -0,0 +1,30 @@
+From 63f6a806b597f5ec8b2bcc2e4591d64af843b68c Mon Sep 17 00:00:00 2001
+From: Bart Visscher <bartv at thisnet.nl>
+Date: Fri, 21 Jun 2013 12:11:22 +0200
+Subject: [PATCH] Don't add 'NOT NULL' to the 'ALTER TABLE' when that hasn't
+ changed
+
+---
+ doctrine/dbal/lib/Doctrine/DBAL/Platforms/OraclePlatform.php | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/doctrine/dbal/lib/Doctrine/DBAL/Platforms/OraclePlatform.php b/doctrine/dbal/lib/Doctrine/DBAL/Platforms/OraclePlatform.php
+index cd5c774..cac6d9d 100644
+--- a/doctrine/dbal/lib/Doctrine/DBAL/Platforms/OraclePlatform.php
++++ b/doctrine/dbal/lib/Doctrine/DBAL/Platforms/OraclePlatform.php
+@@ -569,7 +569,11 @@ public function getAlterTableSQL(TableDiff $diff)
+             }
+ 
+             $column = $columnDiff->column;
+-            $fields[] = $column->getQuotedName($this). ' ' . $this->getColumnDeclarationSQL('', $column->toArray());
++            $columnInfo = $column->toArray();
++            if (!in_array('notnull', $columnDiff->changedProperties)) {
++                $columnInfo['notnull'] = false;
++            }
++            $fields[] = $column->getQuotedName($this). ' ' . $this->getColumnDeclarationSQL('', $columnInfo);
+             if ($columnDiff->hasChanged('comment') && $comment = $this->getColumnComment($column)) {
+                 $commentsSQL[] = $this->getCommentOnColumnSQL($diff->name, $column->getName(), $comment);
+             }
+-- 
+1.8.5.1
+
diff --git a/69b377bbbf61ec97163579e7c28ea47521fc1fad.patch b/69b377bbbf61ec97163579e7c28ea47521fc1fad.patch
new file mode 100644
index 0000000..c11170d
--- /dev/null
+++ b/69b377bbbf61ec97163579e7c28ea47521fc1fad.patch
@@ -0,0 +1,31 @@
+From 69b377bbbf61ec97163579e7c28ea47521fc1fad Mon Sep 17 00:00:00 2001
+From: Bart Visscher <bartv at thisnet.nl>
+Date: Wed, 17 Jul 2013 21:32:18 +0200
+Subject: [PATCH] Add primary key to 'ALTER TABLE' in MySql
+
+This is at least needed when adding a autoincrement column
+---
+ lib/Doctrine/DBAL/Platforms/MySqlPlatform.php      |  6 ++++++
+ .../Tests/DBAL/Platforms/MySqlPlatformTest.php     | 23 ++++++++++++++++++++++
+ 2 files changed, 29 insertions(+)
+
+diff --git a/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php b/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php
+index 5676b4b..a48ac46 100644
+--- a/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php
++++ b/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php
+@@ -572,6 +572,12 @@ public function getAlterTableSQL(TableDiff $diff)
+                     . $this->getColumnDeclarationSQL($column->getQuotedName($this), $columnArray);
+         }
+ 
++        if (isset($diff->addedIndexes['primary'])) {
++            $keyColumns = array_unique(array_values($diff->addedIndexes['primary']->getColumns()));
++            $queryParts[] = 'ADD PRIMARY KEY (' . implode(', ', $keyColumns) . ')';
++            unset($diff->addedIndexes['primary']);
++        }
++
+         $sql = array();
+         $tableSql = array();
+ 
+-- 
+1.8.5.1
+
diff --git a/php-doctrine-DoctrineDBAL.spec b/php-doctrine-DoctrineDBAL.spec
index 1654e4d..782c50b 100644
--- a/php-doctrine-DoctrineDBAL.spec
+++ b/php-doctrine-DoctrineDBAL.spec
@@ -6,7 +6,7 @@
 
 Name:             php-doctrine-%{pear_name}
 Version:          2.3.4
-Release:          4%{?dist}
+Release:          5%{?dist}
 Summary:          Doctrine Database Abstraction Layer
 
 Group:            Development/Libraries
@@ -16,6 +16,23 @@ License:          MIT
 URL:              http://www.doctrine-project.org/projects/dbal.html
 Source0:          http://%{pear_channel}/get/%{pear_name}-%{version}.tgz
 
+# These are all patches written for OwnCloud and later merged into
+# upstream master, but not 2.3 branch. Needed for OwnCloud upgrades
+# to work correctly. Changes to tests have been dropped as we don't
+# ship them.
+
+# "Don't add 'NOT NULL' to the 'ALTER TABLE' when that hasn't changed"
+# From OwnCloud repo not Doctrine, as upstream patch was done against
+# git master and the syntax is different between 2.3 and master
+# https://github.com/owncloud/3rdparty/commit/63f6a806b597f5ec8b2bcc2e4591d64af843b68c
+Patch0:           63f6a806b597f5ec8b2bcc2e4591d64af843b68c.patch
+# "Add primary key to 'ALTER TABLE' in MySql"
+# https://github.com/doctrine/dbal/commit/69b377bbbf61ec97163579e7c28ea47521fc1fad
+Patch1:           69b377bbbf61ec97163579e7c28ea47521fc1fad.patch
+# "When changing from a non-primary index to a primary index, the droppe..."
+# https://github.com/doctrine/dbal/commit/075c68b7518e27d46d7f700a1d42ebf43f6ebdfd
+Patch2:           075c68b7518e27d46d7f700a1d42ebf43f6ebdfd.patch
+
 BuildArch:        noarch
 BuildRequires:    php-pear(PEAR)
 BuildRequires:    php-channel(%{pear_channel})
@@ -53,6 +70,11 @@ the oci8 extension under the hood.
 
 %prep
 %setup -q -c
+pushd %{pear_name}-%{version}
+%patch0 -p4
+%patch1 -p2
+%patch2 -p2
+popd
 
 # Fix package.xml:
 # - Remove empty README
@@ -77,6 +99,8 @@ popd
 # - Remove md5sum from doctrine-dbal file since it was changed
 sed -e '/doctrine-dbal.php/d' \
     -e '/doctrine-dbal/s/md5sum="[^"]*"\s*//' \
+    -e '/MySqlPlatform.php/s/md5sum="[^"]*"\s*//' \
+    -e '/OraclePlatform.php/s/md5sum="[^"]*"\s*//' \
     -i package.xml
 
 # package.xml is version 2.0
@@ -119,6 +143,9 @@ fi
 
 
 %changelog
+* Sat Dec 28 2013 Adam Williamson <awilliam at redhat.com> - 2.3.4-5
+- backport several patches needed for OwnCloud from master
+
 * Wed Oct 02 2013 Shawn Iwinski <shawn.iwinski at gmail.com> 2.3.4-4
 - Removed php-mysqli require (BZ #1011996)
 


More information about the scm-commits mailing list