diff --git a/api/apps/geoprocessing/src/migrations/geoprocessing/1692255000000-CrossDbMigration.ts b/api/apps/geoprocessing/src/migrations/geoprocessing/1692255000000-CrossDbMigration.ts new file mode 100644 index 0000000000..c9b0a3a66b --- /dev/null +++ b/api/apps/geoprocessing/src/migrations/geoprocessing/1692255000000-CrossDbMigration.ts @@ -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 { + + 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 { + } +}