sql: forbid same location for part

This commit is contained in:
King Kévin 2023-01-23 14:41:06 +01:00
parent 519759e185
commit de89dc9b4a
1 changed files with 2 additions and 1 deletions

View File

@ -134,5 +134,6 @@ CREATE TABLE IF NOT EXISTS inventory (
location INTEGER,
quantity INTEGER NOT NULL,
FOREIGN KEY (part) REFERENCES part (id),
FOREIGN KEY (location) REFERENCES location (id)
FOREIGN KEY (location) REFERENCES location (id),
UNIQUE (part, location)
);