forked from oscarychen/drf-stripe-subscription
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmake_package_migrations.py
49 lines (42 loc) · 1.12 KB
/
make_package_migrations.py
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
#!environment/bin/python
"""
Use this script to create migrations for this standalone package.Remember to update references to model outside this
package (such as auth user model) manually by editing the generated migrations files. See printout instruction below.
"""
import django
from django.conf import settings
from django.core.management import call_command
settings.configure(
DEBUG=True,
INSTALLED_APPS=(
'django.contrib.contenttypes',
'django.contrib.auth',
'drf_stripe',
),
)
django.setup()
call_command('makemigrations', 'drf_stripe')
print('''
Finished generating migrations.
Check the migration file, update any reference to existing user model. Ie:
(1) Instead of
```
dependencies = [
('auth', '0012_alter_user_first_name_max_length'),
]
```
Change it to:
```
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
```
(2) In fields, instead of referring to user model as
```
'auth.user'
```
change it to
```
settings.AUTH_USER_MODEL
```
''')