import { MigrationInterface, QueryRunner } from "typeorm";

export class Migrations1739361465909 implements MigrationInterface {
    name = 'Migrations1739361465909'

    public async up(queryRunner: QueryRunner): Promise<void> {
        await queryRunner.query(`CREATE TABLE "currency_rates" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "currency" character varying, "symbol" character varying, "rate" numeric(10,2) NOT NULL DEFAULT '0', "created_at" TIMESTAMP(0) NOT NULL DEFAULT now(), "updated_at" TIMESTAMP(0) NOT NULL DEFAULT now(), "deleted_at" TIMESTAMP(0), "updated_by" uuid, CONSTRAINT "PK_43636e55d92705f102d2a6e75a0" PRIMARY KEY ("id"))`);
        await queryRunner.query(`ALTER TABLE "currency_rates" ADD CONSTRAINT "FK_a1f98726d8a21a315f6ef79baf9" FOREIGN KEY ("updated_by") REFERENCES "users"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`);
    }

    public async down(queryRunner: QueryRunner): Promise<void> {
        await queryRunner.query(`ALTER TABLE "currency_rates" DROP CONSTRAINT "FK_a1f98726d8a21a315f6ef79baf9"`);
        await queryRunner.query(`DROP TABLE "currency_rates"`);
    }

}
