tortoise / aerich

A database migrations tool for TortoiseORM, ready to production.
https://github.com/tortoise/aerich
Apache License 2.0
804 stars 90 forks source link

Improved feedback for "migrate" when models and schema are in sync #318

Open kyhorne opened 10 months ago

kyhorne commented 10 months ago

Description:

Issue:

When using Aerich to generate migrations, there might be instances where the existing database schema matches the current models perfectly, and there are no changes to be made. In such scenarios, running the migrate command in Aerich results in a less-than-helpful error message.

Steps to reproduce:

  1. Make sure the database schema is in sync with the current ORM models.
  2. Execute poetry run aerich migrate --name drop_column.

Actual Behavior:

The program throws an error:

Traceback (most recent call last):
... (rest of the traceback here)
AttributeError: 'NoneType' object has no attribute 'pop'

Suggestion:

To enhance the user experience, Aerich should provide a more intuitive feedback message when no migrations are needed. This will help users understand that their models are in sync with the database schema and no actions are required.

The following message could be a good start:

"No changes detected between the current models and the existing schema. No migrations generated."