refactor: refs #6875 Add restriction on vn.buy.packing field not null and > 0 #2047

Merged
guillermo merged 3 commits from 6875-packingNotNull into dev 2024-03-14 08:05:12 +00:00
2 changed files with 13 additions and 1 deletions
Showing only changes of commit 2e01b6ee0a - Show all commits

View File

@ -182,7 +182,7 @@ proc: BEGIN
LEFT JOIN producer p ON p.id = i.producerFk LEFT JOIN producer p ON p.id = i.producerFk
SET inv.buyingValue = b.buyingValue, SET inv.buyingValue = b.buyingValue,
inv.freightValue = b.freightValue, inv.freightValue = b.freightValue,
inv.packing = b.packing, inv.packing = IFNULL(GREATEST(b.packing, 1), 1),
guillermo marked this conversation as resolved Outdated

si baix fas açò
ALTER TABLE vn.buy MODIFY COLUMN packing int(11) NOT NULL CHECK(packing > 0);

ja no fa falta tocar esta linea perque no hi ha forma de que hi haja registres incorrectes.

si baix fas açò ALTER TABLE vn.buy MODIFY COLUMN packing int(11) NOT NULL CHECK(packing > 0); ja no fa falta tocar esta linea perque no hi ha forma de que hi haja registres incorrectes.
inv.`grouping`= b.`grouping`, inv.`grouping`= b.`grouping`,
inv.groupingMode = b.groupingMode, inv.groupingMode = b.groupingMode,
inv.comissionValue = b.comissionValue, inv.comissionValue = b.comissionValue,

View File

@ -0,0 +1,12 @@
-- Place your SQL code here
UPDATE vn.buy
SET packing = 1
WHERE packing IS NULL
OR NOT packing
ALTER TABLE vn.buy MODIFY COLUMN packing int(11) NOT NULL CHECK(packing > 0);
guillermo marked this conversation as resolved Outdated

aprofitar per a posar el camp com a unsigned, ja que hi ha negatius, els valors actuals posarlos a uno, els mes recients son de agost.

aprofitar per a posar el camp com a unsigned, ja que hi ha negatius, els valors actuals posarlos a uno, els mes recients son de agost.
-- antes tenia '0=sin obligar 1=groping 2=packing'
ALTER TABLE vn.buy MODIFY COLUMN groupingMode tinyint(4) DEFAULT 0 NOT NULL COMMENT '0=sin obligar 1=grouping 2=packing';