mirror of
https://github.com/ArthurDanjou/artdanj-api.git
synced 2026-01-26 09:30:27 +01:00
Add PostColor and content
This commit is contained in:
@@ -30,6 +30,11 @@ export default class Posts extends BaseSchema {
|
||||
.unsigned()
|
||||
.references('translations.id')
|
||||
.onDelete('CASCADE')
|
||||
table
|
||||
.integer('post_color_id')
|
||||
.unsigned()
|
||||
.references('post_colors.id')
|
||||
.onDelete('CASCADE')
|
||||
table.timestamps(true, true)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ export default class Maintenances extends BaseSchema {
|
||||
|
||||
public async up () {
|
||||
this.schema.createTable(this.tableName, (table) => {
|
||||
table.increments('id')
|
||||
table.increments('id').primary()
|
||||
table.boolean('active').defaultTo(false).notNullable()
|
||||
table
|
||||
.integer('reason_id')
|
||||
|
||||
18
database/migrations/1630182451186_post_colors.ts
Normal file
18
database/migrations/1630182451186_post_colors.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import BaseSchema from '@ioc:Adonis/Lucid/Schema'
|
||||
|
||||
export default class PostColors extends BaseSchema {
|
||||
protected tableName = 'post_colors'
|
||||
|
||||
public async up () {
|
||||
this.schema.createTable(this.tableName, (table) => {
|
||||
table.increments('id').primary()
|
||||
table.string('name').notNullable()
|
||||
table.string('color').notNullable()
|
||||
table.timestamps(true, true)
|
||||
})
|
||||
}
|
||||
|
||||
public async down () {
|
||||
this.schema.dropTable(this.tableName)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user