Merge pull request #5789 from ogasser/db_fix_default_for_numeric

DB: Set correct default value for numeric types
remotes/origin/stable6
Bart Visscher 12 years ago
commit 630e46f60a
  1. 5
      lib/private/db/mdb2schemareader.php
  2. 22
      tests/data/db_structure.xml
  3. 22
      tests/data/db_structure2.xml

@ -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;

@ -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>

@ -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>

Loading…
Cancel
Save