Skip to content

Instantly share code, notes, and snippets.

@vekexasia
Created April 7, 2012 13:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save vekexasia/2328838 to your computer and use it in GitHub Desktop.
Save vekexasia/2328838 to your computer and use it in GitHub Desktop.
Database schema for a password reset functionality.
CREATE TABLE IF NOT EXISTS `resetpasswordtokens` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`userID` int(11) NOT NULL,
`token` char(32) NOT NULL,
`status` set('used','new') NOT NULL DEFAULT 'new',
`date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `userID` (`userID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
@Arpan33neutroline
Copy link

What's the work of Status here?

@JefferyHus
Copy link

JefferyHus commented Jan 15, 2021

CREATE TABLE IF NOT EXISTS `resetpasswordtokens` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `userID` int(11) NOT NULL,
  `token` char(32) NOT NULL,
  `consumed` boolean DEFAULT 0,
  `expired` boolean DEFAULT 0,
  `expirationDate` timestamp NULL,
  PRIMARY KEY (`id`),
  KEY `userID` (`userID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 AUTO_INCREMENT=1 ;

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