fix: "cannot remove collection" related to unused stuff

This commit is contained in:
Sonny
2025-01-21 18:14:43 +01:00
parent fb0345bf68
commit 151ac0602a
8 changed files with 22 additions and 10 deletions

View File

@@ -0,0 +1,21 @@
import { BaseSchema } from '@adonisjs/lucid/schema';
export default class extends BaseSchema {
protected tableName = 'collections';
async up() {
this.schema.alterTable('collections', (table) => {
table.dropColumn('next_id');
});
}
async down() {
this.schema.alterTable('collections', (table) => {
table
.integer('next_id')
.references('id')
.inTable('collections')
.defaultTo(null);
});
}
}

View File

@@ -34,7 +34,6 @@ function createRandomCollection(userIds: User['id'][]) {
name: faker.string.alphanumeric({ length: { min: 5, max: 25 } }),
description: faker.string.alphanumeric({ length: { min: 0, max: 254 } }),
visibility: Visibility.PRIVATE,
nextId: collectionId + 1,
authorId,
};
}