aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFerdinand Thiessen <rpm@fthiessen.de>2023-02-28 10:29:10 +0100
committerbackportbot-nextcloud[bot] <backportbot-nextcloud[bot]@users.noreply.github.com>2023-03-02 11:57:43 +0000
commit2f0c60dccca026d24dfd7b9d66d8e490640beac9 (patch)
treeb6be89b870043af74db1061cc1a02155e93b7846
parentffbe94480c08ccf6c3c48e90c16e84e15ae32e29 (diff)
downloadnextcloud-server-2f0c60dccca026d24dfd7b9d66d8e490640beac9.tar.gz
nextcloud-server-2f0c60dccca026d24dfd7b9d66d8e490640beac9.zip
tests(db): Add test case to ensure column comments work
Signed-off-by: Ferdinand Thiessen <rpm@fthiessen.de>
-rw-r--r--tests/lib/DB/MigratorTest.php24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/lib/DB/MigratorTest.php b/tests/lib/DB/MigratorTest.php
index af44159efa3..6e4574688fb 100644
--- a/tests/lib/DB/MigratorTest.php
+++ b/tests/lib/DB/MigratorTest.php
@@ -237,6 +237,30 @@ class MigratorTest extends \Test\TestCase {
$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);