21 lines
738 B
Makefile
21 lines
738 B
Makefile
SHELL := /bin/bash
|
|
DB = ledger.db
|
|
EXPORT_RUNS = csvdata/runs.csv
|
|
EXPORT_TESTS = csvdata/test_results.csv
|
|
|
|
.PHONY: export
|
|
export: ##H Export the current database to CSVs
|
|
sqlite3 -header -csv $(DB) "SELECT * FROM runs ORDER BY id ASC;" > $(EXPORT_RUNS)
|
|
sqlite3 -header -csv $(DB) "SELECT * FROM test_results ORDER BY id ASC;" > $(EXPORT_TESTS)
|
|
|
|
.PHONY: rebuild
|
|
rebuild: ##H Re-build the database from the exported CSVs
|
|
rm -f $(DB)
|
|
sqlite3 $(DB) < tables.sql
|
|
sqlite3 $(DB) ".mode csv" ".import --skip 1 $(EXPORT_RUNS) runs"
|
|
sqlite3 $(DB) ".mode csv" ".import --skip 1 $(EXPORT_TESTS) test_results"
|
|
echo "OK."
|
|
|
|
.PHONY: tail
|
|
tail: ##H Show the last 10 runs in the log
|
|
sqlite3 -box $(DB) "SELECT * FROM runs ORDER BY id DESC LIMIT 10;"
|