Support multiple databases. (#68)

This commit is contained in:
long2ice
2020-10-28 17:02:02 +08:00
parent bb929f2b55
commit 724379700e
8 changed files with 142 additions and 54 deletions

View File

@@ -161,10 +161,24 @@ Now your db rollback to specified version.
1_202029051520102929_drop_column.json
```
## Support this project
### Multiple databases
- Just give a star!
- Donation.
```python
tortoise_orm = {
"connections": {
"default": expand_db_url(db_url, True),
"second": expand_db_url(db_url_second, True),
},
"apps": {
"models": {"models": ["tests.models", "aerich.models"], "default_connection": "default"},
"models_second": {"models": ["tests.models_second"], "default_connection": "second",},
},
}
```
You need only specify `aerich.models` in one app, and must specify `--app` when run `aerich migrate` and so on.
## Support this project
| AliPay | WeChatPay | PayPal |
| -------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ---------------------------------------------------------------- |