Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ utils.buildSchema = function(obj) {
attribute.type = val;
}

var type = utils.sqlTypeCast(attribute.autoIncrement ? 'SERIAL' : attribute.type);
var type = utils.sqlTypeCast(attribute.autoIncrement ? 'SERIAL' : attribute.type, attribute.size ? attribute.size : null);
var nullable = attribute.notNull && 'NOT NULL';
var unique = attribute.unique && 'UNIQUE';

Expand Down Expand Up @@ -198,7 +198,7 @@ utils.toSqlDate = function(date) {
* Cast waterline types to Postgresql data types
*/

utils.sqlTypeCast = function(type) {
utils.sqlTypeCast = function(type, size) {
switch (type.toLowerCase()) {
case 'serial':
return 'SERIAL';
Expand All @@ -208,6 +208,7 @@ utils.sqlTypeCast = function(type) {
return 'BIGSERIAL';

case 'string':
return 'character varying(' + (size ? size : 255) + ')'; // sets the character-varying limit
case 'text':
case 'mediumtext':
case 'longtext':
Expand Down