Skip to content

Commit

Permalink
Added UNIQUE support
Browse files Browse the repository at this point in the history
  • Loading branch information
coderbuzz committed Jul 12, 2013
1 parent aae4d99 commit 8eb8b50
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/sqlite3.js
Expand Up @@ -524,8 +524,12 @@ SQLite3.prototype.propertiesSQL = function (model) {

SQLite3.prototype.propertySettingsSQL = function (model, prop) {
var p = this._models[model].properties[prop];
return datatype(p) + ' ' +
(p.allowNull === false || p['null'] === false ? 'NOT NULL' : 'NULL') +
return datatype(p) +
//// In case in the future support user defined PK, un-comment the following:
// (p.primaryKey === true ? ' PRIMARY KEY' : '') +
// (p.primaryKey === true && p.autoIncrement === true ? ' AUTOINCREMENT' : '') +
(p.allowNull === false || p['null'] === false ? ' NOT NULL' : ' NULL') +
(p.unique === true ? ' UNIQUE' : '') +
(typeof p.default === "number" ? ' DEFAULT ' + p.default :'') +
(typeof p.default === "string" ? ' DEFAULT \'' + p.default + '\'' :'');
};
Expand Down

0 comments on commit 8eb8b50

Please sign in to comment.