RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.
Go agent-harnessagent-native-databaseagentic-aiagentic-retrievalagentic-searchaiai-agentscontext-enginecontext-engineeringcontext-managementharness-engineeringknowledge-compilationragretrieval-augmented-generationretrieval-harnesssearch-harness
fix migration (#21442)
Jin Hai176e91d7c26c
diff --git a/internal/dao/migration.go b/internal/dao/migration.goindex 569014fe25..aa42293cd8 100644--- a/internal/dao/migration.go+++ b/internal/dao/migration.go@@ -80,41 +80,10 @@ func RunMigrations(ctx context.Context, db *gorm.DB) error {return fmt.Errorf("failed to migrate tenant model data: %w", err)}- // Drop the unused tenant-level model group tables. Failover is configured- // per conversation instead, so nothing reads or writes these any more.- if err := dropModelGroupTables(ctx, db); err != nil {- return fmt.Errorf("failed to drop tenant model group tables: %w", err)- }-common.Info("All manual migrations completed successfully")return nil}-// dropModelGroupTables removes tenant_model_group and-// tenant_model_group_mapping.-//-// The tables were created by AutoMigrate for a tenant-scoped failover-group-// feature that was never shipped: no service read them, and the per-conversation-// failover path replaced the concept entirely. Their Go definitions are gone, so-// without this they would linger in every existing database with no way to remove-// them. AutoMigrate cannot express a drop, hence the explicit migration.-//-// Guarded by HasTable so a database that never had them is a no-op, and-// mapping-first because it references the group table.-func dropModelGroupTables(ctx context.Context, db *gorm.DB) error {- migrator := db.WithContext(ctx).Migrator()- for _, table := range []string{"tenant_model_group_mapping", "tenant_model_group"} {- if !migrator.HasTable(table) {- continue- }- if err := migrator.DropTable(table); err != nil {- return fmt.Errorf("drop %s: %w", table, err)- }- common.Info("Dropped unused table", zap.String("table", table))- }- return nil-}-// migrateTenantLLMPrimaryKey migrates tenant_llm from its legacy composite// primary key (tenant_id, llm_factory, llm_name) to a surrogate auto-increment// "id" column.