update README.md

This commit is contained in:
long2ice 2021-08-03 16:25:06 +08:00
parent 6f5a9ab78c
commit 79b7ae343a
2 changed files with 12 additions and 1 deletions

View File

@ -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. 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 ## License
This project is licensed under the This project is licensed under the

View File

@ -117,7 +117,7 @@ class Command:
inspect = InspectDb(connection, tables) inspect = InspectDb(connection, tables)
await inspect.inspect() await inspect.inspect()
async def migrate(self, name: str): async def migrate(self, name: str = "update"):
return await Migrate.migrate(name) return await Migrate.migrate(name)
async def init_db(self, safe: bool): async def init_db(self, safe: bool):