refactor: avoid updating inited config file (#402)

* refactor: avoid updating config file if init config items not changed

* fix unittest error with tortoise develop branch

* Remove extra space

* fix mysql test error

* fix mysql create index error
This commit is contained in:
Waket Zheng
2025-01-04 09:08:14 +08:00
committed by GitHub
parent f5d7d56fa5
commit ac847ba616
6 changed files with 76 additions and 51 deletions

View File

@@ -181,7 +181,11 @@ def test_sqlite_migrate(tmp_path: Path) -> None:
if (db_file := Path("db.sqlite3")).exists():
db_file.unlink()
run_aerich("aerich init -t settings.TORTOISE_ORM")
config_file = Path("pyproject.toml")
modify_time = config_file.stat().st_mtime
run_aerich("aerich init-db")
run_aerich("aerich init -t settings.TORTOISE_ORM")
assert modify_time == config_file.stat().st_mtime
r = run_shell("pytest _test.py::test_allow_duplicate")
assert r.returncode == 0
# Add index