Skip to content

Commit

Permalink
tests(db): Add test case to ensure column comments work
Browse files Browse the repository at this point in the history
Signed-off-by: Ferdinand Thiessen <rpm@fthiessen.de>
  • Loading branch information
susnux authored and backportbot-nextcloud[bot] committed Mar 2, 2023
1 parent ba49c33 commit d91f27b
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/lib/DB/MigratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,30 @@ public function testReservedKeywords() {
$this->addToAssertionCount(1);
}

/**
* Test for nextcloud/server#36803
*/
public function testColumnCommentsInUpdate() {
$startSchema = new Schema([], [], $this->getSchemaConfig());
$table = $startSchema->createTable($this->tableName);
$table->addColumn('id', 'integer', ['autoincrement' => true, 'comment' => 'foo']);
$table->setPrimaryKey(['id']);

$endSchema = new Schema([], [], $this->getSchemaConfig());
$table = $endSchema->createTable($this->tableName);
$table->addColumn('id', 'integer', ['autoincrement' => true, 'comment' => 'foo']);
// Assert adding comments on existing tables work (or at least does not throw)
$table->addColumn('time', 'integer', ['comment' => 'unix-timestamp', 'notnull' => false]);
$table->setPrimaryKey(['id']);

$migrator = $this->getMigrator();
$migrator->migrate($startSchema);

$migrator->migrate($endSchema);

$this->addToAssertionCount(1);
}

public function testAddingForeignKey() {
$startSchema = new Schema([], [], $this->getSchemaConfig());
$table = $startSchema->createTable($this->tableName);
Expand Down

0 comments on commit d91f27b

Please sign in to comment.