mirror of
https://github.com/ArthurDanjou/artdanj-api.git
synced 2026-01-14 12:14:33 +01:00
Add migration
This commit is contained in:
28
database/migrations/1628759408774_announces.ts
Normal file
28
database/migrations/1628759408774_announces.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import BaseSchema from '@ioc:Adonis/Lucid/Schema'
|
||||
|
||||
export default class Announces extends BaseSchema {
|
||||
protected tableName = 'announces'
|
||||
|
||||
public async up () {
|
||||
this.schema.createTable(this.tableName, (table) => {
|
||||
table.increments('id')
|
||||
table.string('color')
|
||||
table.string('hover_color')
|
||||
table
|
||||
.integer('message_id')
|
||||
.unsigned()
|
||||
.references('translations.id')
|
||||
.onDelete('CASCADE')
|
||||
table
|
||||
.integer('cover_id')
|
||||
.unsigned()
|
||||
.references('files.id')
|
||||
.onDelete('CASCADE')
|
||||
table.timestamps(true, true)
|
||||
})
|
||||
}
|
||||
|
||||
public async down () {
|
||||
this.schema.dropTable(this.tableName)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user