Add some Makefile targets to make working with sqlx a little more simple

This commit is contained in:
R Tyler Croy 2021-03-03 11:34:57 -08:00
parent 8a1a47669c
commit 78534ca7d1
2 changed files with 16 additions and 4 deletions

View File

@ -8,7 +8,8 @@
################################################################################
## Phony targets
.PHONY: apispecs clean diagram help steps release run
.PHONY: apispecs clean clean-db diagram help steps release run
SQLITE_DB=otto.db
# Cute hack thanks to:
# https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
@ -46,7 +47,16 @@ test: contrib/shunit2/shunit2 ## Run the acceptance tests for steps
done; \
done;
clean: ## Clean all temporary/working files
migrate: $(SQLITE_DB) ## Run the local SQLite migrations
sqlx migrate --source migrations/sqlite run
$(SQLITE_DB): ## Create an empty SQLite database
sqlx database create
clean-db: ## Remove the SQLite database for local development
rm -f $(SQLITE_DB)
clean: clean-db ## Clean all temporary/working files
diagram: system.png system.dot ## Generate the diagrams describing otto
dot -Tpng -o system.png system.dot

View File

@ -6,11 +6,13 @@
CREATE TABLE IF NOT EXISTS projects
(
uuid BLOB PRIMARY KEY NOT NULL,
path TEXT NOT NULL,
path TEXT UNIQUE NOT NULL,
title TEXT NOT NULL,
description TEXT,
source_url TEXT,
source_refspec TEXT,
pipeline_path TEXT,
pipeline_inline TEXT
pipeline_inline TEXT,
created_at DATETIME DEFAULT (DATETIME('now')),
last_updated_at DATETIME DEFAULT (DATETIME('now'))
);