Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

Revert "fix(ingestion): add process_end_at column and keep OSS ingest-log a no-op" (#21897)

Jin Haif06c4481a6ee
diff --git a/internal/dao/ingestion_log_process_end_at_test.go b/internal/dao/ingestion_log_process_end_at_test.go
deleted file mode 100644
index 6083645b90..0000000000
--- a/internal/dao/ingestion_log_process_end_at_test.go
+++ /dev/null
@@ -1,64 +0,0 @@
-// Copyright 2026 The InfiniFlow Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package dao
-
-import (
- "context"
- "testing"
-
- "ragflow/internal/entity"
-
- "github.com/glebarez/sqlite"
- "gorm.io/gorm"
-)
-
-// TestMigrateIngestionLogRunIdentityAddsProcessEndAt is a regression test for the
-// missing schema migration in #21711: the PR added PipelineOperationLog.ProcessEndAt
-// (column process_end_at) and persists it on terminal settlement, but omitted the
-// ALTER that adds the column. Without it, every enqueue fails with
-// "Unknown column 'process_end_at' in 'field list'".
-func TestMigrateIngestionLogRunIdentityAddsProcessEndAt(t *testing.T) {
- db, err := gorm.Open(sqlite.Open(":memory:"), &gorm.Config{})
- if err != nil {
- t.Fatalf("open sqlite: %v", err)
- }
- ctx := context.Background()
- if err := db.Exec(`CREATE TABLE pipeline_operation_log (
- id varchar(32) PRIMARY KEY,
- document_id varchar(32) NOT NULL
- )`).Error; err != nil {
- t.Fatalf("create legacy table: %v", err)
- }
-
- if err := migrateIngestionLogRunIdentity(ctx, db); err != nil {
- t.Fatalf("migrateIngestionLogRunIdentity: %v", err)
- }
-
- migrator := db.Migrator()
- if !migrator.HasColumn(&entity.PipelineOperationLog{}, "process_end_at") {
- t.Fatal("pipeline_operation_log missing process_end_at column after migration")
- }
- if !migrator.HasIndex(&entity.PipelineOperationLog{}, "idx_pipeline_operation_log_process_end_at") {
- t.Fatal("pipeline_operation_log missing process_end_at index after migration")
- }
-
- // Idempotent: a second run must not error and must keep the column.
- if err := migrateIngestionLogRunIdentity(ctx, db); err != nil {
- t.Fatalf("second migrateIngestionLogRunIdentity: %v", err)
- }
- if !migrator.HasColumn(&entity.PipelineOperationLog{}, "process_end_at") {
- t.Fatal("process_end_at column lost after second migration")
- }
-}
diff --git a/internal/dao/migration.go b/internal/dao/migration.go
index 17d6e22f4a..52c87122c1 100644
--- a/internal/dao/migration.go
+++ b/internal/dao/migration.go
@@ -447,16 +447,6 @@ func migrateIngestionLogRunIdentity(ctx context.Context, db *gorm.DB) error {
return fmt.Errorf("add pipeline_operation_log.run_count: %w", err)
}
}
- if !migrator.HasColumn(&entity.PipelineOperationLog{}, "process_end_at") {
- if err := db.WithContext(ctx).Exec(
- "ALTER TABLE pipeline_operation_log ADD COLUMN process_end_at datetime NULL",
- ).Error; err != nil && !isDuplicateColumnError(err) {
- return fmt.Errorf("add pipeline_operation_log.process_end_at: %w", err)
- }
- }
- if err := createIngestionLogIndexIfMissing(migrator, &entity.PipelineOperationLog{}, "idx_pipeline_operation_log_process_end_at", "add pipeline_operation_log.process_end_at index"); err != nil {
- return err
- }
if err := createIngestionLogIndexIfMissing(migrator, &entity.PipelineOperationLog{}, "idx_pipeline_operation_log_document_run", "add pipeline_operation_log document/run index"); err != nil {
return err
}