diff --git a/generator.js b/generator.js index f4d5c06..1a5454e 100644 --- a/generator.js +++ b/generator.js @@ -161,7 +161,7 @@ class DDLGenerator { /** - * Write Foreign Keys + * Create indexes for Foreign Key columns * @param {StringWriter} codeWriter * @param {type.ERDEntity} elem * @param {Object} options @@ -310,7 +310,7 @@ class DDLGenerator { if (column && col.foreignKey && !col.primaryKey) { foreignKeys.push(column); } - if (options.foreignKey && col.referenceTo) { + if (options.foreignKeyConstraint && col.referenceTo) { foreignKeyCtr.push(col); } } diff --git a/preferences/preference.json b/preferences/preference.json index 86a535f..18c676a 100644 --- a/preferences/preference.json +++ b/preferences/preference.json @@ -51,7 +51,7 @@ "text": "Generate Foregin Key Constraints", "description": "Generate Foreign Key constraint when reference field is populated.", "type": "check", - "default": false + "default": true }, "psqlddl.gen.useTab": { "text": "Use Tab",