-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Minor improvements to assist with native execution and db setup loading
- Loading branch information
Showing
10 changed files
with
215 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
api/apps/api/src/migrations/api/1608149578000-EnablePostgis.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { Logger } from '@nestjs/common'; | ||
import { MigrationInterface, QueryRunner } from 'typeorm'; | ||
import { PostgreSQLUtils } from '@marxan-api/utils/postgresql.utils'; | ||
|
||
export class EnablePostgis1608149578000 implements MigrationInterface { | ||
async up(queryRunner: QueryRunner): Promise<any> { | ||
if (await PostgreSQLUtils.version13Plus()) { | ||
await queryRunner.query(` | ||
CREATE EXTENSION IF NOT EXISTS postgis; | ||
`); | ||
} else { | ||
Logger.warn( | ||
'The PostgreSQL extension `postgis` is needed for the Marxan API but it was not possible to activate it. Please activate it manually (see setup documentation).', | ||
); | ||
} | ||
} | ||
|
||
async down(queryRunner: QueryRunner): Promise<any> { | ||
if (await PostgreSQLUtils.version13Plus()) { | ||
await queryRunner.query(` | ||
DROP EXTENSION IF EXISTS postgis; | ||
`); | ||
} | ||
} | ||
} |
Oops, something went wrong.