Skip to content

Commit

Permalink
Create 001-create-insurance-table.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
KOSASIH authored Aug 6, 2024
1 parent a456c77 commit cb29597
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { MigrationInterface, QueryRunner } from 'typeorm';

export class CreateInsuranceTable1589465113411 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {
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<void> {
await queryRunner.query(`DROP TABLE insurance`);
}
}

0 comments on commit cb29597

Please sign in to comment.