USE [EnVisage]
GO
if exists (select 1 from sys.tables where name like 'PasswordResetRequest')
begin
	ALTER TABLE [dbo].[PasswordResetRequest] DROP CONSTRAINT [FK_PasswordResetRequest_AspNetUsers]

	ALTER TABLE [dbo].[PasswordResetRequest] DROP CONSTRAINT [DF_PasswordResetRequest_Id]

	/****** Object:  Table [dbo].[PasswordResetRequest]    Script Date: 12/29/2014 3:35:36 PM ******/
	DROP TABLE [dbo].[PasswordResetRequest]
end

/****** Object:  Table [dbo].[PasswordResetRequest]    Script Date: 12/29/2014 3:35:36 PM ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[PasswordResetRequest](
	[Id] [uniqueidentifier] NOT NULL,
	[UserId] [nvarchar](128) NOT NULL,
	[Token] [uniqueidentifier] NOT NULL,
	[ValidUntil] [datetime] NOT NULL,
 CONSTRAINT [PK_PasswordResetRequest] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[PasswordResetRequest] ADD  CONSTRAINT [DF_PasswordResetRequest_Id]  DEFAULT (newid()) FOR [Id]
GO

ALTER TABLE [dbo].[PasswordResetRequest]  WITH CHECK ADD  CONSTRAINT [FK_PasswordResetRequest_AspNetUsers] FOREIGN KEY([UserId])
REFERENCES [dbo].[AspNetUsers] ([Id])
GO

ALTER TABLE [dbo].[PasswordResetRequest] CHECK CONSTRAINT [FK_PasswordResetRequest_AspNetUsers]
GO


