diff --git a/project/accounts/management/commands/test_db_destroy.py b/project/accounts/management/commands/test_db_destroy.py new file mode 100644 index 0000000..08d0840 --- /dev/null +++ b/project/accounts/management/commands/test_db_destroy.py @@ -0,0 +1,14 @@ +# project/app_name/management/commands/test_db_destroy.py + +from django.core.management.base import BaseCommand +from django.db import connections + +class Command(BaseCommand): + help = 'Destroy the test database' + + def handle(self, *args, **options): + connection = connections['default'] + cursor = connection.cursor() + cursor.execute('DROP DATABASE IF EXISTS test_hospital') + self.stdout.write(self.style.SUCCESS('Test database destroyed successfully.')) + print("Test database destroyed successfully.") \ No newline at end of file diff --git a/project/project/settings/production.py b/project/project/settings/production.py index 76e7bc8..4532e88 100644 --- a/project/project/settings/production.py +++ b/project/project/settings/production.py @@ -11,4 +11,8 @@ db_config['ATOMIC_REQUESTS'] = True DATABASES = { 'default': db_config, + "TEST": { + "NAME": "my_testdatabase", + }, + }