<s> from djangotoolbox . db . base import NonrelDatabaseCreation <EOL> from pyes . exceptions import NotFoundException <EOL> TEST_DATABASE_PREFIX = '<STR_LIT>' <EOL> class DatabaseCreation ( NonrelDatabaseCreation ) : <EOL> data_types = { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT:date>' , <EOL> '<STR_LIT>' : '<STR_LIT:time>' , <EOL> '<STR_LIT>' : '<STR_LIT:float>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT:bool>' , <EOL> '<STR_LIT>' : '<STR_LIT:bool>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT:int>' , <EOL> '<STR_LIT>' : '<STR_LIT:int>' , <EOL> '<STR_LIT>' : '<STR_LIT:int>' , <EOL> '<STR_LIT>' : '<STR_LIT:int>' , <EOL> '<STR_LIT>' : '<STR_LIT:int>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT:int>' , <EOL> '<STR_LIT>' : '<STR_LIT:float>' , <EOL> } <EOL> def sql_indexes_for_field ( self , model , f , style ) : <EOL> """<STR_LIT>""" <EOL> return [ ] <EOL> def index_fields_group ( self , model , group , style ) : <EOL> """<STR_LIT>""" <EOL> return [ ] <EOL> def sql_indexes_for_model ( self , model , style ) : <EOL> """<STR_LIT>""" <EOL> return [ ] <EOL> def sql_create_model ( self , model , style , known_models = set ( ) ) : <EOL> from mapping import model_to_mapping <EOL> mappings = model_to_mapping ( model ) <EOL> self . connection . db_connection . put_mapping ( model . _meta . db_table , { mappings . name : mappings . as_dict ( ) } ) <EOL> return [ ] , { } <EOL> def set_autocommit ( self ) : <EOL> "<STR_LIT>" <EOL> pass <EOL> def create_test_db ( self , verbosity = <NUM_LIT:1> , autoclobber = False ) : <EOL> from django . core . management import call_command <EOL> if self . connection . settings_dict . get ( '<STR_LIT>' ) : <EOL> test_database_name = self . connection . settings_dict [ '<STR_LIT>' ] <EOL> elif '<STR_LIT>' in self . connection . settings_dict : <EOL> test_database_name = TEST_DATABASE_PREFIX + self . connection . settings_dict [ '<STR_LIT>' ] <EOL> elif '<STR_LIT>' in self . connection . settings_dict : <EOL> if self . connection . settings_dict [ '<STR_LIT>' ] . startswith ( TEST_DATABASE_PREFIX ) : <EOL> test_database_name = self . connection . settings_dict [ '<STR_LIT>' ] <EOL> else : <EOL> test_database_name = TEST_DATABASE_PREFIX + self . connection . settings_dict [ '<STR_LIT>' ] <EOL> else : <EOL> raise ValueError ( "<STR_LIT>" ) <EOL> self . connection . settings_dict [ '<STR_LIT>' ] = test_database_name <EOL> try : <EOL> self . _drop_database ( test_database_name ) <EOL> except NotFoundException : <EOL> pass <EOL> self . connection . db_connection . create_index ( test_database_name ) <EOL> self . connection . db_connection . cluster_health ( wait_for_status = '<STR_LIT>' ) <EOL> call_command ( '<STR_LIT>' , verbosity = max ( verbosity - <NUM_LIT:1> , <NUM_LIT:0> ) , interactive = False , database = self . connection . alias ) <EOL> def destroy_test_db ( self , old_database_name , verbosity = <NUM_LIT:1> ) : <EOL> """<STR_LIT>""" <EOL> if verbosity >= <NUM_LIT:1> : <EOL> print "<STR_LIT>" % self . connection . alias <EOL> test_database_name = self . connection . settings_dict [ '<STR_LIT>' ] <EOL> self . _drop_database ( test_database_name ) <EOL> self . connection . settings_dict [ '<STR_LIT>' ] = old_database_name <EOL> def _drop_database ( self , database_name ) : <EOL> try : <EOL> self . connection . db_connection . delete_index ( database_name ) <EOL> except NotFoundException : <EOL> pass <EOL> self . connection . db_connection . cluster_health ( wait_for_status = '<STR_LIT>' ) <EOL> def sql_destroy_model ( self , model , references_to_delete , style ) : <EOL> print model </s>
