fix: relations between tables

This commit is contained in:
Sonny
2024-04-28 23:25:01 +02:00
committed by Sonny
parent 97044907ee
commit 31f22d382e
6 changed files with 59 additions and 10 deletions

View File

@@ -0,0 +1,24 @@
import { BaseSchema } from '@adonisjs/lucid/schema';
export default class extends BaseSchema {
protected tableName = 'collection_link';
async up() {
this.schema.createTable(this.tableName, (table) => {
table
.uuid('collection_id')
.references('id')
.inTable('collections')
.onDelete('CASCADE');
table
.uuid('link_id')
.references('id')
.inTable('links')
.onDelete('CASCADE');
});
}
async down() {
this.schema.dropTable(this.tableName);
}
}