blob: 59d9fc2d560058f1b21b338c3ff8e5422894ca9e (
plain)
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
|
SQL = mysql
USER = $(shell id -un)
HOST = localhost
.PHONY: clean permissions base data full
all: full
# delete old tables and create new tables
base: base.sql
$(SQL) < $<
# fill tables with data
data: data.sql
$(SQL) < $<
# do everything
full: full.sql
$(SQL) < $<
base.sql: reset.sql init.sql functions.sql
cat $^ > $@
full.sql: base.sql data.sql
cat $^ > $@
# grant all database permissions to current user (development only)
permissions:
echo "grant all privileges on webs.* to '$(USER)'@'$(HOST)';" | sudo $(SQL)
# echo "grant file on *.* to '$(USER)'@'$(HOST)';" | sudo $(SQL)
# delete generated sql files
clean:
$(RM) full.sql base.sql
|