import { BaseSchema } from '@adonisjs/lucid/schema' export default class extends BaseSchema { protected tableName = 'contacts' async up() { this.schema.createTable(this.tableName, (table) => { table.increments('id').notNullable() table .integer('tenant_id') .unsigned() .notNullable() .references('id') .inTable('tenants') .onDelete('CASCADE') table.string('display_name').notNullable() table.string('email').nullable() table.string('phone').nullable() table.string('status').notNullable().defaultTo('active') table.timestamp('created_at').notNullable().defaultTo(this.now()) table.timestamp('updated_at').nullable() table.index(['tenant_id', 'display_name']) }) } async down() { this.schema.dropTable(this.tableName) } }