partsdb

electronic parts inventory
git clone https://git.e1e0.net/partsdb.git
Log | Files | Refs

commit 91de564a864e083dd34564620cf1b808b5e1ff11
parent fc79431ea2cb4dc218264a2f8508aae5ba6f5ca9
Author: Paco Esteban <paco@e1e0.net>
Date:   Mon, 15 Mar 2021 12:10:03 +0100

fix list by category

Diffstat:
Mdatabase.py | 10++++++----
Mschema.sql | 2+-
2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/database.py b/database.py @@ -17,11 +17,13 @@ LIST_PARTS_QUERY = """ GROUP BY p.id """ LIST_PARTS_CATEGORY_QUERY = """ - SELECT parts.id, parts.pn - FROM parts + SELECT p.id, p.pn, p.manufacturer, p.description, + p.footprint, p.quantity, p.part_type, c.name as cname + FROM parts as p, categories as c INNER JOIN categories - ON parts.category_id = categories.id - WHERE categories.name = ? + ON p.category_id = c.id + WHERE c.name = ? + GROUP BY p.id """ INSERT_PART_QUERY = """ INSERT INTO parts diff --git a/schema.sql b/schema.sql @@ -24,7 +24,7 @@ CREATE TABLE IF NOT EXISTS parts ( quantity integer NOT NULL DEFAULT 0, datasheet blob, image blob, - part_type text NOT NULL DEFAULT 'smd', + part_type text, insert_date text NOT NULL DEFAULT CURRENT_TIMESTAMP, update_date text NOT NULL DEFAULT CURRENT_TIMESTAMP, FOREIGN KEY (category_id) REFERENCES categories (id),