Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix stupid mistakes and remove default precision.
Making schema explicit is better I think.
  • Loading branch information
markstory committed May 10, 2013
1 parent a35a0dd commit a4225bc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
3 changes: 1 addition & 2 deletions lib/Cake/Database/Schema/MysqlSchema.php
Expand Up @@ -227,8 +227,7 @@ public function columnSql(Table $table, $name) {
in_array($data['type'], $hasPrecision, true) &&
(isset($data['length']) || isset($data['precision']))
) {
$data += ['length' => 11, 'precision' => 3];
$out .= '(' . (int)$data['length'] . ', ' . (int)$data['precision'] . ')';
$out .= '(' . (int)$data['length'] . ',' . (int)$data['precision'] . ')';
}
if (isset($data['null']) && $data['null'] === false) {
$out .= ' NOT NULL';
Expand Down
8 changes: 4 additions & 4 deletions lib/Cake/Test/TestCase/Database/Schema/MysqlSchemaTest.php
Expand Up @@ -323,12 +323,12 @@ public static function columnSqlProvider() {
[
'value',
['type' => 'decimal', 'length' => 11],
'`value` FLOAT(11, 3)'
'`value` DECIMAL(11,0)'
],
[
'value',
['type' => 'decimal', 'length' => 12, 'precision' => 5],
'`value` FLOAT(12, 5)'
'`value` DECIMAL(12,5)'
],
// Float
[
Expand All @@ -338,8 +338,8 @@ public static function columnSqlProvider() {
],
[
'value',
['type' => 'float', 'length' => 11],
'`value` FLOAT(11, 3)'
['type' => 'float', 'length' => 11, 'precision' => 3],
'`value` FLOAT(11,3)'
],
// Boolean
[
Expand Down

0 comments on commit a4225bc

Please sign in to comment.