question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

paranoid is not working with underscored option

See original GitHub issue

What are you doing?

Destory instance with paranoid and underscored. After update deleted_at column(db), sequelize does not map to deletedAt field(instance).

What do you expect to happen?

brand.destory();

brand {
  dataValues:
   { id: '16',
     updatedAt: '2019-03-16T11:01:19.633Z',
     createdAt: '2019-03-16T10:47:23.738Z',
     deletedAt: '2019-03-16T11:01:43.930Z'
   },
  _previousDataValues:
   { id: '16',
     deletedAt: null,
     createdAt: '2019-03-16T10:47:23.738Z',
     updatedAt: '2019-03-16T11:01:19.633Z' }

What is actually happening?


brand {
  dataValues:
   { id: '16',
     updatedAt: '2019-03-16T11:01:19.633Z',
     createdAt: '2019-03-16T10:47:23.738Z',
     deletedAt: null,
     deleted_at: '2019-03-16T11:01:43.930Z'
   },
  _previousDataValues:
   { id: '16',
     deletedAt: null,
     createdAt: '2019-03-16T10:47:23.738Z',
     updatedAt: '2019-03-16T11:01:19.633Z' }

Dialect: postgres Sequelize version: 5.1.0 Tested with latest release: Yes

Note : Your issue may be ignored OR closed by maintainers if it’s not tested against latest version OR does not follow issue template.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
KristenKatonacommented, Mar 26, 2019

My team is also experiencing the issue and we’ve done a workaround by creating a base model that all of our paranoid delete models extend. In that base model we added a hook for afterDestroy that simply renames the deleted_at field to deletedAt.

0reactions
papbcommented, Aug 20, 2019

Closing in favor of #11225

Read more comments on GitHub >

github_iconTop Results From Across the Web

Paranoid - Sequelize
Sequelize supports the concept of paranoid tables. A paranoid table is one that, when told to delete a record, it will not truly...
Read more >
How to pass options like paranoid,underscore in sequelize ...
I am writing migration files using Sequelize. I wanna know how do I pass options like paranoid,underscore in QueryInterface.
Read more >
Garmin Venu 2 Plus review: Who's it for? | CNN Underscored
While in smartwatch mode, which means not using GPS to track workouts, Garmin says the Venu 2 Plus will last up to nine...
Read more >
Upgrade to v5 - Manual | Sequelize
To avoid problems when upgrading, please check all your custom validators ... With the underscored option set to true , the field option...
Read more >
Múltiples underscores problem - JCE Editor
This is due to the Markdown conversion feature, as _text is equivalent to <em>text</em> in markdown. To disable this, uncheck the Markdown option...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found