MCPcopy Index your code
hub / github.com/tortoise/tortoise-orm / db_delete

Method db_delete

tortoise/backends/mssql/client.py:71–84  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

69 return (await cursor.fetchone())[0]
70
71 async def db_delete(self) -> None:
72 if not self.database:
73 return
74 await self.create_connection(with_db=False)
75 database = self.database
76 sql = (
77 f"IF DB_ID(N'{database}') IS NOT NULL "
78 "BEGIN "
79 f"ALTER DATABASE [{database}] SET SINGLE_USER WITH ROLLBACK IMMEDIATE; "
80 f"DROP DATABASE [{database}]; "
81 "END"
82 )
83 await self.execute_script(sql)
84 await self.close()
85
86
87def _gen_savepoint_name(_c=count()) -> str:

Callers

nothing calls this directly

Calls 3

create_connectionMethod · 0.45
execute_scriptMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected