实现修改猪营养需求

This commit is contained in:
2025-11-22 20:52:15 +08:00
parent 3ef2910058
commit b40eb35016
6 changed files with 231 additions and 1 deletions

View File

@@ -376,6 +376,20 @@ func (ps *PostgresStorage) creatingUniqueIndex(ctx context.Context) error {
whereClause: "WHERE deleted_at IS NULL",
description: "nutrients 表的部分唯一索引 (name 唯一)",
},
{
tableName: models.Recipe{}.TableName(),
columns: []string{"name"},
indexName: "idx_recipes_unique_name_when_not_deleted",
whereClause: "WHERE deleted_at IS NULL",
description: "recipes 表的部分唯一索引 (name 唯一)",
},
{
tableName: models.RecipeIngredient{}.TableName(),
columns: []string{"recipe_id", "raw_material_id"},
indexName: "idx_recipe_ingredients_unique_recipe_raw_material_when_not_deleted",
whereClause: "WHERE deleted_at IS NULL",
description: "recipe_ingredients 表的部分唯一索引 (recipe_id, raw_material_id 组合唯一)",
},
}
for _, indexDef := range uniqueIndexesToCreate {