Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(DB): ID columns should auto-increment #871

Merged
merged 1 commit into from
Feb 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading