-
Notifications
You must be signed in to change notification settings - Fork 0
/
resetdb.sh
executable file
·52 lines (44 loc) · 1.35 KB
/
resetdb.sh
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
48
49
50
51
52
#!/bin/sh
DBNAME='mutodb'
sudo -u postgres dropdb $DBNAME
sudo -u postgres createdb $DBNAME
sudo -u postgres psql <<EOF
GRANT ALL PRIVILEGES ON DATABASE $DBNAME TO muuser
EOF
# migrate our django apps
APPS="mutopia update"
python manage.py migrate
for app in $APPS ; do
echo $app
python manage.py makemigrations $app
python manage.py migrate $app
done
# and load their fixtures
LOAD="python manage.py loaddata"
MUTOPIA_MODELS=" \
Composer \
Contributor \
Style \
Instrument \
LPVersion \
License \
"
UPDATE_MODELS=" \
InstrumentMap \
Marker \
"
# these depend on previous mutopia models
LAST_MODELS=" \
Piece \
Collection \
AssetMap \
"
for t in $MUTOPIA_MODELS; do
$LOAD mutopia/fixtures/${t}.json
done
for t in $UPDATE_MODELS; do
$LOAD update/fixtures/${t}.json
done
for t in $LAST_MODELS; do
$LOAD mutopia/fixtures/${t}.json
done