16. Password Reset Functionality - Part 2

Published 6 months ago

Migration File
module.exports = {
  up: (queryInterface, Sequelize) => {
    return Promise.all([
      queryInterface.addColumn(
        'Users', // name of database table
        'resetPasswordToken', // name of the key we're adding
        {
          type: Sequelize.STRING
        }
      ),
      queryInterface.addColumn(
        'Users', // name of database table
        'resetPasswordTokenExpiration', // name of the key we're adding
        {
          type: Sequelize.DATE
        }
      )
    ]).catch(() => undefined)
  },

  down: (queryInterface, Sequelize) => {
    return Promise.all([
      queryInterface.removeColumn(
        'Users', // name of database table
        'resetPasswordToken' // key we want to remove
      ),
      queryInterface.removeColumn(
        'Users', // name of database table
        'resetPasswordTokenExpiration' // key we want to remove
      )
    ]).catch(() => undefined)
  }
}

Comments

Want to participate?

Create a free Chris Courses account to begin

or
Sign In

No comments yet, be the first to add one

Cheat Sheet Preview

Download The Official Chris Courses HTML5 Canvas Cheat Sheet

Essential canvas syntax at your fingertips.

Download Now

Providing the lift to launch your development career

© 2020 Chris Courses. All rights reserved.