Add some Makefile targets to make working with sqlx a little more simple
This commit is contained in:
parent
8a1a47669c
commit
78534ca7d1
14
Makefile
14
Makefile
|
@ -8,7 +8,8 @@
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
## Phony targets
|
## 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:
|
# Cute hack thanks to:
|
||||||
# https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
|
# 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; \
|
||||||
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
|
diagram: system.png system.dot ## Generate the diagrams describing otto
|
||||||
dot -Tpng -o system.png system.dot
|
dot -Tpng -o system.png system.dot
|
||||||
|
|
|
@ -6,11 +6,13 @@
|
||||||
CREATE TABLE IF NOT EXISTS projects
|
CREATE TABLE IF NOT EXISTS projects
|
||||||
(
|
(
|
||||||
uuid BLOB PRIMARY KEY NOT NULL,
|
uuid BLOB PRIMARY KEY NOT NULL,
|
||||||
path TEXT NOT NULL,
|
path TEXT UNIQUE NOT NULL,
|
||||||
title TEXT NOT NULL,
|
title TEXT NOT NULL,
|
||||||
description TEXT,
|
description TEXT,
|
||||||
source_url TEXT,
|
source_url TEXT,
|
||||||
source_refspec TEXT,
|
source_refspec TEXT,
|
||||||
pipeline_path TEXT,
|
pipeline_path TEXT,
|
||||||
pipeline_inline TEXT
|
pipeline_inline TEXT,
|
||||||
|
created_at DATETIME DEFAULT (DATETIME('now')),
|
||||||
|
last_updated_at DATETIME DEFAULT (DATETIME('now'))
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue