postgres-schema-migrations 6.0.3 → 6.1.0

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.
package/dist/migrate.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Config, MigrateDBConfig, Migration } from "./types";
1
+ import { BasicPgClient, Config, MigrateDBConfig, Migration } from "./types";
2
2
  /**
3
3
  * Run the migrations.
4
4
  *
@@ -11,3 +11,5 @@ import { Config, MigrateDBConfig, Migration } from "./types";
11
11
  * @returns Details about the migrations which were run
12
12
  */
13
13
  export declare function migrate(dbConfig: MigrateDBConfig, migrationsDirectory: string, config?: Config): Promise<Array<Migration>>;
14
+ /** Check whether table exists in postgres - http://stackoverflow.com/a/24089729 */
15
+ export declare function doesTableExist(client: BasicPgClient, tableName: string): Promise<any>;
package/dist/migrate.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.migrate = void 0;
3
+ exports.doesTableExist = exports.migrate = void 0;
4
4
  const pg = require("pg");
5
5
  const sql_template_strings_1 = require("sql-template-strings");
6
6
  const create_1 = require("./create");
@@ -106,8 +106,9 @@ function runMigrations(intendedMigrations, log, schemaName = "public") {
106
106
  return completedMigrations;
107
107
  }
108
108
  catch (e) {
109
- const error = new Error(`Migration failed. Reason: ${e.message}`);
110
- error.cause = e;
109
+ const exception = e;
110
+ const error = new Error(`Migration failed. Reason: ${exception.message}`);
111
+ error.cause = exception.message;
111
112
  throw error;
112
113
  }
113
114
  };
@@ -156,3 +157,4 @@ async function doesTableExist(client, tableName) {
156
157
  `);
157
158
  return result.rows.length > 0 && result.rows[0].exists;
158
159
  }
160
+ exports.doesTableExist = doesTableExist;
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "postgres-schema-migrations",
3
- "version": "6.0.3",
3
+ "version": "6.1.0",
4
4
  "description": "Stack Overflow style database migrations for PostgreSQL",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -31,7 +31,7 @@
31
31
  },
32
32
  "scripts": {
33
33
  "checkPushed": "[ \"$(git rev-list --count @{upstream}..HEAD)\" -eq 0 ] || (echo You have unpushed commits && exit 1)",
34
- "prepublishOnly": "npm run checkPushed && npm test && npm run build",
34
+ "prepublishOnly": "npm run checkPushed && npm run build",
35
35
  "check-formatting": "./node_modules/.bin/prettier '**/*.ts' --list-different",
36
36
  "fix-formatting": "./node_modules/.bin/prettier '**/*.ts' --write",
37
37
  "lint": "npm run tslint && npm run check-formatting",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "postgres-schema-migrations",
3
- "version": "6.0.3",
3
+ "version": "6.1.0",
4
4
  "description": "Stack Overflow style database migrations for PostgreSQL",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -31,7 +31,7 @@
31
31
  },
32
32
  "scripts": {
33
33
  "checkPushed": "[ \"$(git rev-list --count @{upstream}..HEAD)\" -eq 0 ] || (echo You have unpushed commits && exit 1)",
34
- "prepublishOnly": "npm run checkPushed && npm test && npm run build",
34
+ "prepublishOnly": "npm run checkPushed && npm run build",
35
35
  "check-formatting": "./node_modules/.bin/prettier '**/*.ts' --list-different",
36
36
  "fix-formatting": "./node_modules/.bin/prettier '**/*.ts' --write",
37
37
  "lint": "npm run tslint && npm run check-formatting",