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
Go: align db schema to python (#16935)
Jin Hai2a6e21002065
diff --git a/api/db/db_models.py b/api/db/db_models.pyindex dcfb4b1e61..bb58f181f1 100644--- a/api/db/db_models.py+++ b/api/db/db_models.py@@ -823,9 +823,9 @@ class TenantLLM(DataBaseModel):class TenantLangfuse(DataBaseModel):tenant_id = CharField(max_length=32, null=False, primary_key=True)- secret_key = CharField(max_length=2048, null=False, help_text="SECRET KEY", index=True)- public_key = CharField(max_length=2048, null=False, help_text="PUBLIC KEY", index=True)- host = CharField(max_length=128, null=False, help_text="HOST", index=True)+ secret_key = CharField(max_length=2048, null=False, help_text="SECRET KEY")+ public_key = CharField(max_length=2048, null=False, help_text="PUBLIC KEY")+ host = CharField(max_length=128, null=False, help_text="HOST")def __str__(self):return "Langfuse host" + self.hostdiff --git a/cmd/ragflow-cli.go b/cmd/ragflow-cli.goindex 0b088a2c08..74c89d59cf 100644--- a/cmd/ragflow-cli.go+++ b/cmd/ragflow-cli.go@@ -46,7 +46,7 @@ func main() {logLevel = "info"}- if err = common.Init(logLevel, common.FileOutput{}); err != nil {+ if err = common.Init(logLevel, common.FileOutput{}, "ragflow-cli"); err != nil {fmt.Printf("Warning: Failed to initialize logger: %v\n", err)}diff --git a/cmd/ragflow_server.go b/cmd/ragflow_server.goindex c100e91b89..f572ac3e14 100644--- a/cmd/ragflow_server.go+++ b/cmd/ragflow_server.go@@ -249,7 +249,7 @@ func main() {logLevel = "debug"}- if err = common.Init(logLevel, common.FileOutput{Path: logFile}); err != nil {+ if err = common.Init(logLevel, common.FileOutput{Path: logFile}, serverName); err != nil {panic("failed to initialize logger: " + err.Error())}@@ -327,7 +327,7 @@ func main() {if config.Log.Path != "" {fileOut.Path = config.Log.Path}- if err = common.Init(logLevel, fileOut); err != nil {+ if err = common.Init(logLevel, fileOut, serverName); err != nil {common.Error("Failed to reinitialize logger with configured level", err)}diff --git a/internal/cli/user_parser.go b/internal/cli/user_parser.goindex 9f310957bf..a5aa17f843 100644--- a/internal/cli/user_parser.go+++ b/internal/cli/user_parser.go@@ -2697,7 +2697,7 @@ func (p *Parser) parseAPIDisable() (*Command, error) {}// region MODEL commands-// CHAT 'model@instance@provider' 'hello world'+// CHAT WITH 'model@instance@provider' MESSAGE 'hello world'// CHAT WITH 'model@instance@provider' MESSAGE 'hello world' 'who are you' IMAGE 'url1' 'file0' VIDEO "url2.mov" "file1" FILE "url" "path file2" AUDIO "file.wav"func (p *Parser) parseAPIChat() (*Command, error) {p.nextToken() // consume CHATdiff --git a/internal/common/logger.go b/internal/common/logger.goindex 2224048e75..cc98fcfc70 100644--- a/internal/common/logger.go+++ b/internal/common/logger.go@@ -96,7 +96,7 @@ func logLevelName(level zapcore.Level) string {//// Numeric fields (MaxSize, MaxBackups, MaxAge) are defaulted to 100/10/30// when zero. Compress is taken as supplied.-func Init(level string, file FileOutput) error {+func Init(level string, file FileOutput, serviceName string) error {zapLevel, err := parseZapLevel(level)if err != nil {zapLevel = zapcore.InfoLevel@@ -107,7 +107,7 @@ func Init(level string, file FileOutput) error {encoderConfig := zapcore.EncoderConfig{TimeKey: "timestamp",LevelKey: "level",- NameKey: "logger",+ NameKey: "service",CallerKey: "",FunctionKey: "",MessageKey: "msg",@@ -119,9 +119,10 @@ func Init(level string, file FileOutput) error {// / "-HH:MM"). Easier to ingest than the default "2006-01-02// 15:04:05" layout — which had no ms and no zone — and avoids// the variable-width output of RFC3339Nano.- EncodeTime: zapcore.TimeEncoderOfLayout("2006-01-02T15:04:05.000Z07:00"),+ EncodeTime: zapcore.TimeEncoderOfLayout("2006-01-02 15:04:05.000-07:00"),EncodeDuration: zapcore.SecondsDurationEncoder,EncodeCaller: zapcore.ShortCallerEncoder,+ EncodeName: zapcore.FullNameEncoder,}maxSize := file.MaxSize@@ -156,7 +157,11 @@ func Init(level string, file FileOutput) error {atomicLevel,)- Logger = zap.New(core, zap.AddCallerSkip(1))+ if serviceName != "" {+ Logger = zap.New(core, zap.AddCallerSkip(1)).Named(serviceName)+ } else {+ Logger = zap.New(core, zap.AddCallerSkip(1))+ }Sugar = Logger.Sugar()return nildiff --git a/internal/dao/migration.go b/internal/dao/migration.goindex 6f4b0c08ad..6da9dbe322 100644--- a/internal/dao/migration.go+++ b/internal/dao/migration.go@@ -57,16 +57,6 @@ func RunMigrations(db *gorm.DB) error {return fmt.Errorf("failed to modify column types: %w", err)}- // Create skill search tables- if err := migrateSkillSearchTables(db); err != nil {- return fmt.Errorf("failed to migrate skill search tables: %w", err)- }-- // Create skill space tables- if err := migrateSkillSpaceTables(db); err != nil {- return fmt.Errorf("failed to migrate skill space tables: %w", err)- }-common.Info("All manual migrations completed successfully")return nil}@@ -92,7 +82,7 @@ func migrateTenantLLMPrimaryKey(db *gorm.DB) error {if idColumnExists > 0 {// Check if id is already a primary key with auto_incrementvar count int64- err := db.Raw(`+ err = db.Raw(`SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNSWHERE TABLE_NAME = 'tenant_llm'AND COLUMN_NAME = 'id'@@ -116,7 +106,7 @@ func migrateTenantLLMPrimaryKey(db *gorm.DB) error {tx.Raw(`SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNSWHERE TABLE_NAME = 'tenant_llm' AND COLUMN_NAME = 'temp_id'`).Scan(&tempIdExists)if tempIdExists > 0 {- if err := tx.Exec("ALTER TABLE tenant_llm DROP COLUMN temp_id").Error; err != nil {+ if err = tx.Exec("ALTER TABLE tenant_llm DROP COLUMN temp_id").Error; err != nil {common.Warn("Failed to drop temp_id column", zap.Error(err))}}@@ -124,7 +114,7 @@ func migrateTenantLLMPrimaryKey(db *gorm.DB) error {// Check if there's already an 'id' columnif idColumnExists > 0 {// Modify existing id column to be auto_increment primary key- if err := tx.Exec(`+ if err = tx.Exec(`ALTER TABLE tenant_llmMODIFY COLUMN id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY`).Error; err != nil {@@ -132,7 +122,7 @@ func migrateTenantLLMPrimaryKey(db *gorm.DB) error {}} else {// Add id column as auto_increment primary key- if err := tx.Exec(`+ if err = tx.Exec(`ALTER TABLE tenant_llmADD COLUMN id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST`).Error; err != nil {@@ -145,7 +135,7 @@ func migrateTenantLLMPrimaryKey(db *gorm.DB) error {tx.Raw(`SELECT COUNT(*) FROM INFORMATION_SCHEMA.STATISTICSWHERE TABLE_NAME = 'tenant_llm' AND INDEX_NAME = 'idx_tenant_llm_unique'`).Scan(&idxExists)if idxExists == 0 {- if err := tx.Exec(`+ if err = tx.Exec(`ALTER TABLE tenant_llmADD UNIQUE INDEX idx_tenant_llm_unique (tenant_id, llm_factory, llm_name)`).Error; err != nil {@@ -273,7 +263,7 @@ func modifyColumnTypes(db *gorm.DB) error {return count > 0}- // dialog.top_k: ensure it's INTEGER with default 1024+ // dialog.top_k: ensure its INTEGER with default 1024if db.Migrator().HasTable("dialog") && columnExists("dialog", "top_k") {if err := db.Exec(`ALTER TABLE dialog MODIFY COLUMN top_k BIGINT NOT NULL DEFAULT 1024`).Error; err != nil {common.Warn("Failed to modify dialog.top_k", zap.Error(err))@@ -282,7 +272,7 @@ func modifyColumnTypes(db *gorm.DB) error {// tenant_llm.api_key: ensure it's TEXT typeif db.Migrator().HasTable("tenant_llm") && columnExists("tenant_llm", "api_key") {- if err := db.Exec(`ALTER TABLE tenant_llm MODIFY COLUMN api_key LONGTEXT`).Error; err != nil {+ if err := db.Exec(`ALTER TABLE tenant_llm MODIFY COLUMN api_key VARCHAR(8192)`).Error; err != nil {common.Warn("Failed to modify tenant_llm.api_key", zap.Error(err))}}diff --git a/internal/dao/search_detail_test.go b/internal/dao/search_detail_test.goindex 6691fe19e7..04d81b678b 100644--- a/internal/dao/search_detail_test.go+++ b/internal/dao/search_detail_test.go@@ -35,7 +35,7 @@ func setupSearchDetailDAOTestDB(t *testing.T) *gorm.DB {t.Fatalf("failed to open sqlite: %v", err)}- if err := db.AutoMigrate(&entity.User{}, &entity.Search{}); err != nil {+ if err = db.AutoMigrate(&entity.User{}, &entity.Search{}); err != nil {t.Fatalf("failed to migrate: %v", err)}diff --git a/internal/entity/kb.go b/internal/entity/dataset.gosimilarity index 93%rename from internal/entity/kb.gorename to internal/entity/dataset.goindex d1fea1c3ec..f89c56eff8 100644--- a/internal/entity/kb.go+++ b/internal/entity/dataset.go@@ -235,19 +235,3 @@ type KnowledgebaseListItem struct {TenantAvatar *string `json:"tenant_avatar,omitempty"`UpdateTime *int64 `json:"update_time,omitempty"`}--// InvitationCode represents the invitation code model-type InvitationCode struct {- ID string `gorm:"column:id;primaryKey;size:32" json:"id"`- Code string `gorm:"column:code;size:32;not null;index" json:"code"`- VisitTime *time.Time `gorm:"column:visit_time;index" json:"visit_time,omitempty"`- UserID *string `gorm:"column:user_id;size:32;index" json:"user_id,omitempty"`- TenantID *string `gorm:"column:tenant_id;size:32;index" json:"tenant_id,omitempty"`- Status *string `gorm:"column:status;size:1;index" json:"status,omitempty"`- BaseModel-}--// TableName returns the table name for InvitationCode model-func (InvitationCode) TableName() string {- return "invitation_code"-}diff --git a/internal/entity/invitation_code.go b/internal/entity/invitation_code.gonew file mode 100644index 0000000000..5a4bf44689--- /dev/null+++ b/internal/entity/invitation_code.go@@ -0,0 +1,35 @@+//+// 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 entity++import "time"++// InvitationCode represents the invitation code model+type InvitationCode struct {+ ID string `gorm:"column:id;primaryKey;size:32" json:"id"`+ Code string `gorm:"column:code;size:32;not null;index" json:"code"`+ VisitTime *time.Time `gorm:"column:visit_time;index" json:"visit_time,omitempty"`+ UserID *string `gorm:"column:user_id;size:32;index" json:"user_id,omitempty"`+ TenantID *string `gorm:"column:tenant_id;size:32;index" json:"tenant_id,omitempty"`+ Status *string `gorm:"column:status;size:1;index" json:"status,omitempty"`+ BaseModel+}++// TableName returns the table name for InvitationCode model+func (InvitationCode) TableName() string {+ return "invitation_code"+}diff --git a/internal/entity/llm.go b/internal/entity/llm.goindex 0590f44e5c..a2b956a42f 100644--- a/internal/entity/llm.go+++ b/internal/entity/llm.go@@ -16,21 +16,6 @@package entity-// LLMFactories LLM factory model-type LLMFactories struct {- Name string `gorm:"column:name;primaryKey;size:128" json:"name"`- Logo *string `gorm:"column:logo;type:longtext" json:"logo,omitempty"`- Tags string `gorm:"column:tags;size:255;not null;index" json:"tags"`- Rank int64 `gorm:"column:rank;default:0" json:"rank"`- Status *string `gorm:"column:status;size:1;index" json:"status,omitempty"`- BaseModel-}--// TableName specify table name-func (LLMFactories) TableName() string {- return "llm_factories"-}-// LLM LLM modeltype LLM struct {LLMName string `gorm:"column:llm_name;size:128;not null;primaryKey" json:"llm_name"`@@ -48,20 +33,6 @@ func (LLM) TableName() string {return "llm"}-// TenantLangfuse tenant langfuse model-type TenantLangfuse struct {- TenantID string `gorm:"column:tenant_id;primaryKey;size:32" json:"tenant_id"`- SecretKey string `gorm:"column:secret_key;size:2048;not null" json:"secret_key"`- PublicKey string `gorm:"column:public_key;size:2048;not null" json:"public_key"`- Host string `gorm:"column:host;size:128;not null;index" json:"host"`- BaseModel-}--// TableName specify table name-func (TenantLangfuse) TableName() string {- return "tenant_langfuse"-}-// LangfuseInfoResponse is the GET /langfuse/api-key payload: the stored// credentials enriched with the resolved Langfuse project id/name. Field// order mirrors the Python filter_by_tenant_with_info dict plus project info.diff --git a/internal/entity/llm_factories.go b/internal/entity/llm_factories.gonew file mode 100644index 0000000000..9e6e30ae05--- /dev/null+++ b/internal/entity/llm_factories.go@@ -0,0 +1,32 @@+//+// 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 entity++// LLMFactories LLM factory model+type LLMFactories struct {+ Name string `gorm:"column:name;primaryKey;size:128" json:"name"`+ Logo *string `gorm:"column:logo;type:longtext" json:"logo,omitempty"`+ Tags string `gorm:"column:tags;size:255;not null;index" json:"tags"`+ Rank int64 `gorm:"column:rank;default:0" json:"rank"`+ Status *string `gorm:"column:status;size:1;index" json:"status,omitempty"`+ BaseModel+}++// TableName specify table name+func (LLMFactories) TableName() string {+ return "llm_factories"+}diff --git a/internal/entity/tenant_langfuse.go b/internal/entity/tenant_langfuse.gonew file mode 100644index 0000000000..f7cac41e60--- /dev/null+++ b/internal/entity/tenant_langfuse.go@@ -0,0 +1,31 @@+//+// 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 entity++// TenantLangfuse tenant langfuse model+type TenantLangfuse struct {+ TenantID string `gorm:"column:tenant_id;primaryKey;size:32" json:"tenant_id"`+ SecretKey string `gorm:"column:secret_key;size:2048;not null" json:"secret_key"`+ PublicKey string `gorm:"column:public_key;size:2048;not null" json:"public_key"`+ Host string `gorm:"column:host;size:128;not null;index" json:"host"`+ BaseModel+}++// TableName specify table name+func (TenantLangfuse) TableName() string {+ return "tenant_langfuse"+}diff --git a/internal/handler/agent_test.go b/internal/handler/agent_test.goindex 82bf8eb09e..77cbdc52be 100644--- a/internal/handler/agent_test.go+++ b/internal/handler/agent_test.go@@ -49,7 +49,7 @@ func setupHandlerAgentsTestDB(t *testing.T) *gorm.DB {t.Fatalf("failed to open sqlite: %v", err)}- if err := db.AutoMigrate(+ if err = db.AutoMigrate(&entity.User{},&entity.UserCanvas{},&entity.UserCanvasVersion{},diff --git a/internal/handler/document_test.go b/internal/handler/document_test.goindex 371028ebc4..a7e32c9474 100644--- a/internal/handler/document_test.go+++ b/internal/handler/document_test.go@@ -519,7 +519,7 @@ func setupUploadHandlerDB(t *testing.T, role string) *gorm.DB {if err != nil {t.Fatalf("failed to open sqlite: %v", err)}- if err := db.AutoMigrate(+ if err = db.AutoMigrate(&entity.User{},&entity.Tenant{},&entity.UserTenant{},@@ -1028,7 +1028,7 @@ func setupHandlerAccessDB(t *testing.T) *gorm.DB {t.Fatalf("failed to open sqlite: %v", err)}- if err := db.AutoMigrate(+ if err = db.AutoMigrate(&entity.User{},&entity.Tenant{},&entity.UserTenant{},diff --git a/internal/service/agent_run_e2e_test.go b/internal/service/agent_run_e2e_test.goindex 6f739605ee..e4c9cd1ef4 100644--- a/internal/service/agent_run_e2e_test.go+++ b/internal/service/agent_run_e2e_test.go@@ -153,9 +153,6 @@ func collectEventTypes(t *testing.T, events <-chan canvas.RunEvent) (types []strfunc TestRunAgent_RealCanvas_BeginMessage(t *testing.T) {testDB := setupServiceTestDB(t)if err := testDB.AutoMigrate(- &entity.User{},- &entity.Tenant{},- &entity.UserTenant{},&entity.UserCanvas{},&entity.UserCanvasVersion{},&entity.APIToken{},@@ -240,9 +237,6 @@ func TestRunAgent_RealCanvas_BeginMessage(t *testing.T) {func TestRunAgent_RealCanvas_WaitForUserResume(t *testing.T) {testDB := setupServiceTestDB(t)if err := testDB.AutoMigrate(- &entity.User{},- &entity.Tenant{},- &entity.UserTenant{},&entity.UserCanvas{},&entity.UserCanvasVersion{},&entity.APIToken{},@@ -372,9 +366,6 @@ func TestRunAgent_RealCanvas_WaitForUserResume(t *testing.T) {func TestRunAgent_RealCanvas_WaitForUserResume_EventSemantics(t *testing.T) {testDB := setupServiceTestDB(t)if err := testDB.AutoMigrate(- &entity.User{},- &entity.Tenant{},- &entity.UserTenant{},&entity.UserCanvas{},&entity.UserCanvasVersion{},&entity.APIToken{},@@ -476,9 +467,6 @@ func TestRunAgent_RealCanvas_WaitForUserResume_EventSemantics(t *testing.T) {func TestRunAgent_RealCanvas_GroupedParallelOuterFollower(t *testing.T) {testDB := setupServiceTestDB(t)if err := testDB.AutoMigrate(- &entity.User{},- &entity.Tenant{},- &entity.UserTenant{},&entity.UserCanvas{},&entity.UserCanvasVersion{},&entity.APIToken{},@@ -609,9 +597,6 @@ func TestRunAgent_RealCanvas_GroupedParallelOuterFollower(t *testing.T) {func TestRunAgent_AllFixture_LoopInterruptResume(t *testing.T) {testDB := setupServiceTestDB(t)if err := testDB.AutoMigrate(- &entity.User{},- &entity.Tenant{},- &entity.UserTenant{},&entity.UserCanvas{},&entity.UserCanvasVersion{},&entity.APIToken{},@@ -718,9 +703,6 @@ func TestRunAgent_AllFixture_LoopInterruptResume(t *testing.T) {func TestRunAgent_AllFixture_LoopInterruptResume_MultiTurn(t *testing.T) {testDB := setupServiceTestDB(t)if err := testDB.AutoMigrate(- &entity.User{},- &entity.Tenant{},- &entity.UserTenant{},&entity.UserCanvas{},&entity.UserCanvasVersion{},&entity.APIToken{},@@ -811,9 +793,6 @@ func TestRunAgent_AllFixture_LoopInterruptResume_MultiTurn(t *testing.T) {func TestRunAgent_AllFixture_IterationFormatsItems(t *testing.T) {testDB := setupServiceTestDB(t)if err := testDB.AutoMigrate(- &entity.User{},- &entity.Tenant{},- &entity.UserTenant{},&entity.UserCanvas{},&entity.UserCanvasVersion{},&entity.APIToken{},@@ -912,9 +891,6 @@ func TestRunAgent_AllFixture_IterationFormatsItems(t *testing.T) {func TestRunAgent_AllFixture_VarAssigner(t *testing.T) {testDB := setupServiceTestDB(t)if err := testDB.AutoMigrate(- &entity.User{},- &entity.Tenant{},- &entity.UserTenant{},&entity.UserCanvas{},&entity.UserCanvasVersion{},&entity.APIToken{},@@ -977,9 +953,6 @@ func TestRunAgent_AllFixture_VarAssigner(t *testing.T) {func TestRunAgent_AllFixture_DataOps(t *testing.T) {testDB := setupServiceTestDB(t)if err := testDB.AutoMigrate(- &entity.User{},- &entity.Tenant{},- &entity.UserTenant{},&entity.UserCanvas{},&entity.UserCanvasVersion{},&entity.APIToken{},@@ -1058,9 +1031,6 @@ func TestRunAgent_AllFixture_DataOps(t *testing.T) {func TestRunAgent_RealCanvas_CompileFails(t *testing.T) {testDB := setupServiceTestDB(t)if err := testDB.AutoMigrate(- &entity.User{},- &entity.Tenant{},- &entity.UserTenant{},&entity.UserCanvas{},&entity.UserCanvasVersion{},&entity.APIToken{},@@ -1135,9 +1105,6 @@ func TestRunAgent_RealCanvas_CompileFails(t *testing.T) {func TestRunAgent_AllFixture_CategorizeResume(t *testing.T) {testDB := setupServiceTestDB(t)if err := testDB.AutoMigrate(- &entity.User{},- &entity.Tenant{},- &entity.UserTenant{},&entity.UserCanvas{},&entity.UserCanvasVersion{},&entity.APIToken{},@@ -1267,9 +1234,6 @@ func (i *categorizeResumeInvoker) Invoke(_ context.Context, req component.ChatInfunc TestRunAgent_RealCanvas_InvokeFails(t *testing.T) {testDB := setupServiceTestDB(t)if err := testDB.AutoMigrate(- &entity.User{},- &entity.Tenant{},- &entity.UserTenant{},&entity.UserCanvas{},&entity.UserCanvasVersion{},&entity.APIToken{},@@ -1374,9 +1338,6 @@ func newRunTrackerForTest(t *testing.T, ttl time.Duration) (*canvas.RunTracker,func TestRunAgent_RunTracker_AttachCheckpoint_CallSequence(t *testing.T) {testDB := setupServiceTestDB(t)if err := testDB.AutoMigrate(- &entity.User{},- &entity.Tenant{},- &entity.UserTenant{},&entity.UserCanvas{},&entity.UserCanvasVersion{},&entity.APIToken{},diff --git a/internal/service/agent_test.go b/internal/service/agent_test.goindex 80848f5e7e..3f93eb0ba5 100644--- a/internal/service/agent_test.go+++ b/internal/service/agent_test.go@@ -40,7 +40,6 @@ func TestListVersions_Success(t *testing.T) {// Migrate tables needed for agent versionsif err := testDB.AutoMigrate(- &entity.User{},&entity.UserCanvas{},&entity.UserCanvasVersion{},&entity.UserTenant{},@@ -285,7 +284,6 @@ func TestRunAgent_VersionBelongsToOtherCanvas(t *testing.T) {t.Helper()if err := testDB.AutoMigrate(- &entity.User{},&entity.UserCanvas{},&entity.UserCanvasVersion{},&entity.UserTenant{},@@ -345,7 +343,6 @@ func TestRunAgent_VersionNotFound(t *testing.T) {t.Helper()if err := testDB.AutoMigrate(- &entity.User{},&entity.UserCanvas{},&entity.UserCanvasVersion{},&entity.UserTenant{},@@ -404,7 +401,6 @@ func TestRunAgent_NoVersionPublishedPlaceholder(t *testing.T) {t.Helper()if err := testDB.AutoMigrate(- &entity.User{},&entity.UserCanvas{},&entity.UserCanvasVersion{},&entity.UserTenant{},@@ -510,7 +506,6 @@ func TestRunAgent_StorageErrorFromCanvasAccess(t *testing.T) {t.Helper()if err := testDB.AutoMigrate(- &entity.User{},&entity.UserCanvas{},&entity.UserCanvasVersion{},&entity.UserTenant{},@@ -574,7 +569,6 @@ func TestLoadCanvasForUser_StorageErrorWrap(t *testing.T) {t.Helper()if err := testDB.AutoMigrate(- &entity.User{},&entity.UserCanvas{},&entity.UserTenant{},); err != nil {@@ -621,8 +615,7 @@ func setupAgentSessionServiceTest(t *testing.T) {t.Fatalf("failed to access sqlite handle: %v", err)}sqlDB.SetMaxOpenConns(1)- if err := testDB.AutoMigrate(- &entity.User{},+ if err = testDB.AutoMigrate(&entity.UserCanvas{},&entity.UserCanvasVersion{},&entity.UserTenant{},diff --git a/internal/service/chunk/chunk_test.go b/internal/service/chunk/chunk_test.goindex a74987ae82..e2bdc1e2ed 100644--- a/internal/service/chunk/chunk_test.go+++ b/internal/service/chunk/chunk_test.go@@ -158,7 +158,7 @@ func TestParsePrevalidatesDocumentsBeforeMutating(t *testing.T) {}var taskCount int64- if err := dao.DB.Model(&entity.Task{}).Where("doc_id = ?", "doc-1").Count(&taskCount).Error; err != nil {+ if err = dao.DB.Model(&entity.Task{}).Where("doc_id = ?", "doc-1").Count(&taskCount).Error; err != nil {t.Fatalf("count tasks: %v", err)}if taskCount != 1 {diff --git a/internal/service/document_test.go b/internal/service/document_test.goindex e5042d9210..09ebcdaad5 100644--- a/internal/service/document_test.go+++ b/internal/service/document_test.go@@ -385,7 +385,7 @@ func setupServiceTestDB(t *testing.T) *gorm.DB {}// Migrate tables used by deleteDocumentFull + DeleteDocuments- if err := db.AutoMigrate(+ if err = db.AutoMigrate(&entity.Document{},&entity.Knowledgebase{},&entity.Task{},