1701165136391_categories.ts 618 B

12345678910111213141516171819202122
  1. import BaseSchema from '@ioc:Adonis/Lucid/Schema'
  2. export default class extends BaseSchema {
  3. protected tableName = 'categories'
  4. public async up() {
  5. this.schema.createTable(this.tableName, (table) => {
  6. table.increments('id')
  7. /**
  8. * Uses timestamptz for PostgreSQL and DATETIME2 for MSSQL
  9. */
  10. table.datetime('created_at', { useTz: true })
  11. table.datetime('updated_at', { useTz: true })
  12. table.string('name').notNullable()
  13. })
  14. }
  15. public async down() {
  16. this.schema.dropTable(this.tableName)
  17. }
  18. }