mirror of
https://github.com/ansible/awx.git
synced 2026-03-27 05:45:02 -02:30
* Tried to fill in application_name in awx/__init__.py but I think that is too late * Fill in database application_name with enough information to easily trace the connection from postgres back to the node and pid that initiated the connection. * Set application_name in django settings so that application_name is set _before_ the first postgres connection is established.
15 lines
583 B
Python
15 lines
583 B
Python
from django.db import connections
|
|
from django.db.backends.sqlite3.base import DatabaseWrapper
|
|
from django.core.management.commands.makemigrations import Command as MakeMigrations
|
|
|
|
|
|
class Command(MakeMigrations):
|
|
|
|
def execute(self, *args, **options):
|
|
settings = connections['default'].settings_dict.copy()
|
|
settings['ENGINE'] = 'sqlite3'
|
|
if 'application_name' in settings['OPTIONS']:
|
|
del settings['OPTIONS']['application_name']
|
|
connections['default'] = DatabaseWrapper(settings)
|
|
return MakeMigrations().execute(*args, **options)
|