Skip to content

Commit

Permalink
feat: create file migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
Kingcedru committed Dec 10, 2024
1 parent ba8fc20 commit 4aa27fe
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions apps/drec-api/migrations/1733820066628-file-processing-type.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import {MigrationInterface, QueryRunner, Table} from "typeorm";

export class fileProcessingType1733820066628 implements MigrationInterface {

public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.createTable(
new Table({
name: 'file_processing_jobs',
columns: [
{
name: 'id',
type: 'uuid',
isPrimary: true,
generationStrategy: 'uuid',
default: 'uuid_generate_v4()',
},
{
name: 'fileId',
type: 'varchar',
},
{
name: 'userId',
type: 'integer',
},
{
name: 'organizationId',
type: 'integer',
},
{
name: 'status',
type: 'enum',
enum: ['Pending', 'InProgress', 'Completed', 'Failed'],
},
{
name: 'type',
type: 'enum',
enum: ['MeterRead', 'DeviceCreation'],
},
{
name: 'apiUserId',
type: 'varchar',
isNullable: true,
default: null,
},
{
name: 'createdAt',
type: 'timestamp',
default: 'CURRENT_TIMESTAMP',
},
],
}),
);
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.dropTable('file_processing_jobs');
}
}

0 comments on commit 4aa27fe

Please sign in to comment.