1700557040664_users.ts 729 B

12345678910111213141516171819202122
  1. import BaseSchema from '@ioc:Adonis/Lucid/Schema'
  2. export default class extends BaseSchema {
  3. protected tableName = 'users'
  4. public async up() {
  5. this.schema.createTable(this.tableName, (table) => {
  6. table.increments('id')
  7. table.timestamp('created_at', { useTz: true })
  8. table.timestamp('updated_at', { useTz: true })
  9. table.string('username', 80).notNullable().unique()
  10. table.string('phone', 120).nullable().unique()
  11. table.string('email').notNullable()
  12. table.string('password').nullable()
  13. table.string('avatar').nullable()
  14. })
  15. }
  16. public async down() {
  17. this.schema.dropTable(this.tableName)
  18. }
  19. }