mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #506 from halkyon/sapphire
--- In the example, if you have an enum of Enum("Something,Don\t know") in your `DataObject::$db` array, then dev/build will *always* say this field has changed, because `MySQLDatabase::showFields()` returns the escaped string specification of the field with instead of \. This converts the field spec so that is escaped to \ correctly so the change detection in `Database` is correct.
This commit is contained in:
commit
013abcbe8b
@ -367,7 +367,9 @@ class MySQLDatabase extends SS_Database {
|
|||||||
public function fieldList($table) {
|
public function fieldList($table) {
|
||||||
$fields = DB::query("SHOW FULL FIELDS IN \"$table\"");
|
$fields = DB::query("SHOW FULL FIELDS IN \"$table\"");
|
||||||
foreach($fields as $field) {
|
foreach($fields as $field) {
|
||||||
$fieldSpec = $field['Type'];
|
|
||||||
|
// ensure that '' is converted to \' in field specification (mostly for the benefit of ENUM values)
|
||||||
|
$fieldSpec = str_replace('\'\'', '\\\'', $field['Type']);
|
||||||
if(!$field['Null'] || $field['Null'] == 'NO') {
|
if(!$field['Null'] || $field['Null'] == 'NO') {
|
||||||
$fieldSpec .= ' not null';
|
$fieldSpec .= ' not null';
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user