From 1c09b0eb5db415985bfefb52786dbe48d757665e Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Sat, 6 Sep 2025 18:31:40 +0200 Subject: feat: Provide basic barcode handling support --- crates/rocie-server/src/storage/migrate/sql/0->1.sql | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'crates/rocie-server/src/storage/migrate/sql/0->1.sql') diff --git a/crates/rocie-server/src/storage/migrate/sql/0->1.sql b/crates/rocie-server/src/storage/migrate/sql/0->1.sql index 13bc1cb..5aa497d 100644 --- a/crates/rocie-server/src/storage/migrate/sql/0->1.sql +++ b/crates/rocie-server/src/storage/migrate/sql/0->1.sql @@ -37,11 +37,15 @@ CREATE TABLE barcodes ( amount INTEGER NOT NULL, unit TEXT NOT NULL, FOREIGN KEY(product_id) REFERENCES products(id), - FOREIGN KEY(unit) REFERENCES units(name) + FOREIGN KEY(unit) REFERENCES units(id) ) STRICT; CREATE TABLE units ( - name TEXT UNIQUE NOT NULL PRIMARY KEY + id TEXT UNIQUE NOT NULL PRIMARY KEY, + full_name_singular TEXT UNIQUE NOT NULL, + full_name_plural TEXT UNIQUE NOT NULL, + short_name TEXT UNIQUE NOT NULL, + description TEXT ) STRICT; -- Encodes unit conversions: @@ -51,8 +55,8 @@ CREATE TABLE unit_conversions ( from_unit TEXT NOT NULL, to_unit TEXT NOT NULL, factor REAL NOT NULL, - FOREIGN KEY(from_unit) REFERENCES units(name), - FOREIGN KEY(to_unit) REFERENCES units(name) + FOREIGN KEY(from_unit) REFERENCES units(id), + FOREIGN KEY(to_unit) REFERENCES units(id) ) STRICT; -- Log of all the applied operations to this db. -- cgit 1.4.1