Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-pg-migrate

Package Overview
Dependencies
Maintainers
3
Versions
179
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-pg-migrate - npm Package Compare versions

Comparing version 5.10.0 to 6.0.0

7

CHANGELOG.md
# Change Log
## [5.10.0](2021-06-29)
### Added
- Make the json5 dependency optional (fallback to JSON.parse) [#752](https://github.com/salsita/node-pg-migrate/pull/752)
- export ConnectionConfig, ClientConfig from pg [#657](https://github.com/salsita/node-pg-migrate/pull/657)
## [5.9.0](2020-11-04)

@@ -4,0 +11,0 @@

2

dist/db.js

@@ -27,3 +27,3 @@ "use strict";

connectionStatus = ConnectionStatus.ERROR;
logger.error(`could not connect to postgres: ${util_1.inspect(err)}`);
logger.error(`could not connect to postgres: ${(0, util_1.inspect)(err)}`);
return reject(err);

@@ -30,0 +30,0 @@ }

@@ -61,4 +61,4 @@ "use strict";

typeShorthands,
schemalize: utils_1.createSchemalize(shouldDecamelize, false),
literal: utils_1.createSchemalize(shouldDecamelize, true),
schemalize: (0, utils_1.createSchemalize)(shouldDecamelize, false),
literal: (0, utils_1.createSchemalize)(shouldDecamelize, true),
logger,

@@ -65,0 +65,0 @@ };

@@ -32,3 +32,3 @@ "use strict";

try {
const files = await exports.loadMigrationFiles(dir, ignorePattern);
const files = await (0, exports.loadMigrationFiles)(dir, ignorePattern);
return files.length > 0 ? getSuffixFromFileName(files[files.length - 1]) : undefined;

@@ -67,3 +67,3 @@ }

this.name = path_1.default.basename(migrationPath, path_1.default.extname(migrationPath));
this.timestamp = exports.getTimestamp(logger, this.name);
this.timestamp = (0, exports.getTimestamp)(logger, this.name);
this.up = up;

@@ -100,3 +100,3 @@ this.down = down;

_getMarkAsRun(action) {
const schema = utils_1.getMigrationTableSchema(this.options);
const schema = (0, utils_1.getMigrationTableSchema)(this.options);
const { migrationsTable } = this.options;

@@ -103,0 +103,0 @@ const { name } = this;

@@ -24,3 +24,3 @@ "use strict";

if (defaultValue !== undefined) {
constraints.push(`DEFAULT ${utils_1.escapeValue(defaultValue)}`);
constraints.push(`DEFAULT ${(0, utils_1.escapeValue)(defaultValue)}`);
}

@@ -42,3 +42,3 @@ if (notNull && check) {

const constraintsStr = constraints.length ? ` ${constraints.join(' ')}` : '';
const typeStr = utils_1.applyType(type, mOptions.typeShorthands).type;
const typeStr = (0, utils_1.applyType)(type, mOptions.typeShorthands).type;
const domainNameStr = mOptions.literal(domainName);

@@ -59,3 +59,3 @@ return `CREATE DOMAIN ${domainNameStr} AS ${typeStr}${constraintsStr};`;

else if (defaultValue !== undefined) {
actions.push(`SET DEFAULT ${utils_1.escapeValue(defaultValue)}`);
actions.push(`SET DEFAULT ${(0, utils_1.escapeValue)(defaultValue)}`);
}

@@ -62,0 +62,0 @@ if (notNull) {

@@ -10,3 +10,3 @@ "use strict";

const cascadeStr = cascade ? ' CASCADE' : '';
const paramsStr = utils_1.formatParams(functionParams, mOptions);
const paramsStr = (0, utils_1.formatParams)(functionParams, mOptions);
const functionNameStr = mOptions.literal(functionName);

@@ -41,7 +41,7 @@ return `DROP FUNCTION${ifExistsStr} ${functionNameStr}${paramsStr}${cascadeStr};`;

const replaceStr = replace ? ' OR REPLACE' : '';
const paramsStr = utils_1.formatParams(functionParams, mOptions);
const paramsStr = (0, utils_1.formatParams)(functionParams, mOptions);
const functionNameStr = mOptions.literal(functionName);
return `CREATE${replaceStr} FUNCTION ${functionNameStr}${paramsStr}
RETURNS ${returns}
AS ${utils_1.escapeValue(definition)}
AS ${(0, utils_1.escapeValue)(definition)}
${options.join('\n ')};`;

@@ -55,3 +55,3 @@ };

const _rename = (oldFunctionName, functionParams = [], newFunctionName) => {
const paramsStr = utils_1.formatParams(functionParams, mOptions);
const paramsStr = (0, utils_1.formatParams)(functionParams, mOptions);
const oldFunctionNameStr = mOptions.literal(oldFunctionName);

@@ -58,0 +58,0 @@ const newFunctionNameStr = mOptions.literal(newFunctionName);

@@ -80,7 +80,7 @@ "use strict";

}
const paramsStr = params.length > 0 ? utils_1.formatParams(params, mOptions) : '';
const paramsStr = params.length > 0 ? (0, utils_1.formatParams)(params, mOptions) : '';
return `OPERATOR ${number} ${nameStr}${paramsStr}`;
}
if (String(type).toLowerCase() === 'operator') {
const paramsStr = utils_1.formatParams(params, mOptions);
const paramsStr = (0, utils_1.formatParams)(params, mOptions);
return `FUNCTION ${number} ${nameStr}${paramsStr}`;

@@ -107,3 +107,3 @@ }

};
method.reverse = exports.removeFromOperatorFamily(mOptions);
method.reverse = (0, exports.removeFromOperatorFamily)(mOptions);
return method;

@@ -138,3 +138,3 @@ };

const defaultStr = isDefault ? ' DEFAULT' : '';
const typeStr = mOptions.literal(utils_1.applyType(type).type);
const typeStr = mOptions.literal((0, utils_1.applyType)(type).type);
const indexMethodStr = mOptions.literal(indexMethod);

@@ -141,0 +141,0 @@ const familyStr = family ? ` FAMILY ${family}` : '';

@@ -6,3 +6,3 @@ "use strict";

function sql(mOptions) {
const t = utils_1.createTransformer(mOptions.literal);
const t = (0, utils_1.createTransformer)(mOptions.literal);
return (sqlStr, args) => {

@@ -9,0 +9,0 @@ let s = t(sqlStr, args);

@@ -33,6 +33,6 @@ "use strict";

const encrypted = roleOptions.encrypted === false ? 'UNENCRYPTED' : 'ENCRYPTED';
options.push(`${encrypted} PASSWORD ${utils_1.escapeValue(roleOptions.password)}`);
options.push(`${encrypted} PASSWORD ${(0, utils_1.escapeValue)(roleOptions.password)}`);
}
if (roleOptions.valid !== undefined) {
const valid = roleOptions.valid ? utils_1.escapeValue(roleOptions.valid) : "'infinity'";
const valid = roleOptions.valid ? (0, utils_1.escapeValue)(roleOptions.valid) : "'infinity'";
options.push(`VALID UNTIL ${valid}`);

@@ -39,0 +39,0 @@ }

@@ -9,3 +9,3 @@ "use strict";

if (type) {
clauses.push(`AS ${utils_1.applyType(type, typeShorthands).type}`);
clauses.push(`AS ${(0, utils_1.applyType)(type, typeShorthands).type}`);
}

@@ -65,3 +65,3 @@ if (increment) {

const sequenceNameStr = mOptions.literal(sequenceName);
const clausesStr = exports.parseSequenceOptions(mOptions.typeShorthands, options).join('\n ');
const clausesStr = (0, exports.parseSequenceOptions)(mOptions.typeShorthands, options).join('\n ');
return `CREATE${temporaryStr} SEQUENCE${ifNotExistsStr} ${sequenceNameStr}

@@ -77,3 +77,3 @@ ${clausesStr};`;

const { restart } = options;
const clauses = exports.parseSequenceOptions(mOptions.typeShorthands, options);
const clauses = (0, exports.parseSequenceOptions)(mOptions.typeShorthands, options);
if (restart) {

@@ -80,0 +80,0 @@ if (restart === true) {

@@ -26,3 +26,3 @@ "use strict";

const extendingTypeShorthands = mOptions.typeShorthands;
let columnsWithOptions = Object.keys(columns).reduce((previous, column) => (Object.assign(Object.assign({}, previous), { [column]: utils_1.applyType(columns[column], extendingTypeShorthands) })), {});
let columnsWithOptions = Object.keys(columns).reduce((previous, column) => (Object.assign(Object.assign({}, previous), { [column]: (0, utils_1.applyType)(columns[column], extendingTypeShorthands) })), {});
const primaryColumns = Object.entries(columnsWithOptions)

@@ -38,3 +38,3 @@ .filter(([, { primaryKey }]) => Boolean(primaryKey))

return (typeof comment !== 'undefined' &&
utils_1.makeComment('COLUMN', `${mOptions.literal(tableName)}.${mOptions.literal(columnName)}`, comment));
(0, utils_1.makeComment)('COLUMN', `${mOptions.literal(tableName)}.${mOptions.literal(columnName)}`, comment));
})

@@ -51,3 +51,3 @@ .filter((comment) => Boolean(comment));

if (defaultValue !== undefined) {
constraints.push(`DEFAULT ${utils_1.escapeValue(defaultValue)}`);
constraints.push(`DEFAULT ${(0, utils_1.escapeValue)(defaultValue)}`);
}

@@ -71,3 +71,3 @@ if (unique) {

if (referencesConstraintComment) {
comments.push(utils_1.makeComment(`CONSTRAINT ${mOptions.literal(name)} ON`, mOptions.literal(tableName), referencesConstraintComment));
comments.push((0, utils_1.makeComment)(`CONSTRAINT ${mOptions.literal(name)} ON`, mOptions.literal(tableName), referencesConstraintComment));
}

@@ -79,3 +79,3 @@ }

if (sequenceGenerated) {
const sequenceOptions = sequences_1.parseSequenceOptions(extendingTypeShorthands, sequenceGenerated).join(' ');
const sequenceOptions = (0, sequences_1.parseSequenceOptions)(extendingTypeShorthands, sequenceGenerated).join(' ');
constraints.push(`GENERATED ${sequenceGenerated.precedence} AS IDENTITY${sequenceOptions ? ` (${sequenceOptions})` : ''}`);

@@ -135,3 +135,3 @@ }

if (referencesConstraintComment) {
comments.push(utils_1.makeComment(`CONSTRAINT ${name} ON`, literal(tableName), referencesConstraintComment));
comments.push((0, utils_1.makeComment)(`CONSTRAINT ${name} ON`, literal(tableName), referencesConstraintComment));
}

@@ -150,3 +150,3 @@ });

throw new Error('cannot comment on unspecified constraints');
comments.push(utils_1.makeComment(`CONSTRAINT ${literal(optionName)} ON`, literal(tableName), comment));
comments.push((0, utils_1.makeComment)(`CONSTRAINT ${literal(optionName)} ON`, literal(tableName), comment));
}

@@ -184,3 +184,3 @@ return {

const { columns: columnLines, constraints: crossColumnConstraints, comments: columnComments = [], } = parseColumns(tableName, columns, mOptions);
const dupes = utils_1.intersection(Object.keys(optionsConstraints), Object.keys(crossColumnConstraints));
const dupes = (0, utils_1.intersection)(Object.keys(optionsConstraints), Object.keys(crossColumnConstraints));
if (dupes.length > 0) {

@@ -198,7 +198,7 @@ const dupesStr = dupes.join(', ');

const createTableQuery = `CREATE${temporaryStr} TABLE${ifNotExistsStr} ${tableNameStr} (
${utils_1.formatLines(tableDefinition)}
${(0, utils_1.formatLines)(tableDefinition)}
)${inheritsStr};`;
const comments = [...columnComments, ...constraintComments];
if (typeof comment !== 'undefined') {
comments.push(utils_1.makeComment('TABLE', mOptions.literal(tableName), comment));
comments.push((0, utils_1.makeComment)('TABLE', mOptions.literal(tableName), comment));
}

@@ -218,3 +218,3 @@ return `${createTableQuery}${comments.length > 0 ? `\n${comments.join('\n')}` : ''}`;

return `ALTER TABLE ${mOptions.literal(tableName)}
${utils_1.formatLines(alterDefinition)};`;
${(0, utils_1.formatLines)(alterDefinition)};`;
};

@@ -233,3 +233,3 @@ return _alter;

}
const columnsStr = utils_1.formatLines(columns.map(mOptions.literal), ` DROP ${ifExists ? ' IF EXISTS' : ''}`, `${cascade ? ' CASCADE' : ''},`);
const columnsStr = (0, utils_1.formatLines)(columns.map(mOptions.literal), ` DROP ${ifExists ? ' IF EXISTS' : ''}`, `${cascade ? ' CASCADE' : ''},`);
return `ALTER TABLE ${mOptions.literal(tableName)}

@@ -245,3 +245,3 @@ ${columnsStr};`;

const { columns: columnLines, comments: columnComments = [] } = parseColumns(tableName, columns, mOptions);
const columnsStr = utils_1.formatLines(columnLines, ` ADD ${ifNotExists ? 'IF NOT EXISTS ' : ''}`);
const columnsStr = (0, utils_1.formatLines)(columnLines, ` ADD ${ifNotExists ? 'IF NOT EXISTS ' : ''}`);
const tableNameStr = mOptions.literal(tableName);

@@ -265,6 +265,6 @@ const alterTableQuery = `ALTER TABLE ${tableNameStr}\n${columnsStr};`;

else if (defaultValue !== undefined) {
actions.push(`SET DEFAULT ${utils_1.escapeValue(defaultValue)}`);
actions.push(`SET DEFAULT ${(0, utils_1.escapeValue)(defaultValue)}`);
}
if (type) {
const typeStr = utils_1.applyTypeAdapters(type);
const typeStr = (0, utils_1.applyTypeAdapters)(type);
const collationStr = collation ? ` COLLATE ${collation}` : '';

@@ -285,3 +285,3 @@ const usingStr = using ? ` USING ${using}` : '';

else {
const sequenceOptions = sequences_1.parseSequenceOptions(mOptions.typeShorthands, sequenceGenerated).join(' ');
const sequenceOptions = (0, sequences_1.parseSequenceOptions)(mOptions.typeShorthands, sequenceGenerated).join(' ');
actions.push(`ADD GENERATED ${sequenceGenerated.precedence} AS IDENTITY${sequenceOptions ? ` (${sequenceOptions})` : ''}`);

@@ -292,7 +292,7 @@ }

if (actions.length > 0) {
const columnsStr = utils_1.formatLines(actions, ` ALTER ${mOptions.literal(columnName)} `);
const columnsStr = (0, utils_1.formatLines)(actions, ` ALTER ${mOptions.literal(columnName)} `);
queries.push(`ALTER TABLE ${mOptions.literal(tableName)}\n${columnsStr};`);
}
if (typeof comment !== 'undefined') {
queries.push(utils_1.makeComment('COLUMN', `${mOptions.literal(tableName)}.${mOptions.literal(columnName)}`, comment));
queries.push((0, utils_1.makeComment)('COLUMN', `${mOptions.literal(tableName)}.${mOptions.literal(columnName)}`, comment));
}

@@ -355,3 +355,3 @@ return queries.join('\n');

: parseConstraints(tableName, expression, constraintName, mOptions.literal);
const constraintStr = utils_1.formatLines(constraints, ' ADD ');
const constraintStr = (0, utils_1.formatLines)(constraints, ' ADD ');
return [`ALTER TABLE ${mOptions.literal(tableName)}\n${constraintStr};`, ...comments].join('\n');

@@ -358,0 +358,0 @@ };

@@ -59,3 +59,3 @@ "use strict";

const fnSQL = definition
? `${functions_1.createFunction(mOptions)(functionName, [], Object.assign(Object.assign({}, triggerOptions), { returns: 'trigger' }), definition)}\n`
? `${(0, functions_1.createFunction)(mOptions)(functionName, [], Object.assign(Object.assign({}, triggerOptions), { returns: 'trigger' }), definition)}\n`
: '';

@@ -67,3 +67,3 @@ return `${fnSQL}${triggerSQL}`;

const fnSQL = definition
? `\n${functions_1.dropFunction(mOptions)(triggerOptions.function || triggerName, [], triggerOptions)}`
? `\n${(0, functions_1.dropFunction)(mOptions)(triggerOptions.function || triggerName, [], triggerOptions)}`
: '';

@@ -70,0 +70,0 @@ return `${triggerSQL}${fnSQL}`;

@@ -25,3 +25,3 @@ "use strict";

.map(([attributeName, attribute]) => {
const typeStr = utils_1.applyType(attribute, mOptions.typeShorthands).type;
const typeStr = (0, utils_1.applyType)(attribute, mOptions.typeShorthands).type;
return `${mOptions.literal(attributeName)} ${typeStr}`;

@@ -48,3 +48,3 @@ })

const _alterAttributeAdd = (typeName, attributeName, attributeType) => {
const typeStr = utils_1.applyType(attributeType, mOptions.typeShorthands).type;
const typeStr = (0, utils_1.applyType)(attributeType, mOptions.typeShorthands).type;
const typeNameStr = mOptions.literal(typeName);

@@ -60,3 +60,3 @@ const attributeNameStr = mOptions.literal(attributeName);

return (typeName, attributeName, attributeType) => {
const typeStr = utils_1.applyType(attributeType, mOptions.typeShorthands).type;
const typeStr = (0, utils_1.applyType)(attributeType, mOptions.typeShorthands).type;
const typeNameStr = mOptions.literal(typeName);

@@ -74,6 +74,6 @@ const attributeNameStr = mOptions.literal(attributeName);

}
const beforeStr = before ? ` BEFORE ${utils_1.escapeValue(before)}` : '';
const afterStr = after ? ` AFTER ${utils_1.escapeValue(after)}` : '';
const beforeStr = before ? ` BEFORE ${(0, utils_1.escapeValue)(before)}` : '';
const afterStr = after ? ` AFTER ${(0, utils_1.escapeValue)(after)}` : '';
const ifNotExistsStr = ifNotExists ? ' IF NOT EXISTS' : '';
const valueStr = utils_1.escapeValue(value);
const valueStr = (0, utils_1.escapeValue)(value);
const typeNameStr = mOptions.literal(typeName);

@@ -108,4 +108,4 @@ return `ALTER TYPE ${typeNameStr} ADD VALUE${ifNotExistsStr} ${valueStr}${beforeStr}${afterStr};`;

const _rename = (typeName, value, newValue) => {
const valueStr = utils_1.escapeValue(value);
const newValueStr = utils_1.escapeValue(newValue);
const valueStr = (0, utils_1.escapeValue)(value);
const newValueStr = (0, utils_1.escapeValue)(newValue);
const typeNameStr = mOptions.literal(typeName);

@@ -112,0 +112,0 @@ return `ALTER TYPE ${typeNameStr} RENAME VALUE ${valueStr} TO ${newValueStr};`;

@@ -76,3 +76,3 @@ "use strict";

else if (defaultValue !== undefined) {
actions.push(`SET DEFAULT ${utils_1.escapeValue(defaultValue)}`);
actions.push(`SET DEFAULT ${(0, utils_1.escapeValue)(defaultValue)}`);
}

@@ -79,0 +79,0 @@ const viewNameStr = mOptions.literal(viewName);

@@ -66,3 +66,3 @@ "use strict";

}
const clausesStr = utils_1.formatLines(clauses);
const clausesStr = (0, utils_1.formatLines)(clauses);
const viewNameStr = mOptions.literal(viewName);

@@ -69,0 +69,0 @@ return `ALTER MATERIALIZED VIEW ${viewNameStr}\n${clausesStr};`;

@@ -18,7 +18,7 @@ "use strict";

let shorthands = {};
const files = await migration_1.loadMigrationFiles(options.dir, options.ignorePattern);
const files = await (0, migration_1.loadMigrationFiles)(options.dir, options.ignorePattern);
return (await Promise.all(files.map(async (file) => {
const filePath = `${options.dir}/${file}`;
const actions = path_1.default.extname(filePath) === '.sql'
? await sqlMigration_1.default(filePath)
? await (0, sqlMigration_1.default)(filePath)
:

@@ -48,5 +48,5 @@ require(path_1.default.relative(__dirname, filePath));

try {
const schema = utils_1.getMigrationTableSchema(options);
const schema = (0, utils_1.getMigrationTableSchema)(options);
const { migrationsTable } = options;
const fullTableName = utils_1.createSchemalize(Boolean(options.decamelize), true)({
const fullTableName = (0, utils_1.createSchemalize)(Boolean(options.decamelize), true)({
schema,

@@ -71,5 +71,5 @@ name: migrationsTable,

const getRunMigrations = async (db, options) => {
const schema = utils_1.getMigrationTableSchema(options);
const schema = (0, utils_1.getMigrationTableSchema)(options);
const { migrationsTable } = options;
const fullTableName = utils_1.createSchemalize(Boolean(options.decamelize), true)({
const fullTableName = (0, utils_1.createSchemalize)(Boolean(options.decamelize), true)({
schema,

@@ -130,7 +130,10 @@ name: migrationsTable,

const logger = getLogger(options);
const db = db_1.default(options.dbClient || options.databaseUrl, logger);
const db = (0, db_1.default)(options.dbClient || options.databaseUrl, logger);
try {
await db.createConnection();
if (!options.noLock) {
await lock(db);
}
if (options.schema) {
const schemas = utils_1.getSchemas(options.schema);
const schemas = (0, utils_1.getSchemas)(options.schema);
if (options.createSchema) {

@@ -145,5 +148,2 @@ await Promise.all(schemas.map((schema) => db.query(`CREATE SCHEMA IF NOT EXISTS "${schema}"`)));

await ensureMigrationsTable(db, options);
if (!options.noLock) {
await lock(db);
}
const [migrations, runNames] = await Promise.all([

@@ -150,0 +150,0 @@ loadMigrations(db, options, logger),

@@ -29,3 +29,3 @@ "use strict";

const content = await readFile(sqlPath, 'utf-8');
return exports.getActions(content);
return (0, exports.getActions)(content);
};

@@ -191,29 +191,100 @@ import { ClientBase, ClientConfig, QueryArrayResult, QueryResult, QueryArrayConfig, QueryConfig } from 'pg';

export interface RunnerOptionConfig {
/**
* The table storing which migrations have been run.
*/
migrationsTable: string;
/**
* The schema storing table which migrations have been run.
*
* (defaults to same value as `schema`)
*/
migrationsSchema?: string;
/**
* The schema on which migration will be run.
*
* @default 'public'
*/
schema?: string | string[];
/**
* The directory containing your migration files.
*/
dir: string;
/**
* Check order of migrations before running them.
*/
checkOrder?: boolean;
/**
* Direction of migration-run.
*/
direction: MigrationDirection;
/**
* Number of migration to run.
*/
count: number;
/**
* Treats `count` as timestamp.
*/
timestamp?: boolean;
/**
* Regex pattern for file names to ignore (ignores files starting with `.` by default).
*/
ignorePattern?: string;
/**
* Run only migration with this name.
*/
file?: string;
dryRun?: boolean;
/**
* Creates the configured schema if it doesn't exist.
*/
createSchema?: boolean;
/**
* Creates the configured migration schema if it doesn't exist.
*/
createMigrationsSchema?: boolean;
/**
* Combines all pending migrations into a single transaction so that if any migration fails, all will be rolled back.
*
* @default true
*/
singleTransaction?: boolean;
/**
* Disables locking mechanism and checks.
*/
noLock?: boolean;
/**
* Mark migrations as run without actually performing them (use with caution!).
*/
fake?: boolean;
/**
* Runs [`decamelize`](https://github.com/sindresorhus/decamelize) on table/column/etc. names.
*/
decamelize?: boolean;
/**
* Redirect log messages to this function, rather than `console`.
*/
log?: LogFn;
/**
* Redirect messages to this logger object, rather than `console`.
*/
logger?: Logger;
/**
* Print all debug messages like DB queries run (if you switch it on, it will disable `logger.debug` method).
*/
verbose?: boolean;
}
export interface RunnerOptionUrl {
/**
* Connection string or client config which is passed to [new pg.Client](https://node-postgres.com/api/client#constructor)
*/
databaseUrl: string | ClientConfig;
}
export interface RunnerOptionClient {
/**
* Instance of [new pg.Client](https://node-postgres.com/api/client).
*
* Instance should be connected to DB and after finishing migration, user is responsible to close connection.
*/
dbClient: ClientBase;
}
export declare type RunnerOption = RunnerOptionConfig & (RunnerOptionClient | RunnerOptionUrl);

@@ -91,3 +91,3 @@ "use strict";

? literal(v)
: String(exports.escapeValue(v)));
: String((0, exports.escapeValue)(v)));
}, s);

@@ -100,3 +100,3 @@ exports.createTransformer = createTransformer;

exports.getSchemas = getSchemas;
const getMigrationTableSchema = (options) => options.migrationsSchema !== undefined ? options.migrationsSchema : exports.getSchemas(options.schema)[0];
const getMigrationTableSchema = (options) => options.migrationsSchema !== undefined ? options.migrationsSchema : (0, exports.getSchemas)(options.schema)[0];
exports.getMigrationTableSchema = getMigrationTableSchema;

@@ -136,7 +136,7 @@ const typeAdapters = {

}
return Object.assign(Object.assign(Object.assign({}, ext), options), { type: exports.applyTypeAdapters((_a = ext === null || ext === void 0 ? void 0 : ext.type) !== null && _a !== void 0 ? _a : options.type) });
return Object.assign(Object.assign(Object.assign({}, ext), options), { type: (0, exports.applyTypeAdapters)((_a = ext === null || ext === void 0 ? void 0 : ext.type) !== null && _a !== void 0 ? _a : options.type) });
};
exports.applyType = applyType;
const formatParam = (mOptions) => (param) => {
const { mode, name, type, default: defaultValue } = exports.applyType(param, mOptions.typeShorthands);
const { mode, name, type, default: defaultValue } = (0, exports.applyType)(param, mOptions.typeShorthands);
const options = [];

@@ -153,3 +153,3 @@ if (mode) {

if (defaultValue) {
options.push(`DEFAULT ${exports.escapeValue(defaultValue)}`);
options.push(`DEFAULT ${(0, exports.escapeValue)(defaultValue)}`);
}

@@ -161,3 +161,3 @@ return options.join(' ');

const makeComment = (object, name, text) => {
const cmt = exports.escapeValue(text || null);
const cmt = (0, exports.escapeValue)(text || null);
return `COMMENT ON ${object} ${name} IS ${cmt};`;

@@ -164,0 +164,0 @@ };

@@ -6,3 +6,3 @@ # Programmatic API

- `databaseUrl` _[string or object]_ - Connection string or client config which is passed to [new pg.Client](https://node-postgres.com/api/client#new-client-config-object-)
- `databaseUrl` _[string or object]_ - Connection string or client config which is passed to [new pg.Client](https://node-postgres.com/api/client#constructor)
- or `dbClient` _[pg.Client]_ - instance of [new pg.Client](https://node-postgres.com/api/client). Instance should be connected to DB and after finishing migration, user is responsible to close connection

@@ -9,0 +9,0 @@ - `migrationsTable` _[string]_ - The table storing which migrations have been run

{
"name": "node-pg-migrate",
"version": "5.10.0",
"version": "6.0.0",
"description": "Postgresql database migration management tool for node.js",

@@ -37,3 +37,3 @@ "author": "Theo Ephraim",

"engines": {
"node": ">=10.0.0"
"node": ">=12.13.0"
},

@@ -52,14 +52,14 @@ "bugs": {

"mkdirp": "~1.0.0",
"yargs": "~16.2.0"
"yargs": "~17.1.0"
},
"devDependencies": {
"@types/chai": "4.2.18",
"@types/chai": "4.2.21",
"@types/chai-as-promised": "7.1.4",
"@types/mkdirp": "1.0.1",
"@types/mocha": "8.2.2",
"@types/mkdirp": "1.0.2",
"@types/mocha": "9.0.0",
"@types/proxyquire": "1.3.28",
"@types/sinon": "10.0.2",
"@types/sinon-chai": "3.2.5",
"@typescript-eslint/eslint-plugin": "4.26.1",
"@typescript-eslint/parser": "4.26.1",
"@typescript-eslint/eslint-plugin": "4.31.1",
"@typescript-eslint/parser": "4.31.1",
"chai": "4.3.4",

@@ -72,21 +72,21 @@ "chai-as-promised": "7.1.1",

"dotenv-expand": "5.1.0",
"eslint": "7.28.0",
"eslint": "7.32.0",
"eslint-config-airbnb-base": "14.2.1",
"eslint-config-prettier": "7.2.0",
"eslint-import-resolver-typescript": "2.4.0",
"eslint-plugin-import": "2.23.4",
"eslint-plugin-prettier": "3.4.0",
"eslint-config-prettier": "8.3.0",
"eslint-import-resolver-typescript": "2.5.0",
"eslint-plugin-import": "2.24.2",
"eslint-plugin-prettier": "4.0.0",
"eslint-plugin-security": "1.4.0",
"husky": "6.0.0",
"husky": "7.0.2",
"json5": "2.2.0",
"lint-staged": "10.5.4",
"mocha": "8.4.0",
"pg": "8.6.0",
"prettier": "2.3.1",
"lint-staged": "11.1.2",
"mocha": "9.1.1",
"pg": "8.7.1",
"prettier": "2.4.1",
"proxyquire": "2.1.3",
"rimraf": "3.0.2",
"sinon": "11.1.1",
"sinon": "11.1.2",
"sinon-chai": "3.7.0",
"ts-node": "9.1.1",
"typescript": "4.3.2"
"ts-node": "10.2.1",
"typescript": "4.4.3"
},

@@ -93,0 +93,0 @@ "peerDependencies": {

@@ -1,2 +0,2 @@

/* eslint-disable @typescript-eslint/camelcase */
/* eslint-disable @typescript-eslint/naming-convention */
import { MigrationBuilder, ColumnDefinitions } from 'node-pg-migrate';

@@ -3,0 +3,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc