Add PostColor and content

This commit is contained in:
2021-08-28 22:40:24 +02:00
parent 8f81926447
commit 27cb7d4635
2 changed files with 26 additions and 10 deletions

View File

@@ -25,16 +25,6 @@ export default class Posts extends BaseSchema {
.unsigned()
.references('files.id')
.onDelete('CASCADE')
table
.integer('content_id')
.unsigned()
.references('translations.id')
.onDelete('CASCADE')
table
.integer('post_color_id')
.unsigned()
.references('post_colors.id')
.onDelete('CASCADE')
table.timestamps(true, true)
})
}

View File

@@ -0,0 +1,26 @@
import BaseSchema from '@ioc:Adonis/Lucid/Schema'
export default class Posts extends BaseSchema {
protected tableName = 'posts'
public async up () {
this.schema.table(this.tableName, (table) => {
table
.integer('content_id')
.unsigned()
.references('translations.id')
.onDelete('CASCADE')
table
.integer('post_color_id')
.unsigned()
.references('post_colors.id')
.onDelete('CASCADE')
})
}
public async down () {
this.schema.table(this.tableName, (table) => {
table.dropColumns('content_id', 'post_color_id')
})
}
}