sql: add assembly table

This commit is contained in:
King Kévin 2023-01-23 14:41:22 +01:00
parent de89dc9b4a
commit 69233fed43
1 changed files with 10 additions and 0 deletions

View File

@ -44,6 +44,16 @@ CREATE TABLE IF NOT EXISTS part (
FOREIGN KEY (package) REFERENCES package (id)
);
-- a project (as part) can be an assembly of other parts
CREATE TABLE IF NOT EXISTS assembly (
assembled INTEGER NOT NULL, -- the assembly project
component INTEGER NOT NULL, -- the component part
quantity INTEGER NOT NULL, -- quantity of component
FOREIGN KEY (assembled) REFERENCES part (id),
FOREIGN KEY (component) REFERENCES part (id),
UNIQUE (assembled, component)
);
-- CAD drawing type
CREATE TABLE IF NOT EXISTS cad (
id INTEGER AUTO_INCREMENT PRIMARY KEY, -- index