details
authorgamesguru <mathmuncher11@gmail.com>
Tue, 9 Mar 2021 19:04:14 +0000 (14:04 -0500)
committergamesguru <mathmuncher11@gmail.com>
Tue, 9 Mar 2021 19:10:34 +0000 (14:10 -0500)
.gitignore
sql/build.py
sql/import.sql [deleted file]
sql/init.sql [deleted file]
sql/tables.sql

index a757062b234a790c3e7653302025c6b61455b441..a4e0d3274e7f36d3df4542dc2bd684e3d818cf4a 100644 (file)
@@ -3,6 +3,6 @@
 ._*
 .DS_Store
 
-# database files
-*.db
-*.sqlite
+# Database files
+*.sqlite*
+
index a0673dd79fd0b321f02c52301481f84195fd7869..1cd54b2652253bd721a9f69f5a58fd3110812081 100755 (executable)
@@ -1,3 +1,4 @@
+#!/usr/bin/env python3
 import csv
 import os
 import sqlite3
@@ -14,9 +15,12 @@ def main():
     print("\nPack nt.sqlite")
     con = sqlite3.connect("nt.sqlite")
     cur = con.cursor()
+
+    print("\n-> Create tables")
     with open("tables.sql") as tables:
         cur.executescript(tables.read())
 
+    print("-> Populate data")
     for p in os.listdir("data"):
         if not p.endswith(".csv"):
             continue
diff --git a/sql/import.sql b/sql/import.sql
deleted file mode 100644 (file)
index 19c7a18..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
--- nt-sqlite, an sqlite3 database for nutratracker clients
--- Copyright (C) 2020  Shane Jaroch <nutratracker@gmail.com>
---
--- This program is free software: you can redistribute it and/or modify
--- it under the terms of the GNU General Public License as published by
--- the Free Software Foundation, either version 3 of the License, or
--- (at your option) any later version.
---
--- This program is distributed in the hope that it will be useful,
--- but WITHOUT ANY WARRANTY; without even the implied warranty of
--- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
--- GNU General Public License for more details.
---
--- You should have received a copy of the GNU General Public License
--- along with this program.  If not, see <https://www.gnu.org/licenses/>.
-
-PRAGMA foreign_keys = 1;
--- PRAGMA integrity_check = 1;
-
-
-.mode csv
--- .nullvalue NULL
-
-.import '| tail -n +2 ./data/bmr_eqs.csv' bmr_eqs
-.import '| tail -n +2 ./data/bf_eqs.csv' bf_eqs
-.import '| tail -n +2 ./data/meals.csv' meals
-
-.import '| tail -n +2 ./data/biometrics.csv' biometrics
-.import '| tail -n +2 ./data/profiles.csv' profiles
-.import '| tail -n +2 ./data/rda.csv' rda
-
-.import '| tail -n +2 ./data/recipes.csv' recipes
-.import '| tail -n +2 ./data/recipe_dat.csv' recipe_dat
-
-.import '| tail -n +2 ./data/food_log.csv' food_log
-.import '| tail -n +2 ./data/recipe_log.csv' recipe_log
-
-.import '| tail -n +2 ./data/biometric_log.csv' biometric_log
-.import '| tail -n +2 ./data/bio_log_entry.csv' bio_log_entry
-
-.header on
-.mode column
diff --git a/sql/init.sql b/sql/init.sql
deleted file mode 100644 (file)
index 9039d81..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-.read tables.sql
-.read import.sql
index a8afd35a4771fa5fc11a11cabf5249ff9c81ecd1..8414f5c11c28d152b428d6f6f626713815b1ce0b 100644 (file)
@@ -17,9 +17,6 @@
 CREATE TABLE version( id integer PRIMARY KEY AUTOINCREMENT, version text NOT NULL, created date NOT NULL, notes text
 );
 
-INSERT INTO version(version, created, notes)
-  VALUES ('0.0.0', '2020-09-22', 'initial release');
-
 --
 ---------------------------------
 -- Equations