Initial commit
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
-- Delete and recreate admin@demo.com user
|
||||
-- Run this against PowderCoatingDb
|
||||
|
||||
BEGIN TRANSACTION;
|
||||
|
||||
-- Delete the user and all related records
|
||||
DECLARE @UserId NVARCHAR(450);
|
||||
SELECT @UserId = Id FROM AspNetUsers WHERE Email = 'admin@demo.com';
|
||||
|
||||
IF @UserId IS NOT NULL
|
||||
BEGIN
|
||||
-- Delete user claims
|
||||
DELETE FROM AspNetUserClaims WHERE UserId = @UserId;
|
||||
|
||||
-- Delete user roles
|
||||
DELETE FROM AspNetUserRoles WHERE UserId = @UserId;
|
||||
|
||||
-- Delete user logins
|
||||
DELETE FROM AspNetUserLogins WHERE UserId = @UserId;
|
||||
|
||||
-- Delete user tokens
|
||||
DELETE FROM AspNetUserTokens WHERE UserId = @UserId;
|
||||
|
||||
-- Delete the user
|
||||
DELETE FROM AspNetUsers WHERE Id = @UserId;
|
||||
|
||||
PRINT 'User admin@demo.com deleted successfully.';
|
||||
END
|
||||
ELSE
|
||||
BEGIN
|
||||
PRINT 'User admin@demo.com not found.';
|
||||
END
|
||||
|
||||
COMMIT TRANSACTION;
|
||||
|
||||
PRINT 'User deleted. Restart the application - the seed data will recreate the user on next startup.';
|
||||
Reference in New Issue
Block a user