Files
artdanj-api/database/migrations/1605956711010_posts.ts
2021-06-30 22:27:07 +02:00

19 lines
455 B
TypeScript
Executable File

import BaseSchema from '@ioc:Adonis/Lucid/Schema'
export default class Posts extends BaseSchema {
protected tableName = 'posts'
public async up () {
this.schema.createTable(this.tableName, (table) => {
table.increments('id').primary()
table.string('slug').notNullable()
table.integer('likes').notNullable()
table.timestamps(true, true)
})
}
public async down () {
this.schema.dropTable(this.tableName)
}
}