sequelize-mig
sequelize-mig copied to clipboard
Support Partial Indexes
This tool is great, but it does not seem to be able to support partial indexes. Eg:
indexes: [
{
unique: true,
fields: ['col1', 'col2'],
where: {
deletedAt: null
}
}
]
I had a look and the whole reason it wasnt working, was this line here:
https://github.com/MRVMV/sequelize-mig/blob/94ae0fbb20fc535b0829fbbc71caab2948d23b09/lib/models.js#L138
that if statement breaks the ability for this tool to correctly generate indexes
if i comment it out, everything seems to magically work, what is the point of this statement?
also i imagine we need:
if (idx.where) options.where = idx.where; here:
https://github.com/MRVMV/sequelize-mig/blob/94ae0fbb20fc535b0829fbbc71caab2948d23b09/lib/parser.js#L27