import { MigrationInterface , QueryRunner , Table } from 'typeorm' ; export class CreateGeoZoneTable1546523725119 implements MigrationInterface { public async up ( queryRunner ) { const table = new Table ( { name : 'geo_zone' , columns : [ { name : 'geo_zone_id' , type : 'int' , length : '11' , isPrimary : true , isNullable : false , isGenerated : true , generationStrategy : 'increment' , } , { name : 'name' , type : 'varchar' , length : '32' , isPrimary : false , isNullable : true , } , { name : 'description' , type : 'varchar' , length : '255' , isPrimary : false , isNullable : true , } , { name : 'is_active' , type : 'int' , length : '11' , isPrimary : false , isNullable : true , } , { name : 'created_date' , type : 'datetime' , isPrimary : false , isNullable : true , default : 'CURRENT_TIMESTAMP' , } , { name : 'modified_date' , type : 'datetime' , isPrimary : false , isNullable : true , default : 'CURRENT_TIMESTAMP' , } , { name : 'created_by' , type : 'int' , length : '11' , isPrimary : false , isNullable : true , } , { name : 'modified_by' , type : 'int' , length : '11' , isPrimary : false , isNullable : true , } , ] , } ) ; const ifExsist = await queryRunner . hasTable ( 'geo_zone' ) ; if ( ! ifExsist ) { await queryRunner . createTable ( table ) ; } } public async down ( queryRunner ) { await queryRunner . dropTable ( 'geo_zone' , true ) ; } }