This commit is contained in:
2026-09-02 09:19:43 +03:00
parent 74cb5b6176
commit 962f489142
34 changed files with 1190 additions and 124 deletions
@@ -0,0 +1,29 @@
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)
}
}