MCPcopy
hub / github.com/tortoise/tortoise-orm / generate_schemas

Method generate_schemas

tortoise/__init__.py:513–526  ·  view source on GitHub ↗

Generate schemas according to models provided to ``.init()`` method. Will fail if schemas already exists, so it's not recommended to be used as part of application workflow :param safe: When set to true, creates the table only when it does not already exist.

(cls, safe: bool = True)

Source from the content-addressed store, hash-verified

511
512 @classmethod
513 async def generate_schemas(cls, safe: bool = True) -> None:
514 """
515 Generate schemas according to models provided to ``.init()`` method.
516 Will fail if schemas already exists, so it's not recommended to be used as part
517 of application workflow
518
519 :param safe: When set to true, creates the table only when it does not already exist.
520
521 :raises ConfigurationError: When ``.init()`` has not been called.
522 """
523 if not cls._inited:
524 raise ConfigurationError("You have to call .init() first before generating schemas")
525 for connection in get_connections().all():
526 await generate_schema_for_client(connection, safe)
527
528 @classmethod
529 async def _drop_databases(cls) -> None:

Callers 15

init_ormFunction · 0.45
init_orm_mainFunction · 0.45
init_ormFunction · 0.45
init_ormFunction · 0.45
init_ormFunction · 0.45
innerFunction · 0.45
init_ormMethod · 0.45
runnerFunction · 0.45
init_ormFunction · 0.45

Calls 4

ConfigurationErrorClass · 0.90
get_connectionsFunction · 0.90
allMethod · 0.45