mirror of
https://github.com/lemeow125/StudE-Backend.git
synced 2024-11-17 06:19:24 +08:00
Added custom_migrate command to simplify migrating with spatialite backend
This commit is contained in:
parent
4c3b8763a8
commit
1fc262a530
3 changed files with 14 additions and 0 deletions
0
stude/accounts/management/__init__.py
Normal file
0
stude/accounts/management/__init__.py
Normal file
0
stude/accounts/management/commands/__init__.py
Normal file
0
stude/accounts/management/commands/__init__.py
Normal file
14
stude/accounts/management/commands/custom_migrate.py
Normal file
14
stude/accounts/management/commands/custom_migrate.py
Normal file
|
@ -0,0 +1,14 @@
|
|||
from django.core.management.base import BaseCommand
|
||||
from django.db import connection
|
||||
from django.core.management import call_command
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = 'Run InitSpatialMetaData and then migrate'
|
||||
|
||||
def handle(self, *args, **kwargs):
|
||||
with connection.cursor() as cursor:
|
||||
cursor.execute('SELECT InitSpatialMetaData(1);')
|
||||
|
||||
# Call the Django migrate command
|
||||
call_command('migrate')
|
Loading…
Reference in a new issue