diff options
| author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2025-09-06 18:31:40 +0200 |
|---|---|---|
| committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2025-09-06 18:31:40 +0200 |
| commit | 1c09b0eb5db415985bfefb52786dbe48d757665e (patch) | |
| tree | db1cdbcff8baae9a73fca34e14b52cb8cf7ff230 /crates/rocie-server/src/storage/migrate/sql/0->1.sql | |
| parent | feat: Provide basic API frame (diff) | |
| download | server-1c09b0eb5db415985bfefb52786dbe48d757665e.zip | |
feat: Provide basic barcode handling support
Diffstat (limited to 'crates/rocie-server/src/storage/migrate/sql/0->1.sql')
| -rw-r--r-- | crates/rocie-server/src/storage/migrate/sql/0->1.sql | 12 |
1 files changed, 8 insertions, 4 deletions
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. |
