mirror of
https://github.com/ArthurDanjou/artdanj-api.git
synced 2026-01-14 20:19:26 +01:00
Add PostColor and content
This commit is contained in:
@@ -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)
|
||||
})
|
||||
}
|
||||
|
||||
26
database/migrations/1630183188499_posts.ts
Normal file
26
database/migrations/1630183188499_posts.ts
Normal 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')
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user