]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fix handling of empty defaults in schema
authorBart Visscher <bartv@thisnet.nl>
Sun, 17 Mar 2013 14:25:41 +0000 (15:25 +0100)
committerBart Visscher <bartv@thisnet.nl>
Sun, 17 Mar 2013 14:25:41 +0000 (15:25 +0100)
lib/db/mdb2schemareader.php

index 6408c27e916306cb93cfd285b41f919f1b676289..1d71af1700cfcdcd8a4803422e1e43fd055085b7 100644 (file)
@@ -124,17 +124,13 @@ class OC_DB_MDB2SchemaReader {
                }
                if (isset($name) && isset($type)) {
                        if (empty($options['default'])) {
+                               if (empty($options['notnull']) || !$options['notnull']) {
+                                       unset($options['default']);
+                               }
                                if ($type == 'integer') {
-                                       if (empty($options['default'])) {
-                                               if (empty($options['notnull'])) {
-                                                       unset($options['default']);
-                                               }
-                                               else {
-                                                       $options['default'] = 0;
-                                               }
-                                       }
+                                       $options['default'] = 0;
                                }
-                               if (!empty($options['autoincrement'])) {
+                               if (!empty($options['autoincrement']) && $options['autoincrement']) {
                                        unset($options['default']);
                                }
                        }