# Semana 7: dependencias funcionales y normalización. Se usa dentro del
# contenedor del curso.
#
#   make          crea la base de datos chasqui_w07 con los datos de ejemplo
#                 y le agrega la hoja de viajes (trip_sheet.sql)
#   make test     la vuelve a crear y corre las pruebas (*.test.mjs)
#   make clean    borra chasqui_w07

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

.PHONY: all test clean

all:
	chasqui-load $(DB)
	$(PSQL) -f trip_sheet.sql

# Algunas pruebas crean tablas: los archivos se corren uno después del otro.
test: all
	PGDATABASE=$(DB) node --test --test-concurrency=1 --test-reporter=spec

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