Skip to content

Commit

Permalink
Fixing Sqlserver schema tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed Apr 12, 2014
1 parent 40a4300 commit ac4f236
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
6 changes: 3 additions & 3 deletions src/Database/Schema/SqlserverSchema.php
Expand Up @@ -294,8 +294,8 @@ public function columnSql(Table $table, $name) {
$data = $table->column($name);
$out = $this->_driver->quoteIdentifier($name);
$typeMap = [
'integer' => 'INTEGER',
'biginteger' => 'BIGINT',
'integer' => ' INTEGER',
'biginteger' => ' BIGINT',
'boolean' => ' BIT',
'binary' => ' BINARY',
'float' => ' FLOAT',
Expand All @@ -305,7 +305,7 @@ public function columnSql(Table $table, $name) {
'time' => ' TIME',
'datetime' => ' DATETIME',
'timestamp' => ' DATETIME',
'uuid' => 'UNIQUEIDENTIFIER'
'uuid' => ' UNIQUEIDENTIFIER'
];

if (isset($typeMap[$data['type']])) {
Expand Down
22 changes: 11 additions & 11 deletions tests/TestCase/Database/Schema/SqlserverSchemaTest.php
Expand Up @@ -17,7 +17,7 @@
namespace Cake\Test\TestCase\Database\Schema;

use Cake\Core\Configure;
use Cake\Database\ConnectionManager;
use Cake\Datasource\ConnectionManager;
use Cake\Database\Schema\Collection as SchemaCollection;
use Cake\Database\Schema\SqlserverSchema;
use Cake\Database\Schema\Table;
Expand Down Expand Up @@ -331,38 +331,38 @@ public static function columnSqlProvider() {
[
'title',
['type' => 'string', 'length' => 25, 'null' => false],
'[title] VARCHAR(25) NOT NULL'
'[title] NVARCHAR(25) NOT NULL'
],
[
'title',
['type' => 'string', 'length' => 25, 'null' => true, 'default' => 'ignored'],
'[title] VARCHAR(25) DEFAULT NULL'
'[title] NVARCHAR(25) DEFAULT NULL'
],
[
'id',
['type' => 'string', 'length' => 32, 'fixed' => true, 'null' => false],
'[id] CHAR(32) NOT NULL'
'[id] NCHAR(32) NOT NULL'
],
[
'id',
['type' => 'string', 'length' => 36, 'fixed' => true, 'null' => false],
['type' => 'uuid', 'null' => false],
'[id] UNIQUEIDENTIFIER NOT NULL'
],
[
'role',
['type' => 'string', 'length' => 10, 'null' => false, 'default' => 'admin'],
"[role] VARCHAR(10) NOT NULL DEFAULT [admin]"
"[role] NVARCHAR(10) NOT NULL DEFAULT [admin]"
],
[
'title',
['type' => 'string'],
'[title] VARCHAR'
'[title] NVARCHAR(255)'
],
// Text
[
'body',
['type' => 'text', 'null' => false],
'[body] TEXT NOT NULL'
'[body] NVARCHAR(MAX) NOT NULL'
],
// Integers
[
Expand Down Expand Up @@ -560,9 +560,9 @@ public function testCreateSql() {

$expected = <<<SQL
CREATE TABLE [schema_articles] (
[id] INTEGER NOT NULL,
[title] VARCHAR NOT NULL,
[body] TEXT,
[id] INTEGER IDENTITY(1, 1),
[title] NVARCHAR(255) NOT NULL,
[body] NVARCHAR(MAX),
[created] DATETIME,
PRIMARY KEY ([id])
)
Expand Down

0 comments on commit ac4f236

Please sign in to comment.