Select version
v7.18 v7.16 v7.13 v7.12 v7.11 v7.9 v7.8 v7.7 v7.6 v7.5 v7.3 v7.1 v7.0 v6.8 v6.7 v6.6 v6 v5 v4 v3 v2

Deleting Purchase Orders and Baskets from the Database in Ucommerce

One thing you might want to do before putting a new Ucommerce solution into a production environment is remove any test baskets and orders you might have placed during development. The schema gets a little complicated with the rich functionality found in the Ucommerce Transaction Foundation requiring the objects to be removed in a certain order.


Here’s how you go about deleting them.


Please be aware that running the following script will remove any baskets and orders found in the system with no way to get them back unless you have a database backup handy.

    -- Delete reviews
    DELETE FROM Ucommerce_ProductReviewComment
    DELETE FROM Ucommerce_ProductReview
    -- Delete discounts
    DELETE FROM Ucommerce_OrderLineDiscountRelation
    DELETE FROM Ucommerce_Discount
    -- Remove shipment <-> order line link
    UPDATE Ucommerce_OrderLine SET ShipmentId = NULL
    UPDATE Ucommerce_PurchaseOrder SET BillingAddressId = NULL
    DELETE FROM Ucommerce_Shipment
    DELETE FROM Ucommerce_OrderAddress
    DELETE FROM Ucommerce_OrderProperty
    DELETE FROM Ucommerce_OrderLine
    DELETE FROM Ucommerce_PaymentProperty
    DELETE FROM Ucommerce_Payment
    DELETE FROM Ucommerce_OrderStatusAudit
    DELETE FROM Ucommerce_PurchaseOrder
    DELETE FROM Ucommerce_Address
    DELETE FROM Ucommerce_Customer

As an added precaution I uncommented the commit statement in case you were wondering why the data isn’t being deleted :)

Ucommerce Aps - Vestergade 58N, 4th. floor - 8000 Aarhus C - Denmark
Phone +45 61 799 997 - Email [email protected] Ucommerce logo