mirror of
https://github.com/sergeyyarkov/educt-server.git
synced 2026-10-11 10:19:20 +03:00
21 lines
574 B
TypeScript
21 lines
574 B
TypeScript
import BaseSchema from '@ioc:Adonis/Lucid/Schema';
|
|
|
|
export default class Categories extends BaseSchema {
|
|
protected tableName = 'categories';
|
|
|
|
public async up() {
|
|
this.schema.createTable(this.tableName, table => {
|
|
table.increments('id');
|
|
table.string('title').notNullable();
|
|
table.string('slug').unique().notNullable();
|
|
table.string('description');
|
|
table.timestamp('created_at', { useTz: true });
|
|
table.timestamp('updated_at', { useTz: true });
|
|
});
|
|
}
|
|
|
|
public async down() {
|
|
this.schema.dropTable(this.tableName);
|
|
}
|
|
}
|