diff options
author | Ferdinand Thiessen <rpm@fthiessen.de> | 2023-02-28 10:29:10 +0100 |
---|---|---|
committer | Ferdinand Thiessen <rpm@fthiessen.de> | 2023-02-28 10:39:13 +0100 |
commit | 1785a80754f57b9f98285a0b98e19af8f2afbdd6 (patch) | |
tree | 86336bebb753235a1e7ae41e9bacf4f2bdf5c054 /tests | |
parent | a9af58fd1a42c038a4008d2612eda6a9c362a91a (diff) | |
download | nextcloud-server-1785a80754f57b9f98285a0b98e19af8f2afbdd6.tar.gz nextcloud-server-1785a80754f57b9f98285a0b98e19af8f2afbdd6.zip |
tests(db): Add test case to ensure column comments work
Signed-off-by: Ferdinand Thiessen <rpm@fthiessen.de>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/DB/MigratorTest.php | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/lib/DB/MigratorTest.php b/tests/lib/DB/MigratorTest.php index af56730f9f6..6a2b113a796 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); |