mirror of
https://github.com/DrizzleTime/Foxel.git
synced 2026-09-08 17:16:50 +08:00
chore(db): remove patch for aiosqlite in init_db function
This commit is contained in:
@@ -12,22 +12,7 @@ TORTOISE_ORM = {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def patch_aiosqlite_for_tortoise() -> None:
|
|
||||||
import aiosqlite
|
|
||||||
|
|
||||||
if hasattr(aiosqlite.Connection, "start"):
|
|
||||||
return
|
|
||||||
|
|
||||||
def start(self) -> None: # type: ignore[no-redef]
|
|
||||||
if not self._thread.is_alive():
|
|
||||||
self._thread.start()
|
|
||||||
|
|
||||||
aiosqlite.Connection.start = start # type: ignore[attr-defined]
|
|
||||||
|
|
||||||
|
|
||||||
async def init_db():
|
async def init_db():
|
||||||
patch_aiosqlite_for_tortoise()
|
|
||||||
await Tortoise.init(config=TORTOISE_ORM)
|
await Tortoise.init(config=TORTOISE_ORM)
|
||||||
await Tortoise.generate_schemas()
|
await Tortoise.generate_schemas()
|
||||||
await runtime_registry.refresh()
|
await runtime_registry.refresh()
|
||||||
|
|||||||
Reference in New Issue
Block a user