New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@vbilopav/pgmigrations

Package Overview
Dependencies
Maintainers
0
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vbilopav/pgmigrations - npm Package Compare versions

Comparing version 0.5.0 to 0.6.0

9

config.js

@@ -39,6 +39,6 @@ const crypto = require('crypto');

historyTableName: "schema_history",
historyTableSchema: "public",
historyTableSchema: "pgmigrations",
skipPattern: "scrap",
useProceduralScript: false,
warnOnInvalidPrefix: false,
warnOnInvalidPrefix: true,
parseScriptTags: true,

@@ -51,4 +51,5 @@

},
sortFunction: (a, b) => a.localeCompare(b, "en"),
versionSortFunction: (a, b) => a.localeCompare(b, "en", {numeric: true}),
sortByPath: true,
sortFunction: (a, b, config) => config.sortByPath ? a.script.localeCompare(b.script, "en") : a.name.localeCompare(b.name, "en"),
versionSortFunction: (a, b, config) => a.version.localeCompare(b.version, "en", {numeric: true}),

@@ -55,0 +56,0 @@ testFunctionsSchemaSimilarTo: "test",

@@ -92,4 +92,28 @@ const path = require("path");

function validateConfig(config) {
var mandatory = [
"upPrefix","downPrefix","repetablePrefix","repetableBeforePrefix",
"beforePrefix","afterPrefix","separatorPrefix",
"historyTableName","historyTableSchema",
"tmpDir","hashFunction"
];
for (let i = 0; i < mandatory.length; i++) {
const key = mandatory[i];
if (!config[key]) {
error(`Config key ${key} is required. Please provide a valid config key.`);
return false;
}
}
return true;
}
module.exports = {
history: async function(opt, config) {
if (!validateConfig(config)) {
return;
}
var schemaQuery = str => formatByName(str, {schema: config.historyTableSchema, name: config.historyTableName});

@@ -105,15 +129,6 @@

migrate: async function(cmd, opt, config) {
var mandatory = [
"upPrefix","downPrefix","repetablePrefix","repetableBeforePrefix",
"beforePrefix","afterPrefix","separatorPrefix",
"historyTableName","historyTableSchema",
"tmpDir","hashFunction"
];
for (let i = 0; i < mandatory.length; i++) {
const key = mandatory[i];
if (!config[key]) {
error(`Config key ${key} is required. Please provide a valid config key.`);
return;
}
if (!validateConfig(config)) {
return;
}
if (Array.isArray(config.migrationDir)) {

@@ -447,10 +462,10 @@ for (let i = 0; i < config.migrationDir.length; i++) {

afterList.sort((a, b) => config.sortFunction(a.name, b.name));
beforeList.sort((a, b) => config.sortFunction(a.name, b.name));
afterList.sort((a, b) => config.sortFunction(a, b, config));
beforeList.sort((a, b) => config.sortFunction(a, b, config));
repetableList.sort((a, b) => config.sortFunction(a.name, b.name));
repetableBeforeList.sort((a, b) => config.sortFunction(a.name, b.name));
repetableList.sort((a, b) => config.sortFunction(a, b, config));
repetableBeforeList.sort((a, b) => config.sortFunction(a, b, config));
upList.sort((a, b) => config.versionSortFunction(a.version, b.version));
downList.sort((a, b) => config.versionSortFunction(b.version, a.version));
upList.sort((a, b) => config.versionSortFunction(a, b, config));
downList.sort((a, b) => config.versionSortFunction(b, a, config));

@@ -457,0 +472,0 @@ if (opt.list) {

{
"name": "@vbilopav/pgmigrations",
"version": "0.5.0",
"version": "0.6.0",
"description": "PostgreSQL Migration Tool for Node.js and NPM",

@@ -5,0 +5,0 @@ "author": "vb-consulting",

@@ -336,3 +336,3 @@ # PgMigrations

Schema name for the history table. If this schema doesn't exist, it will be created. The default is `public`.
Schema name for the history table. If this schema doesn't exist, it will be created. The default is `pgmigrations`.

@@ -363,12 +363,18 @@ #### historyTableName

#### sortByPath
Default: `true`.
Sorts non-versioned migrations by path and then by name for migrations in multiple directories.
#### sortFunction
Default sort function used for sorting migration names. The default value is `(a, b) => a.localeCompare(b, "en")`.
Default sort function used for sorting migration names. The default value is `sortFunction: (a, b, config) => config.sortByPath ? a.script.localeCompare(b.script, "en") : a.name.localeCompare(b.name, "en")`.
#### versionSortFunction
Default sort function used for sorting migration versions. The default value is `(a, b) => a.localeCompare(b, "en", {numeric: true})`.
Default sort function used for sorting migration versions. The default value is `versionSortFunction: (a, b, config) => a.version.localeCompare(b.version, "en", {numeric: true})`.
#### warnOnInvalidPrefix: false
#### warnOnInvalidPrefix: true

@@ -375,0 +381,0 @@ Display warning if some migration file with the migration extension (`.sql`) doesn't have a valid prefix. This may be just some script file that can be referenced with `# script` tag. The default is false.

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