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
No migration occurs as expected when adding unique=True to field.
For example, if you originally had a model:
class Example(models.Model):
id = SnowflakeIDField()
name = fields.CharField(max_length=64, null=False, db_index=True)
then you add a constraint to the name field:
class Example(models.Model):
id = SnowflakeIDField()
name = fields.CharField(max_length=64, null=False, db_index=True, unique=True)
the migration you expect to get should be:
async def upgrade(db: BaseDBAsyncClient) -> str:
return """
DROP INDEX IF EXISTS "idx_example_name_a7b9a6";
CREATE UNIQUE INDEX "idx_example_name_a7b9a6" ON "example" ("name");
"""
No migration occurs as expected when adding unique=True to field.
For example, if you originally had a model:
then you add a constraint to the name field:
the migration you expect to get should be:
or at least:
However, the practical result is that no migration files are produced.
Version:
aerich : 0.8.1 ac847ba
tortoise-orm : 0.23.0
asyncpg : 0.30.0
postgresql : 17.2
python : 3.12
The text was updated successfully, but these errors were encountered: