Skip to content

Commit a11db88

Browse files
authored
Merge pull request #6892 from morozov/sqlite-quote-comment
Do not trim single quote in comments on SQLite
2 parents 83cf7e1 + 1332fee commit a11db88

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

src/Platforms/SQLitePlatform.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
use function strpos;
3838
use function strtolower;
3939
use function substr;
40-
use function trim;
4140

4241
/**
4342
* The SQLitePlatform class describes the specifics and dialects of the SQLite
@@ -288,9 +287,7 @@ protected function _getCreateTableSQL(string $name, array $columns, array $optio
288287

289288
$tableComment = '';
290289
if (isset($options['comment'])) {
291-
$comment = trim($options['comment'], " '");
292-
293-
$tableComment = $this->getInlineTableCommentSQL($comment);
290+
$tableComment = $this->getInlineTableCommentSQL($options['comment']);
294291
}
295292

296293
$query = ['CREATE TABLE ' . $name . ' ' . $tableComment . '(' . $queryFields . ')'];

tests/Functional/Schema/SchemaManagerFunctionalTestCase.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1202,11 +1202,11 @@ public function testCommentInTable(): void
12021202
{
12031203
$table = new Table('table_with_comment');
12041204
$table->addColumn('id', Types::INTEGER);
1205-
$table->setComment('Foo with control characters \'\\');
1205+
$table->setComment('\'\\ Foo with control characters \'\\');
12061206
$this->dropAndCreateTable($table);
12071207

12081208
$table = $this->schemaManager->introspectTable('table_with_comment');
1209-
self::assertSame('Foo with control characters \'\\', $table->getComment());
1209+
self::assertSame('\'\\ Foo with control characters \'\\', $table->getComment());
12101210
}
12111211

12121212
public function testCreatedCompositeForeignKeyOrderIsCorrectAfterCreation(): void

0 commit comments

Comments
 (0)