Skip to content
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
5 changes: 4 additions & 1 deletion lib/dialects/basedialect.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,14 +170,17 @@ exports.getUpdateSql = function(mapping) {
*/
exports.getInsertSql = function(mapping) {
const buf = ["INSERT INTO ", this.quote(mapping.tableName, mapping.schemaName),
" (", this.quote(mapping.id.column), ", "];
" (", this.quote(mapping.id.column)];
const values = new Array(mapping.mappings);
if (mapping.id.sequence && this.hasSequenceSupport) {
values[0] = this.getInsertNextSequenceValue(mapping.id.sequence);
} else {
values[0] = "DEFAULT";
}
const max = mapping.mappings.length;
if (max > 0) {
buf.push(", ");
}
for (let idx = 1; idx < max; idx += 1) {
let propMapping = mapping.mappings[idx];
if (idx > 1) {
Expand Down
2 changes: 1 addition & 1 deletion lib/mapping/entity.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ Mapping.create = function(dialect, type, definition) {
const mapping = new Mapping(type, definition.table, definition.schema);
mapping.indexes = definition.indexes || null;
mapping.addIdMapping(dialect, definition.id || {});
Object.keys(definition.properties).forEach(function(propertyName) {
Object.keys(definition.properties || {}).forEach(function(propertyName) {
const propertyDefinition = definition.properties[propertyName];
// allow simple property definitions with just data type
if (typeof propertyDefinition === "string") {
Expand Down