diff --git a/blockchain_integration/PiSure/database/migrations/001-create-insurance-table.ts b/blockchain_integration/PiSure/database/migrations/001-create-insurance-table.ts new file mode 100644 index 000000000..019bac31a --- /dev/null +++ b/blockchain_integration/PiSure/database/migrations/001-create-insurance-table.ts @@ -0,0 +1,20 @@ +import { MigrationInterface, QueryRunner } from 'typeorm'; + +export class CreateInsuranceTable1589465113411 implements MigrationInterface { + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(` + CREATE TABLE insurance ( + id SERIAL PRIMARY KEY, + policy_holder VARCHAR(255) NOT NULL, + amount DECIMAL(10, 2) NOT NULL, + premium DECIMAL(10, 2) NOT NULL, + created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP + ); + `); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`DROP TABLE insurance`); + } +}