jarrodconnolly / sequelize-slugify

Sequelize Slugify is a plugin for the Sequelize ORM that automatically creates and updates unique, URL safe slugs for your database models.
https://sequelize-slugify.nestedquotes.ca/
MIT License
56 stars 27 forks source link

[Fix] forceGenerateSlug ignored if nothing changed #45

Closed shem8 closed 3 years ago

shem8 commented 3 years ago

Description

If forceGenerateSlug enabled, generate slug even if nothing changed. This is useful for creating slug for the first time, like on migrations.

Issue: #44

Checklist

Please review the guidelines for contributing to this repository.

jarrodconnolly commented 3 years ago

Looks reasonable. I would like to add a few tests to show how this broke and how it will work.

jarrodconnolly commented 3 years ago

@shem8 I added a test that does fail before your change and passes after, I believe this is the scenario you may be running into. Let me know if that makes sense. The new test is regenerateSlug should overwrite slug when never had one

shem8 commented 3 years ago

looking god, thanks @jarrodconnolly