Created
December 8, 2011 21:27
-
-
Save half-ogre/1448679 to your computer and use it in GitHub Desktop.
Deleting a package registration directly in the database
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use NuGetGallery | |
BEGIN TRAN | |
DECLARE @PackageRegistrationId nvarchar(max) | |
SET @PackageRegistrationId = '<id>' | |
ALTER TABLE GallerySettings NOCHECK CONSTRAINT ALL | |
DELETE FROM PackageStatistics | |
FROM PackageStatistics ps | |
JOIN Packages p ON p.[Key] = ps.PackageKey | |
JOIN PackageRegistrations pr ON pr.[Key] = p.PackageRegistrationKey | |
WHERE pr.Id = @PackageRegistrationId | |
ALTER TABLE GallerySettings CHECK CONSTRAINT ALL | |
DELETE FROM PackageDependencies | |
FROM PackageDependencies pd | |
JOIN Packages p ON p.[Key] = pd.PackageKey | |
JOIN PackageRegistrations pr ON pr.[Key] = p.PackageRegistrationKey | |
WHERE pr.Id = @PackageRegistrationId | |
DELETE FROM PackageAuthors | |
FROM PackageAuthors pa | |
JOIN Packages p ON p.[Key] = pa.PackageKey | |
JOIN PackageRegistrations pr ON pr.[Key] = p.PackageRegistrationKey | |
WHERE pr.Id = @PackageRegistrationId | |
DELETE FROM Packages | |
FROM Packages p | |
JOIN PackageRegistrations pr ON pr.[Key] = p.PackageRegistrationKey | |
WHERE pr.Id = @PackageRegistrationId | |
DELETE FROM PackageOwnerRequests | |
FROM PackageOwnerRequests por | |
JOIN PackageRegistrations pr ON pr.[Key] = por.PackageRegistrationKey | |
WHERE pr.Id = @PackageRegistrationId | |
DELETE FROM PackageRegistrationOwners | |
FROM PackageRegistrationOwners pro | |
JOIN PackageRegistrations pr ON pr.[Key] = pro.PackageRegistrationKey | |
WHERE pr.Id = @PackageRegistrationId | |
DELETE FROM PackageRegistrations WHERE Id = @PackageRegistrationId | |
COMMIT TRAN |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment