Skip to content

Commit

Permalink
Fix migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
amateima committed Jan 13, 2025
1 parent 975f323 commit ca4498f
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 83 deletions.
2 changes: 1 addition & 1 deletion packages/indexer-database/src/entities/HistoricPrice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
} from "typeorm";

@Entity()
@Unique("UK_historic_price_baseCurrency_quoteCurrency_date", [
@Unique("UK_hp_baseCurrency_quoteCurrency_date", [
"baseCurrency",
"quoteCurrency",
"date",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,17 @@ export class HistoricPrice1734616435674 implements MigrationInterface {
name = "HistoricPrice1734616435674";

public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`CREATE TABLE "historic_price" ("id" SERIAL NOT NULL, "baseCurrency" character varying NOT NULL, "quoteCurrency" character varying NOT NULL DEFAULT 'usd', "date" date NOT NULL, "price" numeric NOT NULL, "createdAt" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "UK_historic_price_baseCurrency_quoteCurrency_date" UNIQUE ("baseCurrency", "quoteCurrency", "date"), CONSTRAINT "PK_77dc3f4978cdfb03f1bb3a7444b" PRIMARY KEY ("id"))`,
);
await queryRunner.query(`
CREATE TABLE "historic_price" (
"id" SERIAL NOT NULL,
"baseCurrency" character varying NOT NULL,
"quoteCurrency" character varying NOT NULL DEFAULT 'usd',
"date" date NOT NULL,
"price" double precision NOT NULL,
"createdAt" TIMESTAMP NOT NULL DEFAULT now(),
CONSTRAINT "UK_hp_baseCurrency_quoteCurrency_date" UNIQUE ("baseCurrency", "quoteCurrency", "date"),
CONSTRAINT "PK_77dc3f4978cdfb03f1bb3a7444b" PRIMARY KEY ("id"))
`);
}

public async down(queryRunner: QueryRunner): Promise<void> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,25 @@ export class RelayHashInfo1735922359359 implements MigrationInterface {

public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "relay_hash_info" ADD "bridgeFeeUsd" character varying`,
`ALTER TABLE "relay_hash_info" ADD "bridgeFeeUsd" double precision`,
);
await queryRunner.query(
`ALTER TABLE "relay_hash_info" ADD "inputPriceUsd" double precision`,
);
await queryRunner.query(
`ALTER TABLE "relay_hash_info" ADD "outputPriceUsd" double precision`,
);
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "relay_hash_info" DROP COLUMN "bridgeFeeUsd"`,
);
await queryRunner.query(
`ALTER TABLE "relay_hash_info" DROP COLUMN "outputPriceUsd"`,
);
await queryRunner.query(
`ALTER TABLE "relay_hash_info" DROP COLUMN "inputPriceUsd"`,
);
}
}

This file was deleted.

This file was deleted.

0 comments on commit ca4498f

Please sign in to comment.