Enforce product barcodes to be unique (references #1205)

This commit is contained in:
Bernd Bestel 2021-02-21 18:55:48 +01:00
parent 2aca551692
commit 4555bf3b63
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300
2 changed files with 29 additions and 4 deletions

View File

@ -1,9 +1,21 @@
- Fixed that tracking chores with "Done by" a different user was not possible
### Stock improvements/fixes
- Product barcodes are now enforced to be unique across products
- Fixed that editing stock entries was not possible
- Fixed that shopping list prints had a grey background (thanks @Forceu)
- Improved/fixed the form validation on the shopping list item page (thanks @Forceu)
- Fixed that consuming with Scan Mode was not possible
- Fixed that the current stock total value (header of the stock overview page) didn't include decimal amounts (thanks @Ape)
- Some night mode style improvements (thanks @BlizzWave and @KTibow)
### Shopping list fixes
- Fixed that shopping list prints had a grey background (thanks @Forceu)
- Fixed the form validation on the shopping list item page (thanks @Forceu)
### Recipe improvements
- Recipe printing improvements (thanks @Ape)
### Chores fixes
- Fixed that tracking chores with "Done by" a different user was not possible
### General & other improvements
- Some night mode style improvements (thanks @BlizzWave and @KTibow)
### API fixes
- Fixed that due soon products with `due_type` = "Expiration date" were missing in `due_products` of the `/stock/volatile` endpoint

13
migrations/0128.sql Normal file
View File

@ -0,0 +1,13 @@
-- Duplicate product barcodes were most probably not created on purpose,
-- so just keep the newer one for any duplicates
DELETE FROM product_barcodes
WHERE id IN (
SELECT MIN(id)
FROM product_barcodes
GROUP BY barcode
HAVING COUNT(*) > 1
);
CREATE UNIQUE INDEX ix_product_barcodes ON product_barcodes (
barcode
);