Files
aura-crm/production/backend/migrations/034_cartridge_toner_consumption.sql
T

12 lines
698 B
SQL

-- +goose Up
-- Grams of finished toner actually used on this cartridge's refill — set
-- together with the status->'done' transition (see internal/cartridge's
-- UpdateItem). Nullable: only cartridges whose model has a linked
-- production_recipes row (Фаза 19) ever get this filled in; every other
-- cartridge keeps working exactly as before. Not always exactly the
-- recipe's nominal fill weight — real toner weighing varies refill to
-- refill, so this is the actual amount staff weighed/used, which is what
-- gets drawn down from the finished-toner part's stock.
ALTER TABLE cartridge_items ADD COLUMN toner_grams_used INT CHECK (toner_grams_used IS NULL OR toner_grams_used > 0);