Every line of 'django drop database' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.
222 def _drop_database(self, database_name): 223 for collection in self.connection.introspection.table_names(): 224 if not collection.startswith('system.'): 225 self.connection.database.drop_collection(collection)
271 def _destroy_test_db(self, test_database_name, verbosity): 272 """ 273 Internal implementation - remove the test db tables. 274 """ 275 # Remove the test database to clean up after 276 # ourselves. Connect to the previous database (not the test database) 277 # to do so, because it's not allowed to delete a database while being 278 # connected to it. 279 with self.connection._nodb_connection.cursor() as cursor: 280 # Wait to avoid "database is being accessed by other users" errors. 281 time.sleep(1) 282 cursor.execute("DROP DATABASE %s" 283 % self.connection.ops.quote_name(test_database_name))
27 def test_database_drop(self): 28 self.assertEqual("DROP DATABASE `sakila`;", self.db.drop())
227 def drop_database(name): 228 os.remove(db_path)
82 def dropdb(): 83 with db.allow_sync(): 84 Entry.drop_table(True)
45 def recreate(): 46 drop() 47 create()
21 @task 22 def remove_db(djangoenv='develop'): 23 """ Remove ``db.sqlite3`` if it exists. """ 24 if djangoenv == 'sqlite_develop': 25 if exists(DB_FILE): 26 remove(DB_FILE) 27 else: 28 _managepy('dbdev_destroy', djangoenv=djangoenv)
28 def tearDown(self): 29 self._drop_database()
53 def __clean_old__(self, *args, **kwargs): 54 self.stdout.write("reset database") 55 call_command('reset_db') 56 self.stdout.write("clean old migrations") 57 os.system("rm -vrf */migrations/0*.py") 58 self.stdout.write("clean old images, packages, videos") 59 os.system("rm -vrf public/*")
129 def drop_all_tables(self): 130 """Drop all document collections of the database. 131 132 .. warning:: ALL DATA WILL BE LOST. Use only for automated testing. 133 """ 134 database_name = self.db.session.db._Database_name.database.name 135 self.db.session.db.connection.drop_database(database_name)