import { BaseSchema } from "@adonisjs/lucid/schema" export default class CreateInternalLinksTable extends BaseSchema { protected tableName = "internal_links" public override async up(): Promise { void this.schema.createTable(this.tableName, (table) => { table.primary(["from_page_id", "to_page_id"]) table .integer("from_page_id") .unsigned() .notNullable() .references("pages.id") .onDelete("CASCADE") .onUpdate("CASCADE") table .integer("to_page_id") .unsigned() .notNullable() .references("pages.id") .onDelete("CASCADE") .onUpdate("CASCADE") }) } public override async down(): Promise { void this.schema.dropTable(this.tableName) } }