Skip to content

Commit 1bdb732

Browse files
authored
Include comments in generated column sql (cakephp#18256)
1 parent c404122 commit 1bdb732

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/Database/Schema/SqliteSchemaDialect.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -840,6 +840,9 @@ public function columnDefinitionSql(array $column): string
840840
if (isset($column['default'])) {
841841
$out .= ' DEFAULT ' . $this->_driver->schemaValue($column['default']);
842842
}
843+
if (isset($column['comment']) && $column['comment']) {
844+
$out .= " /* {$column['comment']} */";
845+
}
843846

844847
return $out;
845848
}

tests/TestCase/Database/Schema/SqliteSchemaDialectTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -917,8 +917,8 @@ public static function columnSqlProvider(): array
917917
// Text
918918
[
919919
'body',
920-
['type' => 'text', 'null' => false],
921-
'"body" TEXT NOT NULL',
920+
['type' => 'text', 'null' => false, 'comment' => 'a comment'],
921+
'"body" TEXT NOT NULL /* a comment */',
922922
],
923923
[
924924
'body',

0 commit comments

Comments
 (0)