Skip to content

Commit

Permalink
Added fallback for json type in SQL Server
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed Mar 19, 2016
1 parent b81505d commit 269bc92
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Database/Schema/SqlserverSchema.php
Expand Up @@ -310,7 +310,8 @@ public function columnSql(Table $table, $name)
'time' => ' TIME',
'datetime' => ' DATETIME',
'timestamp' => ' DATETIME',
'uuid' => ' UNIQUEIDENTIFIER'
'uuid' => ' UNIQUEIDENTIFIER',
'json' => ' NVARCHAR(MAX)',
];

if (isset($typeMap[$data['type']])) {
Expand Down
2 changes: 2 additions & 0 deletions tests/TestCase/Database/Schema/SqlserverSchemaTest.php
Expand Up @@ -773,6 +773,7 @@ public function testCreateSql()
'null' => false,
])
->addColumn('body', ['type' => 'text'])
->addColumn('data', ['type' => 'json'])
->addColumn('created', 'datetime')
->addConstraint('primary', [
'type' => 'primary',
Expand All @@ -788,6 +789,7 @@ public function testCreateSql()
[id] INTEGER IDENTITY(1, 1),
[title] NVARCHAR(255) NOT NULL,
[body] NVARCHAR(MAX),
[data] NVARCHAR(MAX),
[created] DATETIME,
PRIMARY KEY ([id])
)
Expand Down

0 comments on commit 269bc92

Please sign in to comment.