From e2b6781cf9a97e4ad10e4824e38ccdaf3c2dc676 Mon Sep 17 00:00:00 2001
From: Bart Visscher <bartv@thisnet.nl>
Date: Thu, 18 Jul 2013 20:28:57 +0200
Subject: [PATCH] Tweaks to the MDB2SchemaReader

---
 3rdparty                    | 2 +-
 db_structure.xml            | 2 +-
 lib/db/mdb2schemareader.php | 7 ++++++-
 3 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/3rdparty b/3rdparty
index c8623cc80d4..25e8568d41a 160000
--- a/3rdparty
+++ b/3rdparty
@@ -1 +1 @@
-Subproject commit c8623cc80d47022cb25874b69849cd2f57fd4874
+Subproject commit 25e8568d41a9b9a6d1662ccf33058822a890e7f5
diff --git a/db_structure.xml b/db_structure.xml
index 4c192ba028e..ef5de653033 100644
--- a/db_structure.xml
+++ b/db_structure.xml
@@ -383,7 +383,7 @@
 				<name>user</name>
 				<type>text</type>
 				<default></default>
-				<notnull>false</notnull>
+				<notnull>true</notnull>
 				<length>64</length>
 			</field>
 
diff --git a/lib/db/mdb2schemareader.php b/lib/db/mdb2schemareader.php
index 4dc1fd4616d..0ead9528c93 100644
--- a/lib/db/mdb2schemareader.php
+++ b/lib/db/mdb2schemareader.php
@@ -148,6 +148,8 @@ class OC_DB_MDB2SchemaReader {
 				if (empty($options['notnull']) || !$options['notnull']) {
 					unset($options['default']);
 					$options['notnull'] = false;
+				} else {
+					$options['default'] = '';
 				}
 				if ($type == 'integer') {
 					$options['default'] = 0;
@@ -165,9 +167,12 @@ class OC_DB_MDB2SchemaReader {
 					$type = 'bigint';
 				}
 			}
-			$table->addColumn($name, $type, $options);
 			if (!empty($options['autoincrement'])
 			    && !empty($options['notnull'])) {
+				$options['primary'] = true;
+			}
+			$table->addColumn($name, $type, $options);
+			if (!empty($options['primary']) && $options['primary']) {
 				$table->setPrimaryKey(array($name));
 			}
 		}
-- 
GitLab