From aa81662872af259a413df2ae90b00d1012e34a4a Mon Sep 17 00:00:00 2001 From: wizardchen Date: Wed, 24 Dec 2025 11:04:24 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8DGORM=E6=89=B9=E9=87=8F?= =?UTF-8?q?=E6=8F=92=E5=85=A5=E6=97=B6=E9=9B=B6=E5=80=BC=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E8=A2=AB=E5=BF=BD=E7=95=A5=E7=9A=84=E9=97=AE=E9=A2=98=EF=BC=8C?= =?UTF-8?q?=E7=A1=AE=E4=BF=9DIsEnabled=E5=92=8CFlags=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E6=AD=A3=E7=A1=AE=E6=8F=92=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/application/repository/chunk.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/application/repository/chunk.go b/internal/application/repository/chunk.go index 10c5c9c7..78433e46 100644 --- a/internal/application/repository/chunk.go +++ b/internal/application/repository/chunk.go @@ -27,7 +27,9 @@ func (r *chunkRepository) CreateChunks(ctx context.Context, chunks []*types.Chun for _, chunk := range chunks { chunk.Content = common.CleanInvalidUTF8(chunk.Content) } - return r.db.WithContext(ctx).CreateInBatches(chunks, 100).Error + // Use Select("*") to ensure all fields including zero values (IsEnabled=false, Flags=0) + // are inserted, bypassing GORM's default value behavior for zero values + return r.db.WithContext(ctx).Select("*").CreateInBatches(chunks, 100).Error } // GetChunkByID retrieves a chunk by its ID and tenant ID