Skip to content

Instantly share code, notes, and snippets.

@tmkelly28
Last active April 4, 2018 16:50
Show Gist options
  • Save tmkelly28/600ed87dc79f27f06029ee68571f820f to your computer and use it in GitHub Desktop.
Save tmkelly28/600ed87dc79f27f06029ee68571f820f to your computer and use it in GitHub Desktop.
When we create an instance:
beforeValidate

--- validations are checked ---

afterValidate

beforeCreate

beforeSave

--- instance actually saved in database ---

afterCreate

afterSave
When we update an instance:
beforeValidate

--- validations are checked ---

afterValidate

beforeSave

beforeUpdate

beforeValidate (again)

--- validations are checked...again, [just in case we made changes in "beforeUpdate"](https://github.com/sequelize/sequelize/issues/4325) ---

afterValidate (again)

--- instance is actually saved in database ---

afterSave

afterUpdate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment