For my part, I would usually only look at/copy 100 lines which are pasted here (line at top and at bottom must read ``` (3-backticks) to make it code block). However having got this far I would accept a simple github repo from you if it's easy, whatever gives me less work to do to get it compiling and running. What I would ask is for you to try to remove absolutely anything/every line which is not required to illustrate the issue. I do not care about your real-world requirements, I care only about whatever is minimal to show a problem. Please do include sending the CREATE TABLE string to the db as I am not familiar with SQLite and don't have any tool which might be required to create a database/table outside of your code.
Looking back at your examples, I think versions 3 or 4 are the most useful. (Actually looks like 4 is the best, 3 allows a PK to be NULL.) I agree I see just the food column alone seeming to change from 3 to 0 which looks odd.
P.S. IMPORTANT
What is this I see about SQLite when I Google does sqlite make first column be autoincrement:
SQLite
https://www.sqlite.org › faq
26 Nov 2024 — Short answer: A column declared INTEGER PRIMARY KEY will autoincrement. Longer answer: If you declare a column of a table to be INTEGER ...
?!
I think you need to read https://www.sqlite.org/lang_createtable.html#rowid. You may need to look into
Except for WITHOUT ROWID tables, all rows within SQLite tables have a 64-bit signed integer key that uniquely identifies the row within its table. This integer is usually called the "rowid". The rowid value can be accessed using one of the special case-independent names "rowid", "oid", or "rowid" in place of a column name. If a table contains a user defined column named "rowid", "oid" or "rowid", then that name always refers the explicitly declared column and cannot be used to retrieve the integer rowid value.
The rowid (and "oid" and "rowid") is omitted in WITHOUT ROWID tables. WITHOUT ROWID tables are only available in SQLite version 3.8.2 (2013-12-06) and later. A table that lacks the WITHOUT ROWID clause is called a "rowid table".
If I read right, SQLite makes assumptions about you using an INT as a PK which you do not want in your case....