[Pkg-owncloud-commits] [owncloud] 06/111: DB: Set correct default value for numeric types

David Prévot taffit at moszumanska.debian.org
Wed Nov 20 21:38:34 UTC 2013


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

taffit pushed a commit to branch master
in repository owncloud.

commit b278356eb92e50cd2d0016e78319d50d943bca41
Author: Oliver Gasser <oliver.gasser at gmail.com>
Date:   Sun Nov 10 14:14:27 2013 +0100

    DB: Set correct default value for numeric types
    
    Set 0 as default value for columns with numeric data type instead of the
    empty string ''. Otherwise the database complains about an invalid
    default value for this column.
    
    To reproduce put the following in your ````appinfo/database.xml````:
    
    ````
    <field>
            <name>modified</name>
            <type>decimal</type>
            <default/>
            <notnull>true</notnull>
            <length>15</length>
    </field>
    ````
    
    See owncloud/mozilla_sync#14
---
 lib/private/db/mdb2schemareader.php |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/private/db/mdb2schemareader.php b/lib/private/db/mdb2schemareader.php
index b7128a2..9890bec 100644
--- a/lib/private/db/mdb2schemareader.php
+++ b/lib/private/db/mdb2schemareader.php
@@ -193,7 +193,7 @@ class MDB2SchemaReader {
 				} else {
 					$options['default'] = '';
 				}
-				if ($type == 'integer') {
+				if ($type == 'integer' || $type == 'numeric') {
 					$options['default'] = 0;
 				} elseif ($type == 'boolean') {
 					$options['default'] = false;

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



More information about the Pkg-owncloud-commits mailing list