import { MigrationInterface , QueryRunner , Table } from 'typeorm' ; import { commonFields } from '../common.fields' ; const tableName = 'admin.users' ; export class createUsersTable1610321042350 implements MigrationInterface { public async up ( queryRunner ) { await queryRunner . createTable ( new Table ( { name : tableName , columns : [ { name : 'id' , type : 'uuid' , isPrimary : true , generationStrategy : 'uuid' , isGenerated : true , isNullable : false , } , { name : 'username' , type : 'varchar' , length : '20' , isUnique : true , isNullable : false , } , { name : 'first_name' , type : 'varchar' , length : '100' , isNullable : false , } , { name : 'last_name' , type : 'varchar' , length : '100' , isNullable : false , } , { name : 'password' , type : 'varchar' , isNullable : false , } , { name : 'is_super_user' , type : 'boolean' , isNullable : false , default : false , } , { name : 'status' , type : 'user_status' , isNullable : false , } , ... commonFields , ] , } ) , true ) ; } public async down ( queryRunner ) { await queryRunner . dropTable ( tableName , true ) ; } }