Skip to content

Commit 1785a80

Browse files
committed
tests(db): Add test case to ensure column comments work
Signed-off-by: Ferdinand Thiessen <rpm@fthiessen.de>
1 parent a9af58f commit 1785a80

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

tests/lib/DB/MigratorTest.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,30 @@ public function testReservedKeywords() {
237237
$this->addToAssertionCount(1);
238238
}
239239

240+
/**
241+
* Test for nextcloud/server#36803
242+
*/
243+
public function testColumnCommentsInUpdate() {
244+
$startSchema = new Schema([], [], $this->getSchemaConfig());
245+
$table = $startSchema->createTable($this->tableName);
246+
$table->addColumn('id', 'integer', ['autoincrement' => true, 'comment' => 'foo']);
247+
$table->setPrimaryKey(['id']);
248+
249+
$endSchema = new Schema([], [], $this->getSchemaConfig());
250+
$table = $endSchema->createTable($this->tableName);
251+
$table->addColumn('id', 'integer', ['autoincrement' => true, 'comment' => 'foo']);
252+
// Assert adding comments on existing tables work (or at least does not throw)
253+
$table->addColumn('time', 'integer', ['comment' => 'unix-timestamp', 'notnull' => false]);
254+
$table->setPrimaryKey(['id']);
255+
256+
$migrator = $this->getMigrator();
257+
$migrator->migrate($startSchema);
258+
259+
$migrator->migrate($endSchema);
260+
261+
$this->addToAssertionCount(1);
262+
}
263+
240264
public function testAddingForeignKey() {
241265
$startSchema = new Schema([], [], $this->getSchemaConfig());
242266
$table = $startSchema->createTable($this->tableName);

0 commit comments

Comments
 (0)