-- Quick delete without transaction - use if NuclearDelete hangs
DECLARE @CompanyId INT = 1;

-- Most dependent first
DELETE FROM JobStatusHistory WHERE JobId IN (SELECT Id FROM Jobs WHERE CompanyId = @CompanyId);
DELETE FROM JobPhotos WHERE JobId IN (SELECT Id FROM Jobs WHERE CompanyId = @CompanyId);
DELETE FROM JobNotes WHERE JobId IN (SELECT Id FROM Jobs WHERE CompanyId = @CompanyId);
DELETE FROM Appointments WHERE CompanyId = @CompanyId;
DELETE FROM JobItems WHERE JobId IN (SELECT Id FROM Jobs WHERE CompanyId = @CompanyId);
DELETE FROM QuoteItems WHERE QuoteId IN (SELECT Id FROM Quotes WHERE CompanyId = @CompanyId);
DELETE FROM InventoryTransactions WHERE InventoryItemId IN (SELECT Id FROM InventoryItems WHERE CompanyId = @CompanyId);
DELETE FROM MaintenanceRecords WHERE EquipmentId IN (SELECT Id FROM Equipment WHERE CompanyId = @CompanyId);

DELETE FROM Jobs WHERE CompanyId = @CompanyId;
DELETE FROM Quotes WHERE CompanyId = @CompanyId;
DELETE FROM CatalogItems WHERE CompanyId = @CompanyId;
DELETE FROM CatalogCategories WHERE CompanyId = @CompanyId;

DELETE FROM Customers WHERE CompanyId = @CompanyId;
DELETE FROM InventoryItems WHERE CompanyId = @CompanyId;
DELETE FROM Equipment WHERE CompanyId = @CompanyId;
DELETE FROM ShopWorkers WHERE CompanyId = @CompanyId;
DELETE FROM PricingTiers WHERE CompanyId = @CompanyId;
DELETE FROM CompanyOperatingCosts WHERE CompanyId = @CompanyId;
DELETE FROM Suppliers WHERE CompanyId = @CompanyId;

DELETE FROM JobStatusLookups WHERE CompanyId = @CompanyId;
DELETE FROM JobPriorityLookups WHERE CompanyId = @CompanyId;
DELETE FROM QuoteStatusLookups WHERE CompanyId = @CompanyId;
DELETE FROM AppointmentStatusLookups WHERE CompanyId = @CompanyId;
DELETE FROM AppointmentTypeLookups WHERE CompanyId = @CompanyId;
DELETE FROM InventoryCategoryLookups WHERE CompanyId = @CompanyId;

PRINT 'Done!';
