From 2f3e6ab1924cb39fad207ff7f8fd80955b774f76 Mon Sep 17 00:00:00 2001 From: chok Date: Sun, 18 Jan 2015 18:48:29 +0100 Subject: [PATCH] [engine] support engine --- lib/mysql.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/mysql.js b/lib/mysql.js index 1732dda..ad56c3c 100644 --- a/lib/mysql.js +++ b/lib/mysql.js @@ -726,6 +726,7 @@ MySQL.prototype.alterTable = function (model, actualFields, actualIndexes, done, MySQL.prototype.propertiesSQL = function (model) { var self = this; var sql; + var tableOptions = []; if (this.schema.settings.slave) { sql = ['`id` VARCHAR(100) NOT NULL PRIMARY KEY']; } else { @@ -750,7 +751,13 @@ MySQL.prototype.propertiesSQL = function (model) { sql.push(self.indexSettingsSQL(model, prop)); }); } - return sql.join(',\n '); + + var engine = this._models[model].settings.engine; + if (engine) { + tableOptions.push('ENGINE '+engine); + } + + return ' (\n ' + sql.join(',\n ') + '\n) '+tableOptions.join(',\n '); }; MySQL.prototype.singleIndexSettingsSQL = function (model, prop) {