Skip to content

Commit

Permalink
fix(DB): ID columns should auto-increment
Browse files Browse the repository at this point in the history
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
  • Loading branch information
blizzz committed Mar 12, 2024
1 parent 91eb79c commit 62b8129
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/Migration/Version000800Date20240213123743.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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]);
Expand All @@ -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]);

Expand All @@ -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]);
Expand Down

0 comments on commit 62b8129

Please sign in to comment.