Skip to content

Instantly share code, notes, and snippets.

@space11
Forked from vekexasia/gist:2328838
Last active February 26, 2020 20:41
Show Gist options
  • Save space11/4ab288f34d2a21d635492eccd612abb9 to your computer and use it in GitHub Desktop.
Save space11/4ab288f34d2a21d635492eccd612abb9 to your computer and use it in GitHub Desktop.
Database schema for a password reset functionality.
CREATE TABLE [DataBaseName].[dbo].[PasswordResetTokens] (
[token] varchar(36) NOT NULL, // 36 characters to fit GUID with delimiters
[userId] int NOT NULL,
[lastUpdate] datetime NOT NULL,
[tokenUsed] bit NOT NULL,
CONSTRAINT PasswordResetTokens_PK PRIMARY KEY (token),
CONSTRAINT PasswordResetTokens_FK FOREIGN KEY (userId) REFERENCES [DataBaseName].[dbo].[User](id)
) GO
EXEC [DataBaseName].sys.sp_addextendedproperty 'MS_Description', 'Store Password Reset Tokens ', 'schema', 'dbo', 'table', 'PasswordResetTokens' GO
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment