You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The model guess routine (columns-to-model.js, line 52) can try to create an index for a field of type TEXT. This generates a Sequelize exception (needs a key length).
To workaround this, I put a field.type test around the shouldIndex() call at line 53:
// Make indexes based on column name
if (field.type != Sequelize.TEXT) {
if (shouldIndex(field.name)) {
model.options.indexes.push({ fields: [ field.name ]});
}
}
The text was updated successfully, but these errors were encountered:
This makes sense. Since it's the "auto" index part, it's ok to not deal with text columns, and allow someone to create them in the manual/code version.
I have not tracked the source/sequence yet, but the same error occurs (Unhandled rejection SequelizeDatabseError: ER_BLOB_KEY_WITHOUT_LENGTH: BLOB/TEXT column 'name' used in key specification without a key length) under the condition when the destination table already exists (in a MySQL destination).
Interestingly, the field in question is not actually a BLOB/TEXT, but a VARCHAR(280).
If I drop the table, the original mod works, and the table is created.
I assume that, if I was supplying a defined model, this would not occur. I think that a 'save' or 'record' of the guessed model would be a useful feature. Some of the data I am using have a lot of columns.
The model guess routine (columns-to-model.js, line 52) can try to create an index for a field of type TEXT. This generates a Sequelize exception (needs a key length).
To workaround this, I put a field.type test around the shouldIndex() call at line 53:
The text was updated successfully, but these errors were encountered: