Files
artdanj-api/database/migrations/1608415261417_projects.ts
2021-08-23 13:23:16 +02:00

29 lines
714 B
TypeScript

import BaseSchema from '@ioc:Adonis/Lucid/Schema'
export default class Projects extends BaseSchema {
protected tableName = 'projects'
public async up () {
this.schema.createTable(this.tableName, (table) => {
table.increments('id').primary()
table.string('name').notNullable()
table
.integer('description_id')
.unsigned()
.references('translations.id')
.onDelete('CASCADE')
table.string('url').notNullable()
table
.integer('file_id')
.unsigned()
.references('files.id')
.onDelete('CASCADE')
table.timestamps(true, true)
})
}
public async down () {
this.schema.dropTable(this.tableName)
}
}