diff options
author | Bart Visscher <bartv@thisnet.nl> | 2013-11-15 04:19:33 -0800 |
---|---|---|
committer | Bart Visscher <bartv@thisnet.nl> | 2013-11-15 04:19:33 -0800 |
commit | 630e46f60a7ac43815d14dd3d224de8ae3038465 (patch) | |
tree | 166c1e41ac2ea234ffece0ca431f9bce9e35979a | |
parent | 16dce5191751e0e6b394fc5cc58690a77dc82870 (diff) | |
parent | 53f17a71d1eedc5a520874b40b51890fa5559d4d (diff) | |
download | nextcloud-server-630e46f60a7ac43815d14dd3d224de8ae3038465.tar.gz nextcloud-server-630e46f60a7ac43815d14dd3d224de8ae3038465.zip |
Merge pull request #5789 from ogasser/db_fix_default_for_numeric
DB: Set correct default value for numeric types
-rw-r--r-- | lib/private/db/mdb2schemareader.php | 5 | ||||
-rw-r--r-- | tests/data/db_structure.xml | 22 | ||||
-rw-r--r-- | tests/data/db_structure2.xml | 22 |
3 files changed, 48 insertions, 1 deletions
diff --git a/lib/private/db/mdb2schemareader.php b/lib/private/db/mdb2schemareader.php index ad4c39a9935..511bd1c90bd 100644 --- a/lib/private/db/mdb2schemareader.php +++ b/lib/private/db/mdb2schemareader.php @@ -150,6 +150,9 @@ class MDB2SchemaReader { case 'timestamp': $type = 'datetime'; break; + case 'numeric': + $type = 'decimal'; + break; } break; case 'length': @@ -193,7 +196,7 @@ class MDB2SchemaReader { } else { $options['default'] = ''; } - if ($type == 'integer') { + if ($type == 'integer' || $type == 'decimal') { $options['default'] = 0; } elseif ($type == 'boolean') { $options['default'] = false; diff --git a/tests/data/db_structure.xml b/tests/data/db_structure.xml index 2e83bbb78c7..5f2edbbc516 100644 --- a/tests/data/db_structure.xml +++ b/tests/data/db_structure.xml @@ -199,4 +199,26 @@ </declaration> </table> + <table> + <name>*dbprefix*decimal</name> + <declaration> + <field> + <name>id</name> + <autoincrement>1</autoincrement> + <type>integer</type> + <default>0</default> + <notnull>true</notnull> + <length>4</length> + </field> + + <field> + <name>decimaltest</name> + <type>decimal</type> + <default/> + <notnull>true</notnull> + <length>15</length> + </field> + </declaration> + </table> + </database> diff --git a/tests/data/db_structure2.xml b/tests/data/db_structure2.xml index bbfb24985cb..6cd071451df 100644 --- a/tests/data/db_structure2.xml +++ b/tests/data/db_structure2.xml @@ -96,4 +96,26 @@ </declaration> </table> + <table> + <name>*dbprefix*decimal</name> + <declaration> + <field> + <name>id</name> + <autoincrement>1</autoincrement> + <type>integer</type> + <default>0</default> + <notnull>true</notnull> + <length>4</length> + </field> + + <field> + <name>decimaltest</name> + <type>decimal</type> + <default/> + <notnull>true</notnull> + <length>15</length> + </field> + </declaration> + </table> + </database> |