Search

Index

Revindex Storefront

How to bulk delete data

Last updated on 2023-11-02 4 mins. to read

For your security, we do not support deleting data permanently. If you have only been testing and need to permanently delete all data before starting production, you can try to execute these SQL queries. Please make sure to take a full backup, run the queries and test your system afterwards.

 

This is not a supported feature. Please take a full backup first. Use at your own risk.

 

Delete all data

The follow SQL will delete all data permanently from all portals. After running the SQL, you can also delete all the files under DesktopModules\Revindex.Dnn.RevindexStorefront\Portals\<0> where <0> corresponds to any portal number. Remember to clear your server cache after deletion.


DELETE FROM Revindex_Storefront_FundHistory

DELETE FROM Revindex_Storefront_Fund

DELETE FROM Revindex_Storefront_Favorite

DELETE FROM Revindex_Storefront_SalesReturnDetail

DELETE FROM Revindex_Storefront_SalesReturn

DELETE FROM Revindex_Storefront_Right

DELETE FROM Revindex_Storefront_ProductChannel

DELETE FROM Revindex_Storefront_CrosssellProduct

DELETE FROM Revindex_Storefront_SalesOrderSequence
	
DELETE FROM Revindex_Storefront_AddressValidationMethod
	
DELETE FROM Revindex_Storefront_Customer
	
DELETE FROM Revindex_Storefront_RewardsPointHistory
	
DELETE FROM Revindex_Storefront_RewardsPoint
	
DELETE FROM Revindex_Storefront_ProductVariantOption
	
DELETE FROM Revindex_Storefront_ProductVariantGroupOption
	
DELETE FROM Revindex_Storefront_ProductVariantGroup
	
DELETE FROM Revindex_Storefront_ReportDefinition
	
DELETE FROM Revindex_Storefront_VoucherHistory
	
DELETE FROM Revindex_Storefront_Voucher
	
DELETE FROM Revindex_Storefront_UserApi
	
DELETE FROM Revindex_Storefront_WishListDetail
	
DELETE FROM Revindex_Storefront_ProductAttribute
	
DELETE FROM Revindex_Storefront_ProductAttributeDefinitionSelection
	
DELETE FROM Revindex_Storefront_ProductAttributeDefinition
	
DELETE FROM Revindex_Storefront_ProductAttributeGroup
	
DELETE FROM Revindex_Storefront_Gallery

DELETE FROM Revindex_Storefront_BoughtProduct

DELETE FROM Revindex_Storefront_SimilarProduct
	
DELETE FROM Revindex_Storefront_RelatedProduct
	
DELETE FROM Revindex_Storefront_RequiredProduct

-- Remove cyclical dependency first
UPDATE Revindex_Storefront_SalesOrderDetail
SET ParentSalesOrderDetailID = NULL
	
DELETE FROM Revindex_Storefront_SalesOrderDetail

DELETE FROM Revindex_Storefront_RecurringSalesOrder
	
DELETE FROM Revindex_Storefront_ProductCategory
	
DELETE FROM Revindex_Storefront_ProductReview

DELETE FROM Revindex_Storefront_ProductPart

DELETE FROM Revindex_Storefront_ProductComponent
	
DELETE FROM Revindex_Storefront_ProductVariant
	
DELETE FROM Revindex_Storefront_RightDefinition

DELETE FROM Revindex_Storefront_VoucherDefinition
	
DELETE FROM Revindex_Storefront_Product
	
-- Remove cyclical dependency first
UPDATE Revindex_Storefront_SalesPayment
SET ParentSalesPaymentID = NULL

DELETE FROM Revindex_Storefront_SalesPayment
	
DELETE FROM Revindex_Storefront_UserAddress
	
-- Remove cyclical dependency first
UPDATE Revindex_Storefront_Category 
SET ParentCategoryID = NULL
	
DELETE FROM Revindex_Storefront_Category
	
DELETE FROM Revindex_Storefront_Configuration
	
DELETE FROM Revindex_Storefront_Distributor
	
DELETE FROM Revindex_Storefront_Manufacturer
	
-- Remove cyclical dependency first
UPDATE Revindex_Storefront_SalesOrder 
SET ParentSalesOrderID = NULL

DELETE FROM Revindex_Storefront_SalesOrder
	
DELETE FROM Revindex_Storefront_WishList
	
DELETE FROM Revindex_Storefront_UserPayment
	
DELETE FROM Revindex_Storefront_ShippingMethod
	
DELETE FROM Revindex_Storefront_HandlingMethod
	
DELETE FROM Revindex_Storefront_PackingMethod
	
DELETE FROM Revindex_Storefront_Package
	
DELETE FROM Revindex_Storefront_TaxClass
	
DELETE FROM Revindex_Storefront_SalesPromotion
	
DELETE FROM Revindex_Storefront_Coupon
	
DELETE FROM Revindex_Storefront_Currency
	
DELETE FROM Revindex_Storefront_Warehouse

DELETE FROM Revindex_Storefront_ShippingProvider

DELETE FROM Revindex_Storefront_TaxProvider

DELETE FROM Revindex_Storefront_FulfillmentProvider

DELETE FROM Revindex_Storefront_FulfillmentMethod

DELETE FROM Revindex_Storefront_Seller

Delete all data for a single portal

Please replace 0 with your actual portal number for the site you want to delete. After running the SQL, you can also delete all the files under DesktopModules\Revindex.Dnn.RevindexStorefront\Portals\<0> where <0> corresponds to your portal number. Remember to clear your server cache after deletion.



DECLARE @PortalID INT = 0

DELETE fh
FROM Revindex_Storefront_FundHistory fh
JOIN Revindex_Storefront_Fund f
ON f.FundID = fh.FundID
WHERE f.PortalID = @PortalID

DELETE FROM Revindex_Storefront_Fund WHERE PortalID = @PortalID

DELETE FROM Revindex_Storefront_Favorite WHERE PortalID = @PortalID

DELETE srd 
FROM Revindex_Storefront_SalesReturnDetail srd
JOIN Revindex_Storefront_SalesReturn sr
ON srd.SalesReturnID = sr.SalesReturnID
WHERE sr.PortalID = @PortalID

DELETE FROM Revindex_Storefront_SalesReturn WHERE PortalID = @PortalID

DELETE r 
FROM Revindex_Storefront_Right r
JOIN Revindex_Storefront_RightDefinition rd
ON r.RightDefinitionID = rd.RightDefinitionID
WHERE rd.PortalID = @PortalID

DELETE FROM Revindex_Storefront_ProductChannel WHERE PortalID = @PortalID

DELETE FROM Revindex_Storefront_CrosssellProduct WHERE PortalID = @PortalID

DELETE FROM Revindex_Storefront_SalesOrderSequence WHERE PortalID = @PortalID
	
DELETE FROM Revindex_Storefront_AddressValidationMethod WHERE PortalID = @PortalID
	
DELETE FROM Revindex_Storefront_Customer WHERE PortalID = @PortalID
	
DELETE rph 
FROM Revindex_Storefront_RewardsPointHistory rph
JOIN Revindex_Storefront_RewardsPoint rp
ON rp.RewardsPointID = rph.RewardsPointID
WHERE rp.PortalID = @PortalID
	
DELETE FROM Revindex_Storefront_RewardsPoint WHERE PortalID = @PortalID
	
DELETE pvo 
FROM Revindex_Storefront_ProductVariantOption pvo
JOIN Revindex_Storefront_ProductVariant pv
ON pvo.ProductVariantID = pv.ProductVariantID
WHERE pv.PortalID = @PortalID
	
DELETE pvgo 
FROM Revindex_Storefront_ProductVariantGroupOption pvgo
JOIN Revindex_Storefront_ProductVariantGroup pvg
ON pvgo.ProductVariantGroupID = pvg.ProductVariantGroupID
JOIN Revindex_Storefront_Product p
ON pvg.ProductID = p.ProductID
WHERE p.PortalID = @PortalID
	
DELETE pvg 
FROM Revindex_Storefront_ProductVariantGroup pvg
JOIN Revindex_Storefront_Product p
ON pvg.ProductID = p.ProductID
WHERE p.PortalID = @PortalID
	
DELETE FROM Revindex_Storefront_ReportDefinition WHERE PortalID = @PortalID
	
DELETE vh 
FROM Revindex_Storefront_VoucherHistory vh
JOIN Revindex_Storefront_Voucher v
ON v.VoucherID = vh.VoucherID
WHERE v.PortalID = @PortalID
	
DELETE FROM Revindex_Storefront_Voucher WHERE PortalID = @PortalID
	
DELETE FROM Revindex_Storefront_UserApi WHERE PortalID = @PortalID
	
DELETE wld
FROM Revindex_Storefront_WishListDetail wld
JOIN Revindex_Storefront_WishList wl
ON wl.WishListID = wld.WishListID
WHERE wl.PortalID = @PortalID
	
DELETE pa
FROM Revindex_Storefront_ProductAttribute pa
JOIN Revindex_Storefront_ProductAttributeDefinition pad
ON pad.ProductAttributeDefinitionID = pa.ProductAttributeDefinitionID
WHERE pad.PortalID = @PortalID
	
DELETE pads
FROM Revindex_Storefront_ProductAttributeDefinitionSelection pads
JOIN Revindex_Storefront_ProductAttributeDefinition pad
ON pad.ProductAttributeDefinitionID = pads.ProductAttributeDefinitionID
WHERE pad.PortalID = @PortalID
	
DELETE FROM Revindex_Storefront_ProductAttributeDefinition WHERE PortalID = @PortalID
	
DELETE FROM Revindex_Storefront_ProductAttributeGroup WHERE PortalID = @PortalID
	
DELETE FROM Revindex_Storefront_Gallery WHERE PortalID = @PortalID

DELETE bp
FROM Revindex_Storefront_BoughtProduct bp
JOIN Revindex_Storefront_Product p
ON p.ProductID = bp.ProductID
WHERE p.PortalID = @PortalID

DELETE sp
FROM Revindex_Storefront_SimilarProduct sp
JOIN Revindex_Storefront_Product p
ON p.ProductID = sp.ProductID
WHERE p.PortalID = @PortalID
	
DELETE rp
FROM Revindex_Storefront_RelatedProduct rp
JOIN Revindex_Storefront_Product p
ON p.ProductID = rp.ProductID
WHERE p.PortalID = @PortalID
	
DELETE rp
FROM Revindex_Storefront_RequiredProduct rp
JOIN Revindex_Storefront_ProductVariant pv
ON pv.ProductVariantID = rp.ProductVariantID
WHERE pv.PortalID = @PortalID

-- Remove cyclical dependency first
UPDATE sod
SET sod.ParentSalesOrderDetailID = NULL
FROM Revindex_Storefront_SalesOrderDetail sod
JOIN Revindex_Storefront_SalesOrder so
ON so.SalesOrderID = sod.SalesOrderID
WHERE so.PortalID = @PortalID
	
DELETE sod
FROM Revindex_Storefront_SalesOrderDetail sod
JOIN Revindex_Storefront_SalesOrder so
ON so.SalesOrderID = sod.SalesOrderID
WHERE so.PortalID = @PortalID

DELETE FROM Revindex_Storefront_RecurringSalesOrder WHERE PortalID = @PortalID
	
DELETE FROM Revindex_Storefront_ProductCategory WHERE PortalID = @PortalID
	
DELETE pr
FROM Revindex_Storefront_ProductReview pr
JOIN Revindex_Storefront_Product p
ON p.ProductID = pr.ProductID
WHERE p.PortalID = @PortalID

DELETE pp
FROM Revindex_Storefront_ProductPart pp
JOIN Revindex_Storefront_ProductVariant pv
ON pv.ProductVariantID = pp.ProductVariantID
WHERE pv.PortalID = @PortalID

DELETE pc
FROM Revindex_Storefront_ProductComponent pc
JOIN Revindex_Storefront_ProductVariant pv
ON pv.ProductVariantID = pc.ProductVariantID
WHERE pv.PortalID = @PortalID
	
DELETE FROM Revindex_Storefront_ProductVariant WHERE PortalID = @PortalID
	
DELETE FROM Revindex_Storefront_RightDefinition WHERE PortalID = @PortalID

DELETE FROM Revindex_Storefront_VoucherDefinition WHERE PortalID = @PortalID
	
DELETE FROM Revindex_Storefront_Product WHERE PortalID = @PortalID
	
-- Remove cyclical dependency first
UPDATE sp
SET sp.ParentSalesPaymentID = NULL
FROM Revindex_Storefront_SalesPayment sp
JOIN Revindex_Storefront_SalesOrder so
ON so.SalesOrderID = sp.SalesOrderID
WHERE so.PortalID = @PortalID

DELETE sp
FROM Revindex_Storefront_SalesPayment sp
JOIN Revindex_Storefront_SalesOrder so
ON so.SalesOrderID = sp.SalesOrderID
WHERE so.PortalID = @PortalID
	
DELETE FROM Revindex_Storefront_UserAddress WHERE PortalID = @PortalID
	
-- Remove cyclical dependency first
UPDATE Revindex_Storefront_Category SET ParentCategoryID = NULL WHERE PortalID = @PortalID
	
DELETE FROM Revindex_Storefront_Category WHERE PortalID = @PortalID
	
DELETE FROM Revindex_Storefront_Configuration WHERE PortalID = @PortalID
	
DELETE FROM Revindex_Storefront_Distributor WHERE PortalID = @PortalID
	
DELETE FROM Revindex_Storefront_Manufacturer WHERE PortalID = @PortalID
	
-- Remove cyclical dependency first
UPDATE Revindex_Storefront_SalesOrder SET ParentSalesOrderID = NULL WHERE PortalID = @PortalID

DELETE FROM Revindex_Storefront_SalesOrder WHERE PortalID = @PortalID
	
DELETE FROM Revindex_Storefront_WishList WHERE PortalID = @PortalID
	
DELETE FROM Revindex_Storefront_UserPayment WHERE PortalID = @PortalID
	
DELETE FROM Revindex_Storefront_ShippingMethod WHERE PortalID = @PortalID
	
DELETE FROM Revindex_Storefront_HandlingMethod WHERE PortalID = @PortalID
	
DELETE FROM Revindex_Storefront_PackingMethod WHERE PortalID = @PortalID
	
DELETE FROM Revindex_Storefront_Package WHERE PortalID = @PortalID
	
DELETE FROM Revindex_Storefront_TaxClass WHERE PortalID = @PortalID
	
DELETE FROM Revindex_Storefront_SalesPromotion WHERE PortalID = @PortalID
	
DELETE FROM Revindex_Storefront_Coupon WHERE PortalID = @PortalID
	
DELETE FROM Revindex_Storefront_Currency WHERE PortalID = @PortalID
	
DELETE FROM Revindex_Storefront_Warehouse WHERE PortalID = @PortalID

DELETE FROM Revindex_Storefront_ShippingProvider WHERE PortalID = @PortalID

DELETE FROM Revindex_Storefront_TaxProvider WHERE PortalID = @PortalID

DELETE FROM Revindex_Storefront_FulfillmentProvider WHERE PortalID = @PortalID

DELETE FROM Revindex_Storefront_FulfillmentMethod WHERE PortalID = @PortalID

DELETE FROM Revindex_Storefront_Seller WHERE PortalID = @PortalID

Comments


Powered by Revindex Wiki