#NEWLINE# def _create_test_db( self , verbosity , autoclobber ) : #NEWLINE# #INDENT# settings_dict = self . connection . settings_dict #NEWLINE# if ( self . connection . _DJANGO_VERSION >= 13 ) : #NEWLINE# #INDENT# test_name = self . _get_test_db_name ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if settings_dict [ 'TEST_NAME' ] : #NEWLINE# #INDENT# test_name = settings_dict [ 'TEST_NAME' ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# from django.db.backends.base.creation import TEST_DATABASE_PREFIX #NEWLINE# #UNINDENT# except ImportError : #NEWLINE# #INDENT# from django.db.backends.creation import TEST_DATABASE_PREFIX #NEWLINE# #UNINDENT# test_name = ( TEST_DATABASE_PREFIX + settings_dict [ 'NAME' ] ) #NEWLINE# #UNINDENT# #UNINDENT# if ( self . connection . _DJANGO_VERSION >= 17 ) : #NEWLINE# #INDENT# settings_dict [ 'TEST' ] [ 'NAME' ] = test_name #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( not settings_dict [ 'TEST_NAME' ] ) : #NEWLINE# #INDENT# settings_dict [ 'TEST_NAME' ] = test_name #NEWLINE# #UNINDENT# #UNINDENT# if ( not self . connection . test_create ) : #NEWLINE# #INDENT# if ( verbosity >= 1 ) : #NEWLINE# #INDENT# print ( 'Dropping tables ... ' ) #NEWLINE# #UNINDENT# self . connection . close ( ) #NEWLINE# settings_dict [ 'NAME' ] = test_name #NEWLINE# cursor = self . connection . cursor ( ) #NEWLINE# qn = self . connection . ops . quote_name #NEWLINE# sql = "SELECT TABLE_NAME, CONSTRAINT_NAME FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS WHERE CONSTRAINT_TYPE = 'FOREIGN KEY'" #NEWLINE# for row in cursor . execute ( sql ) . fetchall ( ) : #NEWLINE# #INDENT# objs = ( qn ( row [ 0 ] ) , qn ( row [ 1 ] ) ) #NEWLINE# cursor . execute ( ( 'ALTER TABLE %s DROP CONSTRAINT %s' % objs ) ) #NEWLINE# #UNINDENT# for table in self . connection . introspection . get_table_list ( cursor ) : #NEWLINE# #INDENT# if ( verbosity >= 1 ) : #NEWLINE# #INDENT# print ( ( 'Dropping table %s' % table ) ) #NEWLINE# #UNINDENT# cursor . execute ( ( 'DROP TABLE %s' % qn ( table ) ) ) #NEWLINE# #UNINDENT# self . connection . connection . commit ( ) #NEWLINE# return test_name #NEWLINE# #UNINDENT# if self . connection . ops . on_azure_sql_db : #NEWLINE# #INDENT# self . connection . close ( ) #NEWLINE# settings_dict [ 'NAME' ] = 'master' #NEWLINE# #UNINDENT# return super ( DatabaseCreation , self ) . _create_test_db ( verbosity , autoclobber )