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)
| 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: |