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:
28
tests/assets/fake/db.py
Normal file
28
tests/assets/fake/db.py
Normal file
@@ -0,0 +1,28 @@
|
||||
import asyncclick as click
|
||||
from settings import TORTOISE_ORM
|
||||
|
||||
from tests._utils import drop_db, init_db
|
||||
|
||||
|
||||
@click.group()
|
||||
def cli(): ...
|
||||
|
||||
|
||||
@cli.command()
|
||||
async def create():
|
||||
await init_db(TORTOISE_ORM, False)
|
||||
click.echo(f"Success to create databases for {TORTOISE_ORM['connections']}")
|
||||
|
||||
|
||||
@cli.command()
|
||||
async def drop():
|
||||
await drop_db(TORTOISE_ORM)
|
||||
click.echo(f"Dropped databases for {TORTOISE_ORM['connections']}")
|
||||
|
||||
|
||||
def main():
|
||||
cli()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user