From 8b0cafc7d12453f61bcdae0ea6717ba342c78fe2 Mon Sep 17 00:00:00 2001 From: ewrayjohnson Date: Sat, 10 Aug 2019 22:50:53 -0400 Subject: [PATCH] Fix - fail to honor non-unique property constraint Connector does not honor non-unique constraint definition for a property declaration in model json file on automigrate. Example model json file snipet: "properties": [ "email": { "type": "String", "index": { "unique": false } } ] error generated: "could not create unique index "[modelname] _email_idx" --- lib/migration.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/migration.js b/lib/migration.js index 1659f9fa..01010b9a 100644 --- a/lib/migration.js +++ b/lib/migration.js @@ -823,7 +823,7 @@ function mixinMigration(PostgreSQL) { kind = i.kind; } - if (!kind && !type && typeof i === 'object' || i.unique && i.unique === true) { + if (!kind && !type && typeof i === 'object' && i.unique && i.unique === true) { kind = ' UNIQUE '; }