AuroraRetail — Dependency Documentation
Generated 2026-07-11 16:25 UTC by Skupa.
Inventory
| Object type | Count |
|---|---|
| Function | 2 |
| StoredProcedure | 3 |
| Table | 8 |
| Trigger | 1 |
| View | 3 |
| Total | 17 |
Dependency edges: 28
Key hub objects
| Object | Type | Connections |
|---|---|---|
dbo.Orders | Table | 6 |
dbo.OrderLines | Table | 6 |
dbo.Products | Table | 5 |
dbo.Inventory | Table | 4 |
dbo.vw_OpenOrders | View | 4 |
dbo.vw_ProductCatalog | View | 4 |
sales.vw_CustomerLifetimeValue | View | 4 |
dbo.Customers | Table | 3 |
dbo.Suppliers | Table | 3 |
dbo.usp_PlaceOrder | StoredProcedure | 3 |
Objects
Functions
dbo.fn_CustomerTier
- Referenced by:
sales.vw_CustomerLifetimeValue - References:
dbo.OrderLines,dbo.Orders
dbo.fn_OrderTotal
- Referenced by:
dbo.vw_OpenOrders - References:
dbo.OrderLines
CREATE FUNCTION dbo.fn_OrderTotal (@OrderId INT)
RETURNS DECIMAL(12,2) AS
BEGIN
RETURN (SELECT SUM(Quantity * UnitPrice)
FROM dbo.OrderLines WHERE OrderId = @OrderId);
END
Stored procedures
dbo.usp_PlaceOrder
- References:
dbo.Inventory,dbo.OrderLines,dbo.Orders
CREATE PROCEDURE dbo.usp_PlaceOrder
@CustomerId INT, @Lines dbo.OrderLineList READONLY
AS
BEGIN
SET NOCOUNT ON;
BEGIN TRAN;
INSERT dbo.Orders (CustomerId) VALUES (@CustomerId);
DECLARE @OrderId INT = SCOPE_IDENTITY();
INSERT dbo.OrderLines (OrderId, ProductId, Quantity, UnitPrice)
SELECT @OrderId, ProductId, Quantity, dbo.fn_CurrentPrice(ProductId)
FROM @Lines;
UPDATE i SET OnHand = i.OnHand - l.Quantity
FROM dbo.Inventory i JOIN @Lines l ON l.ProductId = i.ProductId;
COMMIT;
END
dbo.usp_RestockInventory
- References:
dbo.Inventory,dbo.Suppliers
sales.usp_MonthlySalesReport
- References:
dbo.vw_OpenOrders,sales.vw_CustomerLifetimeValue
Tables
audit.AuditLog
- Referenced by:
dbo.trg_Orders_Audit
dbo.Categories
- Referenced by:
dbo.Products,dbo.vw_ProductCatalog
dbo.Customers
- Referenced by:
dbo.Orders,dbo.vw_OpenOrders,sales.vw_CustomerLifetimeValue
CREATE TABLE dbo.Customers (
CustomerId INT IDENTITY PRIMARY KEY,
Email NVARCHAR(256) NOT NULL UNIQUE,
FullName NVARCHAR(200) NOT NULL,
CreatedUtc DATETIME2 NOT NULL DEFAULT SYSUTCDATETIME()
);
dbo.Inventory
- Referenced by:
dbo.usp_PlaceOrder,dbo.usp_RestockInventory,dbo.vw_ProductCatalog - References:
dbo.Products
dbo.OrderLines
- Referenced by:
dbo.fn_CustomerTier,dbo.fn_OrderTotal,dbo.usp_PlaceOrder,sales.vw_CustomerLifetimeValue - References:
dbo.Orders,dbo.Products
CREATE TABLE dbo.OrderLines (
OrderLineId BIGINT IDENTITY PRIMARY KEY,
OrderId INT NOT NULL REFERENCES dbo.Orders(OrderId),
ProductId INT NOT NULL REFERENCES dbo.Products(ProductId),
Quantity INT NOT NULL,
UnitPrice DECIMAL(10,2) NOT NULL
);
dbo.Orders
- Referenced by:
dbo.fn_CustomerTier,dbo.OrderLines,dbo.trg_Orders_Audit,dbo.usp_PlaceOrder,dbo.vw_OpenOrders - References:
dbo.Customers
CREATE TABLE dbo.Orders (
OrderId INT IDENTITY PRIMARY KEY,
CustomerId INT NOT NULL REFERENCES dbo.Customers(CustomerId),
Status TINYINT NOT NULL DEFAULT 0,
PlacedUtc DATETIME2 NOT NULL DEFAULT SYSUTCDATETIME()
);
dbo.Products
- Referenced by:
dbo.Inventory,dbo.OrderLines,dbo.vw_ProductCatalog - References:
dbo.Categories,dbo.Suppliers
CREATE TABLE dbo.Products (
ProductId INT IDENTITY PRIMARY KEY,
CategoryId INT NOT NULL REFERENCES dbo.Categories(CategoryId),
SupplierId INT NOT NULL REFERENCES dbo.Suppliers(SupplierId),
Sku NVARCHAR(32) NOT NULL UNIQUE,
Name NVARCHAR(200) NOT NULL,
ListPrice DECIMAL(10,2) NOT NULL
);
dbo.Suppliers
- Referenced by:
dbo.Products,dbo.usp_RestockInventory,dbo.vw_ProductCatalog
Triggers
dbo.trg_Orders_Audit
- References:
audit.AuditLog,dbo.Orders
CREATE TRIGGER dbo.trg_Orders_Audit ON dbo.Orders AFTER INSERT, UPDATE AS
INSERT audit.AuditLog (TableName, KeyValue, ChangedUtc)
SELECT 'Orders', OrderId, SYSUTCDATETIME() FROM inserted;
Views
dbo.vw_OpenOrders
- Referenced by:
sales.usp_MonthlySalesReport - References:
dbo.Customers,dbo.fn_OrderTotal,dbo.Orders
CREATE VIEW dbo.vw_OpenOrders AS
SELECT o.OrderId, c.FullName, o.PlacedUtc,
dbo.fn_OrderTotal(o.OrderId) AS OrderTotal
FROM dbo.Orders o
JOIN dbo.Customers c ON c.CustomerId = o.CustomerId
WHERE o.Status IN (0, 1);
dbo.vw_ProductCatalog
- References:
dbo.Categories,dbo.Inventory,dbo.Products,dbo.Suppliers
CREATE VIEW dbo.vw_ProductCatalog AS
SELECT p.Sku, p.Name, cat.Name AS Category, s.Name AS Supplier,
p.ListPrice, i.OnHand
FROM dbo.Products p
JOIN dbo.Categories cat ON cat.CategoryId = p.CategoryId
JOIN dbo.Suppliers s ON s.SupplierId = p.SupplierId
JOIN dbo.Inventory i ON i.ProductId = p.ProductId;
sales.vw_CustomerLifetimeValue
- Referenced by:
sales.usp_MonthlySalesReport - References:
dbo.Customers,dbo.fn_CustomerTier,dbo.OrderLines