Skip to content

Commit

Permalink
Adding support for detecting JSON columns in mysql
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed Mar 19, 2016
1 parent 20d5908 commit 46c3fca
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Database/Schema/MysqlSchema.php
Expand Up @@ -137,6 +137,11 @@ protected function _convertColumn($column)
'unsigned' => $unsigned
];
}

if (strpos($col, 'json') !== false) {
return ['type' => 'json', 'length' => null];
}

return ['type' => 'text', 'length' => null];
}

Expand Down
4 changes: 4 additions & 0 deletions tests/TestCase/Database/Schema/MysqlSchemaTest.php
Expand Up @@ -146,6 +146,10 @@ public static function convertColumnProvider()
'DOUBLE(10,4) UNSIGNED',
['type' => 'float', 'length' => 10, 'precision' => 4, 'unsigned' => true]
],
[
'JSON',
['type' => 'json', 'length' => null]
],
];
}

Expand Down

0 comments on commit 46c3fca

Please sign in to comment.