GymStockMovements table
The GymStockMovements table in the FitStack - V2 schema has 8 columns, keyed by Id, with 3 foreign keys to GymStock, Orders and Employees.
Append-only ledger; OnHand is the sum. No audit columns.
Columns (8)
| Column | Type | Constraints | Description |
|---|---|---|---|
| Id | uuid | primary key, not null | |
| StockId | uuid | not null, references GymStock.Id | CASCADE. |
| Delta | integer | not null | Negative for Sale. |
| Reason | text | not null | `StockMovementReason`. |
| OrderId | uuid | references Orders.Id | For Sale and Return. |
| EmployeeId | uuid | references Employees.Id | |
| Notes | character varying(500) | ||
| At | timestamp with time zone | not null |
Indexes (1)
(StockId, At)(IX_GymStockMovements_StockId_At)
Relationships
GymStockMovements.StockIdreferencesGymStock.IdGymStockMovements.OrderIdreferencesOrders.IdGymStockMovements.EmployeeIdreferencesEmployees.Id