From d37529d5fef10dd3b2888f54ec36a9720479ff33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81d=C3=A1m=20Dienes?= <71842242+adamdienes@users.noreply.github.com> Date: Tue, 16 Apr 2024 20:22:51 +0200 Subject: [PATCH] Add UNIQUE constraint for barcode --- database/setup.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/database/setup.js b/database/setup.js index 9eed4bf..1dffc27 100644 --- a/database/setup.js +++ b/database/setup.js @@ -2,10 +2,10 @@ module.exports.setupDatabase = function(db) { db.serialize(() => { db.run(`CREATE TABLE IF NOT EXISTS Products ( id INTEGER PRIMARY KEY, + barcode TEXT UNIQUE, name TEXT, description TEXT, - image_url TEXT, - barcode TEXT + image_url TEXT )`); //Consumers may be allergic or have intolerance to other ingredients, but only the 14 allergens are required to be declared as allergens by food law.