Skip to content

Commit

Permalink
add canary migration for spike
Browse files Browse the repository at this point in the history
  • Loading branch information
hotzevzl committed Sep 18, 2023
1 parent c2d251c commit 3a621b0
Showing 1 changed file with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { DataSource, MigrationInterface, QueryRunner } from 'typeorm';
import { geoprocessingConnections } from '@marxan-geoprocessing/ormconfig';
import { Logger } from '@nestjs/common';

export class CrossDbMigration1692255000000
implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {

const apiMigrationDataSource: DataSource = await(new DataSource({
...geoprocessingConnections.apiDB,
name: 'apiMigration',
})).initialize();

const apiQueryRunner = apiMigrationDataSource.createQueryRunner();
const apidbCanary = await apiQueryRunner.query(`
select name from migrations order by timestamp;
`);

const geodbCanary = await queryRunner.query(`
select name from migrations order by timestamp;
`);

Logger.debug('canary: apidb migrations');
Logger.debug(JSON.stringify(apidbCanary));
Logger.debug('canary: geodb migrations');
Logger.debug(JSON.stringify(geodbCanary));
}

public async down(queryRunner: QueryRunner): Promise<void> {
}
}

0 comments on commit 3a621b0

Please sign in to comment.