Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update SQLServerPlatform default clob type from varchar to nvarchar #6138

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Platforms/SQLServerPlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -1354,7 +1354,7 @@ public function getBinaryMaxLength()
*/
public function getClobTypeDeclarationSQL(array $column)
{
return 'VARCHAR(MAX)';
return 'NVARCHAR(MAX)';
}

/**
Expand Down
20 changes: 10 additions & 10 deletions tests/Platforms/SQLServerPlatformTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@ public function testGeneratesTypeDeclarationsForStrings(): void
'NVARCHAR(255)',
$this->platform->getStringTypeDeclarationSQL([]),
);
self::assertSame('VARCHAR(MAX)', $this->platform->getClobTypeDeclarationSQL([]));
self::assertSame('NVARCHAR(MAX)', $this->platform->getClobTypeDeclarationSQL([]));
self::assertSame(
'VARCHAR(MAX)',
'NVARCHAR(MAX)',
$this->platform->getClobTypeDeclarationSQL(['length' => 5, 'fixed' => true]),
);
}
Expand Down Expand Up @@ -747,7 +747,7 @@ public function getAlterTableColumnCommentsSQL(): array
public function getCreateTableColumnTypeCommentsSQL(): array
{
return [
'CREATE TABLE test (id INT NOT NULL, data VARCHAR(MAX) NOT NULL, PRIMARY KEY (id))',
'CREATE TABLE test (id INT NOT NULL, data NVARCHAR(MAX) NOT NULL, PRIMARY KEY (id))',
"EXEC sp_addextendedproperty N'MS_Description', N'(DC2Type:array)', "
. "N'SCHEMA', 'dbo', N'TABLE', 'test', N'COLUMN', data",
];
Expand Down Expand Up @@ -786,8 +786,8 @@ public function testGeneratesCreateTableSQLWithColumnComments(): void
. 'comment INT NOT NULL, '
. '[comment_quoted] INT NOT NULL, '
. '[create] INT NOT NULL, '
. 'commented_type VARCHAR(MAX) NOT NULL, '
. 'commented_type_with_comment VARCHAR(MAX) NOT NULL, '
. 'commented_type NVARCHAR(MAX) NOT NULL, '
. 'commented_type_with_comment NVARCHAR(MAX) NOT NULL, '
. 'comment_with_string_literal_char NVARCHAR(255) NOT NULL, '
. 'PRIMARY KEY (id))',
"EXEC sp_addextendedproperty N'MS_Description', "
Expand Down Expand Up @@ -994,14 +994,14 @@ public function testGeneratesAlterTableSQLWithColumnComments(): void
'ALTER TABLE mytable ADD added_comment INT NOT NULL',
'ALTER TABLE mytable ADD [added_comment_quoted] INT NOT NULL',
'ALTER TABLE mytable ADD [select] INT NOT NULL',
'ALTER TABLE mytable ADD added_commented_type VARCHAR(MAX) NOT NULL',
'ALTER TABLE mytable ADD added_commented_type_with_comment VARCHAR(MAX) NOT NULL',
'ALTER TABLE mytable ADD added_commented_type NVARCHAR(MAX) NOT NULL',
'ALTER TABLE mytable ADD added_commented_type_with_comment NVARCHAR(MAX) NOT NULL',
'ALTER TABLE mytable ADD added_comment_with_string_literal_char NVARCHAR(255) NOT NULL',
'ALTER TABLE mytable DROP COLUMN comment_integer_0',
'ALTER TABLE mytable ALTER COLUMN comment_null NVARCHAR(255) NOT NULL',
'ALTER TABLE mytable ALTER COLUMN comment_empty_string VARCHAR(MAX) NOT NULL',
'ALTER TABLE mytable ALTER COLUMN [comment_quoted] VARCHAR(MAX) NOT NULL',
'ALTER TABLE mytable ALTER COLUMN [create] VARCHAR(MAX) NOT NULL',
'ALTER TABLE mytable ALTER COLUMN comment_empty_string NVARCHAR(MAX) NOT NULL',
'ALTER TABLE mytable ALTER COLUMN [comment_quoted] NVARCHAR(MAX) NOT NULL',
'ALTER TABLE mytable ALTER COLUMN [create] NVARCHAR(MAX) NOT NULL',
'ALTER TABLE mytable ALTER COLUMN commented_type INT NOT NULL',

// Added columns.
Expand Down
Loading