Created
February 21, 2014 11:57
-
-
Save grenade/9133075 to your computer and use it in GitHub Desktop.
Remove all versions of a package from a private nuget gallery server. The IIS app pool must be recycled after running the SQL transaction, in order for the changes to show up correctly in the gallery.
This file contains hidden or 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
| DECLARE @PackageRegistrationKey int | |
| SELECT @PackageRegistrationKey = [Key] | |
| FROM PackageRegistrations | |
| WHERE Id = 'MyNastyPackage' | |
| BEGIN TRANSACTION | |
| DELETE pf | |
| FROM [NuGetGallery].[dbo].[PackageFrameworks] pf | |
| JOIN Packages p ON pf.Package_Key = p.[Key] | |
| WHERE PackageRegistrationKey = @PackageRegistrationKey | |
| DELETE pa | |
| FROM [NuGetGallery].[dbo].[PackageAuthors] pa | |
| JOIN Packages p ON pa.PackageKey = p.[Key] | |
| WHERE PackageRegistrationKey = @PackageRegistrationKey | |
| DELETE gs | |
| FROM [NuGetGallery].[dbo].[GallerySettings] gs | |
| JOIN [PackageStatistics] ps ON gs.DownloadStatsLastAggregatedId = ps.[Key] | |
| JOIN Packages p ON ps.PackageKey = p.[Key] | |
| WHERE PackageRegistrationKey = @PackageRegistrationKey | |
| DELETE ps | |
| FROM [NuGetGallery].[dbo].[PackageStatistics] ps | |
| JOIN Packages p ON ps.PackageKey = p.[Key] | |
| WHERE PackageRegistrationKey = @PackageRegistrationKey | |
| DELETE pd | |
| FROM [NuGetGallery].[dbo].[PackageDependencies] pd | |
| JOIN Packages p ON pd.PackageKey = p.[Key] | |
| WHERE PackageRegistrationKey = @PackageRegistrationKey | |
| DELETE | |
| FROM [NuGetGallery].[dbo].[Packages] | |
| WHERE PackageRegistrationKey = @PackageRegistrationKey | |
| DELETE por | |
| FROM PackageOwnerRequests por | |
| JOIN PackageRegistrations pr ON pr.[Key] = por.PackageRegistrationKey | |
| WHERE pr.[Key] = @PackageRegistrationKey | |
| DELETE pro | |
| FROM PackageRegistrationOwners pro | |
| JOIN PackageRegistrations pr ON pr.[Key] = pro.PackageRegistrationKey | |
| WHERE pr.[Key] = @PackageRegistrationKey | |
| DELETE FROM PackageRegistrations | |
| WHERE [Key] = @PackageRegistrationKey | |
| COMMIT TRANSACTION |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment