fix: aerich migrate raises tortoise.exceptions.FieldError when index.INDEX_TYPE is not empty (#415)
* fix: aerich migrate raises `tortoise.exceptions.FieldError` when `index.INDEX_TYPE` is not empty * feat: add `IF NOT EXISTS` to postgres create index template * chore: explicit declare type hints of function parameters
This commit is contained in:
@@ -55,6 +55,9 @@ class Category(Model):
|
||||
title = fields.CharField(max_length=20, unique=True)
|
||||
created_at = fields.DatetimeField(auto_now_add=True)
|
||||
|
||||
class Meta:
|
||||
indexes = [Index(fields=("slug",))]
|
||||
|
||||
|
||||
class Product(Model):
|
||||
categories: fields.ManyToManyRelation[Category] = fields.ManyToManyField("models.Category")
|
||||
@@ -63,7 +66,7 @@ class Product(Model):
|
||||
view_num = fields.IntField(description="View Num")
|
||||
sort = fields.IntField()
|
||||
is_review = fields.BooleanField(description="Is Reviewed")
|
||||
type = fields.IntEnumField(
|
||||
type: int = fields.IntEnumField(
|
||||
ProductType, description="Product Type", source_field="type_db_alias"
|
||||
)
|
||||
image = fields.CharField(max_length=200)
|
||||
|
||||
Reference in New Issue
Block a user