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

postgrator

Package Overview
Dependencies
Maintainers
1
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postgrator - npm Package Compare versions

Comparing version 3.2.0 to 3.3.0

6

CHANGELOG.md
# CHANGELOG
## 3.2.0
### Jan 15 2018
* Add support for pg@6
## 3.1.0

@@ -4,0 +10,0 @@

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

const utils = require('./utils')
const DRIVERS = ['pg', 'mysql', 'mssql']

@@ -145,2 +147,3 @@

}
utils.supportWarning('mysql', 2, 2)

@@ -198,2 +201,4 @@ commonClient._createConnection = () => {

}
utils.supportWarning('pg', 6, 7)
if (config.ssl) {

@@ -241,2 +246,3 @@ commonClient.dbDriver.defaults.ssl = true

}
utils.supportWarning('mssql', 4, 4)

@@ -243,0 +249,0 @@ const oneHour = 1000 * 60 * 60

59

lib/utils.js

@@ -50,7 +50,64 @@ const fs = require('fs')

/**
* Returns major version of installed package relative to this project
* @param {string} packageName
*/
function getMajorVersion(packageName) {
let majorVersion, path
// If module is not installed this throws error
try {
path = require.resolve(packageName)
} catch (error) {
return null
}
const parts = path.split('/')
while (parts.length && !majorVersion) {
parts.pop()
const checkPath = parts.join('/') + '/package.json'
if (fs.existsSync(checkPath)) {
const pkg = require(checkPath)
if (pkg.name === packageName) {
majorVersion = require(checkPath).version.split('.')[0]
}
}
}
return parseInt(majorVersion)
}
/**
* Checks installed version of driver and prints warning depending on outcome
* @param {string} driver
* @param {number} minMajor
* @param {number} maxMajor
*/
function supportWarning(driver, minMajor, maxMajor) {
const installedMajor = getMajorVersion(driver)
if (installedMajor < minMajor) {
console.error(
`Package ${driver} version ${installedMajor}.x.x not supported`
)
if (maxMajor && maxMajor !== minMajor) {
console.error(
`Install ${driver} version ${minMajor}.x.x - ${maxMajor}.x.x`
)
} else {
console.error(`Install ${driver} version ${minMajor}.x.x`)
}
} else if (installedMajor > maxMajor) {
console.warn(`Package ${driver} version ${installedMajor}.x.x not tested`)
console.warn(`Please raise issue to support ${driver} > ${maxMajor}.x.x`)
}
}
module.exports = {
checksum,
fileChecksum,
getMajorVersion,
sortMigrationsAsc,
sortMigrationsDesc
sortMigrationsDesc,
supportWarning
}

2

package.json
{
"name": "postgrator",
"version": "3.2.0",
"version": "3.3.0",
"author": "Rick Bergfalk <rick.bergfalk@gmail.com>",

@@ -5,0 +5,0 @@ "description": "A SQL migration tool for SQL people",

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