Browse Source

Fixed uuid detection in SQL Server

Jose Lorenzo Rodriguez 12 years ago
parent
commit
fa47ed6dc2

+ 1 - 2
src/Database/Schema/SqlserverSchema.php

@@ -126,9 +126,8 @@ class SqlserverSchema extends BaseSchema {
 		}
 
 		if ($col === 'uniqueidentifier') {
-			return ['type' => 'string', 'fixed' => true, 'length' => 36];
+			return ['type' => 'uuid'];
 		}
-		// @todo cursor, hierarchyid, sql_variant, table, xml
 
 		return ['type' => 'text', 'length' => null];
 	}

+ 1 - 1
tests/TestCase/Database/Schema/SqlserverSchemaTest.php

@@ -146,7 +146,7 @@ SQL;
 			[
 				'UNIQUEIDENTIFIER',
 				null,
-				['type' => 'string', 'fixed' => true, 'length' => 36]
+				['type' => 'uuid']
 			],
 			[
 				'TEXT',

+ 1 - 0
tests/TestCase/ORM/TableUuidTest.php

@@ -73,6 +73,7 @@ class TableUuidTest extends TestCase {
 		$this->assertRegExp('/^[a-f0-9-]{36}$/', $entity->id, 'Should be 36 characters');
 
 		$row = $table->find('all')->where(['id' => $entity->id])->first();
+		$row->id = strtolower($row->id);
 		$this->assertEquals($entity->toArray(), $row->toArray());
 	}