22 lines
No EOL
532 B
TypeScript
22 lines
No EOL
532 B
TypeScript
import { BaseSchema } from '@adonisjs/lucid/schema'
|
|
|
|
export default class extends BaseSchema {
|
|
protected tableName = 'colle_attachments'
|
|
|
|
async up() {
|
|
this.schema.createTable(this.tableName, (table) => {
|
|
table.increments('id').primary()
|
|
table.string('name').notNullable()
|
|
table.string('path').notNullable()
|
|
table
|
|
.integer('colle_id')
|
|
.unsigned()
|
|
.references('colles.id')
|
|
.onDelete('CASCADE')
|
|
})
|
|
}
|
|
|
|
async down() {
|
|
this.schema.dropTable(this.tableName)
|
|
}
|
|
} |