@dogulabs/sql-migrator 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +6 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -23,13 +23,17 @@ async function runMigrations() {
23
23
  try {
24
24
  let pg = null;
25
25
  if (action !== 'new') {
26
- pg = new Pool({
26
+ const pgConfig = {
27
27
  host: process.env.PG_HOST,
28
28
  port: Number(process.env.PG_PORT),
29
29
  password: process.env.PG_PASS,
30
30
  user: process.env.PG_USER,
31
31
  database: process.env.PG_DB,
32
- });
32
+ };
33
+ if (process.env.PG_CA?.length) {
34
+ pgConfig.ssl = { ca: process.env.PG_CA };
35
+ }
36
+ pg = new Pool(pgConfig);
33
37
  await pg.query(`CREATE TABLE IF NOT EXISTS node_migrator_${type}s (
34
38
  id BIGSERIAL PRIMARY KEY,
35
39
  version VARCHAR(255) NOT NULL,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dogulabs/sql-migrator",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {