1 | #!/bin/sh
|
---|
2 |
|
---|
3 | # Steps to reproduce the bug
|
---|
4 | # 1. build the project
|
---|
5 | # 2. run bootstrap to initialize the database
|
---|
6 | # 3. during bootstrap db migrations is run via call_command('migrate'):
|
---|
7 | # - openvpn_server table is created
|
---|
8 | # - openvpn_client table is created; it uses foreign key to openvpn_server
|
---|
9 | # - openvpn_server table is renamed to openvpn_server__old
|
---|
10 | # - openvpn_client foreign key is re-linked to openvpn_server__old
|
---|
11 | # - openvpn_server is created and data from openvpn_server__old is copied
|
---|
12 | # - openvpn_server__old is dropped
|
---|
13 | # - openvpn_client still references openvpn_sever__old - ForeignKey constraint is not updated
|
---|
14 | # 3. try creating Client object - SQL cannot be executed
|
---|
15 |
|
---|
16 | make devel
|
---|
17 | cd backend
|
---|
18 | source ./env/bin/activate
|
---|
19 | ./manage.py bootstrap
|
---|
20 |
|
---|
21 | echo '
|
---|
22 | Now type that:
|
---|
23 |
|
---|
24 | ./manage.py shell
|
---|
25 | In [1]: from openvpnathome.apps.openvpn.models import Server, Client
|
---|
26 |
|
---|
27 | In [2]: Client.objects.create()
|
---|
28 |
|
---|
29 | ... snip ...
|
---|
30 |
|
---|
31 | OperationalError: no such table: main.openvpn_server__old
|
---|
32 | '
|
---|
33 |
|
---|