dresende / node-orm2

Object Relational Mapping
http://github.com/dresende/node-orm2
MIT License
3.07k stars 379 forks source link

db.sync(...) throws syntax error when using defaultValue=[] - Postgres #677

Open fydo23 opened 8 years ago

fydo23 commented 8 years ago

One of our models has a column definition of: skills: { type: 'object', defaultValue=[]}, which breaks when we run db.sync(...) with the following output:

Caught exception: error: syntax error at or near ")"
error: syntax error at or near ")"
    at Connection.parseE (/Users/fwolf/Code/Node/zero-day/repo/node_modules/pg/lib/connection.js:539:11)
    at Connection.parseMessage (/Users/fwolf/Code/Node/zero-day/repo/node_modules/pg/lib/connection.js:366:17)
    at Socket.<anonymous> (/Users/fwolf/Code/Node/zero-day/repo/node_modules/pg/lib/connection.js:105:22)
    at Socket.emit (events.js:107:17)
    at readableAddChunk (_stream_readable.js:163:16)
    at Socket.Readable.push (_stream_readable.js:126:10)
    at TCP.onread (net.js:538:20)
dxg commented 8 years ago

Hmm it's valid for the model, but not the table.. I imagine defaultValue='[]' would work for sync but not when creating a new model instance.