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

db-migrate-pg

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

db-migrate-pg - npm Package Compare versions

Comparing version 0.1.15 to 0.2.0

25

index.js

@@ -43,2 +43,8 @@ var util = require('util');

createColumnDef: function(name, spec, options, tableName) {
// add support for datatype timetz, timestamptz
// https://www.postgresql.org/docs/9.5/static/datatype.html
spec.type = spec.type.replace(/^(time|timestamp)tz$/, function($, type) {
spec.timezone = true
return type
})
var type = spec.autoIncrement ? '' : this.mapDataType(spec.type);

@@ -52,2 +58,3 @@ var len = spec.length ? util.format('(%s)', spec.length) : '';

return { foreignKey: constraint.foreignKey,
callbacks: constraint.callbacks,
constraints: [name, type, len, constraint.constraints].join(' ') };

@@ -58,2 +65,5 @@ },

switch(str) {
case 'json':
case 'jsonb':
return str.toUpperCase()
case this.type.STRING:

@@ -274,2 +284,3 @@ return 'VARCHAR';

var constraint = [],
callbacks = [],
cb;

@@ -292,2 +303,6 @@

if (spec.timezone) {
constraint.push('WITH TIME ZONE')
}
if (spec.defaultValue !== undefined) {

@@ -302,2 +317,3 @@ constraint.push('DEFAULT');

// keep foreignKey for backward compatiable, push to callbacks in the future
if (spec.foreignKey) {

@@ -307,4 +323,11 @@

}
if (spec.comment) {
// TODO: create a new function addComment is not callable from here
callbacks.push((function(tableName, columnName, comment, callback) {
var sql = util.format("COMMENT on COLUMN %s.%s IS '%s'", tableName, columnName, comment)
return this.runSql(sql).nodeify(callback)
}).bind(this, tableName, columnName, spec.comment))
}
return { foreignKey: cb, constraints: constraint.join(' ') };
return { foreignKey: cb, callbacks: callbacks, constraints: constraint.join(' ') };
},

@@ -311,0 +334,0 @@

4

package.json
{
"name": "db-migrate-pg",
"version": "0.1.15",
"version": "0.2.0",
"description": "A postgresql driver for db-migrate",

@@ -34,3 +34,3 @@ "main": "index.js",

"bluebird": "^3.1.1",
"db-migrate-base": "^1.3.3",
"db-migrate-base": "^1.4.0",
"pg": "^4.5.5",

@@ -37,0 +37,0 @@ "semver": "^5.0.3"

@@ -12,3 +12,3 @@ [![Build Status](https://travis-ci.org/db-migrate/pg.svg?branch=master)](https://travis-ci.org/db-migrate/pg)

```
npm install db-migrate-pg
```
npm install --save db-migrate-pg
```
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