Skip to content

Commit

Permalink
Upgrade PostgreSQL to v16 (#1441)
Browse files Browse the repository at this point in the history
* Update docker-compose.yml

* update tests

* Add ssl
  • Loading branch information
ericboucher authored Feb 27, 2025
1 parent ec8c97f commit 5431cdf
Show file tree
Hide file tree
Showing 5 changed files with 229 additions and 122 deletions.
2 changes: 1 addition & 1 deletion alerting/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: '3'
services:
alerting-db:
image: kartoza/postgis:12.1
image: kartoza/postgis:16-3
restart: always
ports:
- 54321:5432
Expand Down
12 changes: 11 additions & 1 deletion alerting/ormconfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@ try {

// If we have a PRISM_ALERTS_DATABASE_URL, use that
const connectionInfo = process.env.PRISM_ALERTS_DATABASE_URL
? { url: process.env.PRISM_ALERTS_DATABASE_URL }
? {
url: process.env.PRISM_ALERTS_DATABASE_URL,
ssl:
process.env.POSTGRES_SSL === 'true'
? true
: { rejectUnauthorized: false },
}
: {
host: process.env.POSTGRES_HOST || 'localhost',
port:
Expand All @@ -24,6 +30,10 @@ const connectionInfo = process.env.PRISM_ALERTS_DATABASE_URL
...(process.env.POSTGRES_PASSWORD && {
password: process.env.POSTGRES_PASSWORD,
}),
ssl:
process.env.POSTGRES_SSL === 'true'
? true
: { rejectUnauthorized: false },
};

// Unfortunately, we need to use CommonJS/AMD style exports rather than ES6-style modules for this due to how
Expand Down
2 changes: 1 addition & 1 deletion alerting/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"pg": "^8.5.1",
"prism-common": "file:../common",
"puppeteer": "^24.1.1",
"typeorm": "0.2.31",
"typeorm": "^0.3.20",
"typeorm-naming-strategies": "^1.1.0",
"xml-js": "^1.6.11"
},
Expand Down
10 changes: 2 additions & 8 deletions alerting/src/aa-storm-alert/worker.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { buildAnticipatoryActionAlerts } from './test-utils';
import { run } from './worker';
import { ILike } from 'typeorm';

jest.mock('../entities/anticipatoryActionAlerts.entity');

Expand Down Expand Up @@ -79,14 +80,7 @@ describe('worker', () => {
);
expect(mockedUpdate).toHaveBeenCalledWith(
{
country: {
_type: 'ilike',
_value: 'mozambique',
_useParameter: true,
_multipleParameters: false,
_objectLiteralParameters: undefined,
_getSql: undefined,
},
country: ILike('mozambique'),
},
{
lastStates: {
Expand Down
Loading

0 comments on commit 5431cdf

Please sign in to comment.