feat: support --fake for aerich upgrade (#398)

* feat: support `--fake` for aerich upgrade

* Add `--fake` to downgrade

* tests: check --fake result for aerich upgrade and downgrade

* Update readme

* Fix unittest failed because of `db_field_types` changed

* refactor: improve type hints and document
This commit is contained in:
Waket Zheng
2025-02-07 19:44:15 +08:00
committed by GitHub
parent ac847ba616
commit b46ceafb2e
22 changed files with 794 additions and 387 deletions

View File

@@ -278,6 +278,23 @@ await command.init()
await command.migrate('test')
```
## Upgrade/Downgrade with `--fake` option
Marks the migrations up to the latest one(or back to the target one) as applied, but without actually running the SQL to change your database schema.
- Upgrade
```bash
aerich upgrade --fake
aerich --app models upgrade --fake
```
- Downgrade
```bash
aerich downgrade --fake -v 2
aerich --app models downgrade --fake -v 2
```
## License
This project is licensed under the