Commit adbfbf54 authored by jwage's avatar jwage

[2.0] Fixes issue with optimistic timestamp locking (closes #2451)

parent 8f755652
...@@ -264,7 +264,11 @@ class MySqlPlatform extends AbstractPlatform ...@@ -264,7 +264,11 @@ class MySqlPlatform extends AbstractPlatform
*/ */
public function getDateTimeTypeDeclarationSql(array $fieldDeclaration) public function getDateTimeTypeDeclarationSql(array $fieldDeclaration)
{ {
return 'DATETIME'; if ($fieldDeclaration['version']) {
return 'TIMESTAMP';
} else {
return 'DATETIME';
}
} }
/** /**
......
...@@ -249,6 +249,7 @@ class SchemaTool ...@@ -249,6 +249,7 @@ class SchemaTool
$column['length'] = isset($mapping['length']) ? $mapping['length'] : null; $column['length'] = isset($mapping['length']) ? $mapping['length'] : null;
$column['notnull'] = isset($mapping['nullable']) ? ! $mapping['nullable'] : false; $column['notnull'] = isset($mapping['nullable']) ? ! $mapping['nullable'] : false;
$column['unique'] = isset($mapping['unique']) ? $mapping['unique'] : false; $column['unique'] = isset($mapping['unique']) ? $mapping['unique'] : false;
$column['version'] = $class->isVersioned && $class->versionField == $mapping['fieldName'] ? true : false;
if (isset($mapping['precision'])) { if (isset($mapping['precision'])) {
$column['precision'] = $mapping['precision']; $column['precision'] = $mapping['precision'];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment