diff --git a/README.md b/README.md index 53d672e..f2c1e27 100644 --- a/README.md +++ b/README.md @@ -223,6 +223,17 @@ can make the following steps: Note that these actions is safe, also you can do that to reset your migrations if your migration files is too many. +## Use `aerich` in application + +You can use `aerich` out of cli by use `Command` class. + +```python +from aerich import Command + +command = Command(tortoise_config=config, app='models') +await command.migrate('test') +``` + ## License This project is licensed under the diff --git a/aerich/__init__.py b/aerich/__init__.py index 31fe76f..ef44daf 100644 --- a/aerich/__init__.py +++ b/aerich/__init__.py @@ -117,7 +117,7 @@ class Command: inspect = InspectDb(connection, tables) await inspect.inspect() - async def migrate(self, name: str): + async def migrate(self, name: str = "update"): return await Migrate.migrate(name) async def init_db(self, safe: bool):