forked from mintcoding/licensing-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
apply_initial_migrations.sh
executable file
·53 lines (49 loc) · 1.84 KB
/
apply_initial_migrations.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
53
#!/bin/bash
poetry run python manage.py migrate auth &&
poetry run python manage.py migrate ledger_api_client &&
# patch admin 0001_initial migration file
POETRY_ENV=$(poetry env info -p)
echo "POETRY_ENV"
echo $POETRY_ENV
if [ $POETRY_ENV ]; then
patch .venv/lib/python3.8/site-packages/django/contrib/admin/migrations/0001_initial.py < 0001_initial.py.patch1 &&
status=$?
if [ $status -ne 0 ]; then
echo "Migration patch filed: $status"
exit $status
fi
else
echo "no venv"
patch /usr/local/lib/python3.8/dist-packages/django/contrib/admin/migrations/0001_initial.py < 0001_initial.py.patch1 &&
status=$?
if [ $status -ne 0 ]; then
echo "Migration patch filed: $status"
exit $status
fi
fi
poetry run python manage.py migrate admin &&
# repatch admin 0001_initial migration file
if [ $POETRY_ENV ]; then
echo $POETRY_ENV
patch .venv/lib/python3.8/site-packages/django/contrib/admin/migrations/0001_initial.py < 0001_initial.py.patch2 &&
status=$?
if [ $status -ne 0 ]; then
echo "Migration patch filed: $status"
exit $status
fi
else
echo "no venv"
patch /usr/local/lib/python3.8/dist-packages/django/contrib/admin/migrations/0001_initial.py < 0001_initial.py.patch2 &&
status=$?
if [ $status -ne 0 ]; then
echo "Migration patch filed: $status"
exit $status
fi
fi
poetry run python manage.py migrate django_cron &&
poetry run python manage.py migrate sites 0001_initial &&
poetry run python manage.py migrate flatpages 0001_initial &&
poetry run python manage.py migrate sites 0002_alter_domain_unique &&
poetry run python manage.py migrate sessions &&
poetry run python manage.py migrate &&
poetry run python manage.py dbshell -- -c 'ALTER TABLE django_admin_log RENAME COLUMN "user" TO "user_id";'