From d5a4578cf9bd3236009e9671ea69ecbcf5f8eda7 Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Fri, 23 Feb 2024 20:35:55 +0100 Subject: [PATCH] fix(DB): ID columns should auto-increment Signed-off-by: Arthur Schiwon --- lib/Migration/Version000800Date20240213123743.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/Migration/Version000800Date20240213123743.php b/lib/Migration/Version000800Date20240213123743.php index 1db07f250..cc9f23430 100644 --- a/lib/Migration/Version000800Date20240213123743.php +++ b/lib/Migration/Version000800Date20240213123743.php @@ -65,7 +65,7 @@ protected function shouldAddTable(string $tableName, ISchemaWrapper $schema): ?T */ protected function haveContextTable(ISchemaWrapper $schema): void { if ($table = $this->shouldAddTable(self::PREFIX . 'context', $schema)) { - $table->addColumn('id', Types::INTEGER, ['notnull' => true]); + $table->addColumn('id', Types::INTEGER, ['autoincrement' => true, 'notnull' => true]); $table->addColumn('name', Types::STRING, ['notnull' => true, 'length' => 200]); $table->addColumn('icon', Types::STRING, ['notnull' => true, 'length' => 64]); $table->addColumn('description', Types::TEXT); @@ -81,7 +81,7 @@ protected function haveContextTable(ISchemaWrapper $schema): void { */ protected function haveContextNodeRelationTable(ISchemaWrapper $schema): void { if ($table = $this->shouldAddTable(self::PREFIX . 'rel_context_node', $schema)) { - $table->addColumn('id', Types::INTEGER, ['notnull' => true]); + $table->addColumn('id', Types::INTEGER, ['autoincrement' => true, 'notnull' => true]); $table->addColumn('context_id', Types::INTEGER, ['notnull' => true]); $table->addColumn('node_id', Types::INTEGER, ['notnull' => true]); $table->addColumn('node_type', Types::STRING, ['notnull' => true, 'length' => 50]); @@ -96,7 +96,7 @@ protected function haveContextNodeRelationTable(ISchemaWrapper $schema): void { */ protected function havePageTable(ISchemaWrapper $schema): void { if ($table = $this->shouldAddTable(self::PREFIX . 'page', $schema)) { - $table->addColumn('id', Types::INTEGER, ['notnull' => true]); + $table->addColumn('id', Types::INTEGER, ['autoincrement' => true, 'notnull' => true]); $table->addColumn('context_id', Types::INTEGER, ['notnull' => true]); $table->addColumn('page_type', Types::STRING, ['notnull' => true, 'length' => 32]); @@ -109,7 +109,7 @@ protected function havePageTable(ISchemaWrapper $schema): void { */ protected function havePageContentTable(ISchemaWrapper $schema): void { if ($table = $this->shouldAddTable(self::PREFIX . 'page_content', $schema)) { - $table->addColumn('id', Types::INTEGER, ['notnull' => true]); + $table->addColumn('id', Types::INTEGER, ['autoincrement' => true, 'notnull' => true]); $table->addColumn('page_id', Types::INTEGER, ['notnull' => true]); $table->addColumn('node_rel_id', Types::INTEGER, ['notnull' => true]); $table->addColumn('order', Types::INTEGER, ['notnull' => true]);