import { MigrationInterface, QueryRunner, Table } from 'typeorm'; export class CreateAssessmentCertificateTable1773210000003 implements MigrationInterface { name = 'CreateAssessmentCertificateTable1773210000003'; public async up(queryRunner: QueryRunner): Promise { await queryRunner.createTable( new Table({ name: 'assessment_certificates', columns: [ { name: 'id', type: 'uuid', isPrimary: true, generationStrategy: 'uuid', isGenerated: true, }, { name: 'user_id', type: 'uuid', isNullable: false, }, { name: 'session_id', type: 'uuid', isNullable: false, }, { name: 'template_id', type: 'uuid', isNullable: false, }, { name: 'level', type: 'varchar', length: '50', isNullable: false, }, { name: 'total_score', type: 'float', isNullable: false, }, { name: 'qr_code', type: 'varchar', length: '255', isNullable: true, }, { name: 'dimension_scores', type: 'simple-json', isNullable: true, }, { name: 'radar_data', type: 'simple-json', isNullable: true, }, { name: 'passed', type: 'boolean', default: false, }, { name: 'issued_at', type: 'timestamp', default: 'now()', }, ], }), true, ); } public async down(queryRunner: QueryRunner): Promise { await queryRunner.dropTable('assessment_certificates'); } }