Video Thumbnail

Sign up for a plan to instantly unlock all premium lessons.

UNLOCK LESSON

Premium Features

Download Video

16. Password Reset Functionality - Part 2

Published 5 years 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

Login

No comments yet, be the first to add one

Providing the lift to launch your development career

© 2024 Chris Courses. All rights reserved.