script fix

master
Tudor Stanciu 2021-11-13 15:08:33 +02:00
parent 3fe1721f85
commit be76c3a5f3
1 changed files with 9 additions and 1 deletions

View File

@ -14,7 +14,7 @@ begin
[Password] varchar(100) not null, [Password] varchar(100) not null,
FirstName varchar(100), FirstName varchar(100),
LastName varchar(100), LastName varchar(100),
Email varchar(100) constraint UQ_AppUser_Email unique, Email varchar(100),
ProfilePictureUrl varchar(200), ProfilePictureUrl varchar(200),
SecurityStamp varchar(200) constraint UQ_AppUser_SecurityStamp unique, SecurityStamp varchar(200) constraint UQ_AppUser_SecurityStamp unique,
StatusId int not null constraint FK_AppUser_UserStatus references UserStatus(StatusId), StatusId int not null constraint FK_AppUser_UserStatus references UserStatus(StatusId),
@ -26,6 +26,14 @@ begin
end end
go go
if not exists (select top 1 1 from sys.indexes where name = 'IDX_AppUser_Email_NOTNULL' AND object_id = OBJECT_ID('AppUser'))
begin
CREATE UNIQUE NONCLUSTERED INDEX IDX_AppUser_Email_NOTNULL
ON AppUser(Email)
WHERE Email IS NOT NULL
end
go
if not exists (select top 1 1 from AppUser) if not exists (select top 1 1 from AppUser)
begin begin
declare @activeStatusId int declare @activeStatusId int