You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm encountering an issue with Aerich where a new migration is generated every time I run docker-compose, even though there have been no changes to my models or indexes. The migrations only contain DROP INDEX and CREATE INDEX statements related to the indexes defined in my model's Meta class.
Environment:
Aerich version: 0.7.1 (also tested with the latest version)
Tortoise ORM version: 0.19.3 (also tested with the latest version)
Python version: 3.11.10
Database: PostgreSQL 15
Docker: Using Docker Compose
Checked the aerich table in the database:
The values representing both indexes do not change between migrations.
It is unclear why Aerich detects changes in the model when there are none.
Generated Migration File (repeatedly created):
asyncdefupgrade(db: BaseDBAsyncClient) ->str:
return""" DROP INDEX "brin_index_field2"; DROP INDEX "gin_index_field1"; CREATE INDEX "gin_index_field1" ON "event" USING GIN ("field1"); CREATE INDEX "brin_index_field2" ON "event" USING BRIN ("field2"); """asyncdefdowngrade(db: BaseDBAsyncClient) ->str:
return""" DROP INDEX "brin_index_field2"; DROP INDEX "gin_index_field1"; CREATE INDEX "gin_index_field1" ON "event" USING GIN ("field1"); CREATE INDEX "brin_index_field2" ON "event" USING BRIN ("field2"); """
Problem Details:
Every time I run docker-compose up, Aerich generates a new migration that includes dropping and recreating the indexes on field1 and field2.
This occurs even when there have been no changes to the model definitions or the database schema.
The issue persists after upgrading to the latest versions of Aerich and Tortoise ORM.
The problem seems related to the use of GinIndex and BrinIndex in the model's Meta class(issue does not exist when I'm creating the indexes via executing a query instead of Meta).
Expected Behavior:
No new migrations should be generated if there are no changes to the models or the indexes.
The indexes should not be dropped and recreated unnecessarily.
Additional Information:
It seems that Aerich is detecting changes in the index definitions each time, possibly due to non-deterministic generation of index representations or internal comparison issues.
The issue might be related to how GinIndex and BrinIndex are compared during the migration detection process.
The text was updated successfully, but these errors were encountered:
I'm encountering an issue with Aerich where a new migration is generated every time I run docker-compose, even though there have been no changes to my models or indexes. The migrations only contain DROP INDEX and CREATE INDEX statements related to the indexes defined in my model's Meta class.
Environment:
Model Definition:
What I've Tried:
However, this did not resolve the issue.
The values representing both indexes do not change between migrations.
It is unclear why Aerich detects changes in the model when there are none.
Generated Migration File (repeatedly created):
Problem Details:
Every time I run docker-compose up, Aerich generates a new migration that includes dropping and recreating the indexes on field1 and field2.
This occurs even when there have been no changes to the model definitions or the database schema.
The issue persists after upgrading to the latest versions of Aerich and Tortoise ORM.
The problem seems related to the use of GinIndex and BrinIndex in the model's Meta class(issue does not exist when I'm creating the indexes via executing a query instead of Meta).
Expected Behavior:
No new migrations should be generated if there are no changes to the models or the indexes.
The indexes should not be dropped and recreated unnecessarily.
Additional Information:
It seems that Aerich is detecting changes in the index definitions each time, possibly due to non-deterministic generation of index representations or internal comparison issues.
The issue might be related to how GinIndex and BrinIndex are compared during the migration detection process.
The text was updated successfully, but these errors were encountered: