Skip to content
This repository was archived by the owner on Jan 8, 2026. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions lib/sqlstore/mapping.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,15 @@ var Mapping = function(store, type, definition) {
"value": definition.schema,
"enumerable": true
});

/**
* The schema name
* @type String
*/
Object.defineProperty(this, "engine", {
"value": definition.engine,
"enumerable": true
});

// convert all defined properties into their appropriate property mapping instances
for (var propName in definition.properties) {
Expand Down
2 changes: 1 addition & 1 deletion lib/sqlstore/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ Store.prototype.createTable = function(conn, dialect, mapping) {
}
}
return sqlUtils.createTable(conn, dialect, mapping.schemaName, mapping.tableName,
columns, primaryKeys);
columns, primaryKeys, mapping.engine);
};

/**
Expand Down
8 changes: 4 additions & 4 deletions lib/sqlstore/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function close(obj) {
* @param {Array} primaryKey An array containing the primary key columns
* @param {String} engineType Optional engine type, solely for mysql databases
*/
function createTable(conn, dialect, schemaName, tableName, columns, primaryKey) {
function createTable(conn, dialect, schemaName, tableName, columns, primaryKey, engineType) {
var sqlBuf = new java.lang.StringBuffer();
sqlBuf.append("CREATE TABLE ");
// FIXME: there's mapping.getQualifiedTableName() ...
Expand Down Expand Up @@ -57,9 +57,9 @@ function createTable(conn, dialect, schemaName, tableName, columns, primaryKey)
}).join(", ")).append(")");
}
sqlBuf.append(")");
var engineType = dialect.getEngineType();
if (engineType != null) {
sqlBuf.append(" ENGINE=").append(engineType);
var engineTypeName = engineType || dialect.getEngineType();
if (engineTypeName != null) {
sqlBuf.append(" ENGINE=").append(engineTypeName);
}
log.debug("Creating table: " + sqlBuf.toString());

Expand Down