# Semana 2: álgebra relacional y SQL básico sobre Chasqui.
# Se usa dentro del contenedor del curso.
#
#   make          crea la base de datos chasqui_w02 con los datos de ejemplo
#   make test     la vuelve a crear, corre algebra.sql y basics.sql y las pruebas
#                 (*.test.mjs); las pruebas corren también ddl.sql y errors.sql,
#                 que fallan a propósito
#   make clean    borra chasqui_w02

DB = chasqui_w02
PSQL = psql -X -q -v ON_ERROR_STOP=1 -d $(DB)

.PHONY: all test clean

all:
	chasqui-load $(DB)

test: all
	$(PSQL) -f algebra.sql > /dev/null
	$(PSQL) -f basics.sql > /dev/null
	PGDATABASE=$(DB) node --test --test-reporter=spec

clean:
	dropdb --if-exists $(DB)
