Create tables that do not exist in the database by calling ``metadata.create_all()`` for all or some bind keys. This does not update existing tables, use a migration library for that. This requires that a Flask application context is active. :param bind_key: A bind
(self, bind_key: str | None | list[str | None] = "__all__")
| 881 | getattr(metadata, op_name)(bind=engine) |
| 882 | |
| 883 | def create_all(self, bind_key: str | None | list[str | None] = "__all__") -> None: |
| 884 | """Create tables that do not exist in the database by calling |
| 885 | ``metadata.create_all()`` for all or some bind keys. This does not |
| 886 | update existing tables, use a migration library for that. |
| 887 | |
| 888 | This requires that a Flask application context is active. |
| 889 | |
| 890 | :param bind_key: A bind key or list of keys to create the tables for. Defaults |
| 891 | to all binds. |
| 892 | |
| 893 | .. versionchanged:: 3.0 |
| 894 | Renamed the ``bind`` parameter to ``bind_key``. Removed the ``app`` |
| 895 | parameter. |
| 896 | |
| 897 | .. versionchanged:: 0.12 |
| 898 | Added the ``bind`` and ``app`` parameters. |
| 899 | """ |
| 900 | self._call_for_binds(bind_key, "create_all") |
| 901 | |
| 902 | def drop_all(self, bind_key: str | None | list[str | None] = "__all__") -> None: |
| 903 | """Drop tables by calling ``metadata.drop_all()`` for all or some bind keys. |