From acd5af5d0d87f7683086788ebcba94197cb5b660 Mon Sep 17 00:00:00 2001 From: Shane Jaroch Date: Thu, 22 Jan 2026 00:16:08 -0500 Subject: [PATCH] update schema, and config files --- .github/workflows/ci.yml | 32 ++++++++++++++++++++++++++++++++ .travis.yml | 10 ---------- Makefile | 5 ++++- sql/data/bf_eq.csv | 8 ++++---- sql/data/bmr_eq.csv | 10 +++++----- sql/tables.sql | 12 +++++++++--- 6 files changed, 54 insertions(+), 23 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..146c274 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,32 @@ +--- +name: CI + +on: + push: + branches: [master, main] + pull_request: + branches: [master, main] + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.x" + + - name: Build + run: | + make build + + - name: Test + run: | + make test + + - name: Clean + run: | + make clean diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 9a28983..0000000 --- a/.travis.yml +++ /dev/null @@ -1,10 +0,0 @@ ---- -dist: xenial -os: ["linux"] -language: python -python: - - "3.6" -script: - - make build - - make test - - make clean diff --git a/Makefile b/Makefile index 14b0c7d..871829e 100644 --- a/Makefile +++ b/Makefile @@ -25,7 +25,10 @@ test: ## Cursory sanity check 'SELECT * FROM bmr_eq;' \ 'SELECT * FROM meal_name;' \ 'SELECT * FROM rda;' \ - 'SELECT * FROM version;' \ + 'PRAGMA user_version;' \ + 'PRAGMA application_id;' \ + 'PRAGMA foreign_keys;' \ + 'PRAGMA integrity_check;' \ .PHONY: install install: ## Copy sqlite file into ~/.nutra diff --git a/sql/data/bf_eq.csv b/sql/data/bf_eq.csv index e26f6d0..ae8fb47 100644 --- a/sql/data/bf_eq.csv +++ b/sql/data/bf_eq.csv @@ -1,4 +1,4 @@ -id,name -1,NAVY -2,3SITE -3,7SITE +id,name,friendly_name,requires +1,NAVY,Navy,"gender, height (cm), waist (cm), neck (cm), and (if female) hip (cm)" +2,3SITE,3 Site calipers,"gender, age, chest (mm), abdominal (mm), and thigh (mm)" +3,7SITE,7 Site calipers,"gender, age, chest (mm), abdominal (mm), thigh (mm), tricep (mm), sub (mm), sup (mm), and mid (mm)" diff --git a/sql/data/bmr_eq.csv b/sql/data/bmr_eq.csv index 399d4f8..e9f7e59 100644 --- a/sql/data/bmr_eq.csv +++ b/sql/data/bmr_eq.csv @@ -1,5 +1,5 @@ -id,name -1,HARRIS_BENEDICT -2,KATCH_MACARDLE -3,MIFFLIN_ST_JEOR -4,CUNNINGHAM +id,name,friendly_name,requires +1,HARRIS_BENEDICT,Harris Benedict,activity_factor;weight;body_fat +2,KATCH_MACARDLE,Katch Macardle,activity_factor;weight;body_fat +3,MIFFLIN_ST_JEOR,Mifflin St Jeor,activity_factor;weight;gender;height;age +4,CUNNINGHAM,Cunningham,activity_factor;weight;gender;height;age diff --git a/sql/tables.sql b/sql/tables.sql index 38091f2..c6f87a2 100644 --- a/sql/tables.sql +++ b/sql/tables.sql @@ -14,9 +14,11 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -- + PRAGMA user_version = 9; +PRAGMA application_id = 1314145346; -- 'NTDB' --- NOTE: INSERT INTO statements for version, bmr_eq, bf_eq? Don't maintain as CSV? +-- NOTE: INSERT INTO statements for bmr_eq, bf_eq? Don't maintain as CSV? -- TODO: enforce FK constraint across two DBs? -- --------------------------------- @@ -24,12 +26,16 @@ PRAGMA user_version = 9; --------------------------------- CREATE TABLE bmr_eq ( id integer PRIMARY KEY, - name text NOT NULL UNIQUE + name text NOT NULL UNIQUE, + friendly_name text NOT NULL UNIQUE, + requires text NOT NULL ); CREATE TABLE bf_eq ( id integer PRIMARY KEY, - name text NOT NULL UNIQUE + name text NOT NULL UNIQUE, + friendly_name text NOT NULL UNIQUE, + requires text NOT NULL ); -- -- 2.52.0