-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
47 lines (33 loc) · 907 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
DBDIR := "./src/db"
all: clean_build
clean:
rm -rf .next
clean_build: clean
yarn install --force
yarn build
migrate: migrate_latest
migrate_latest:
yarn run knex --cwd "./src/db" migrate:latest
migrate_up: node_modules
yarn run knex --cwd ${DBDIR} migrate:up
migrate_down: node_modules
yarn run knex --cwd ${DBDIR} migrate:down
migrate_reset: node_modules
/bin/bash -c '\
while [ "x$${OUT/Already at the base migration}" == "x$${OUT}" ]; do\
export OUT="$$(yarn run knex --cwd ${DBDIR} migrate:down)";\
echo "$$OUT";\
done;\
'
seed:
yarn run knex --cwd "./src/db" seed:run
db_seed: migrate seed
db_up: migrate
db_down: migrate_reset
cmd: db_up
yarn build
yarn start
.PHONY: all clean clean_build clean_deps build \
migrate migrate_latest migrate_up migrate_down migrate_reset \
seed db_up db_down \
cmd start