Go: align db schema to python (#16935)

As title.

---------

Signed-off-by: Jin Hai <haijin.chn@gmail.com>
This commit is contained in:
Jin Hai
2026-07-15 23:05:06 +08:00
committed by GitHub
parent ff3d566a4f
commit 2a6e210020
18 changed files with 128 additions and 126 deletions

View File

@@ -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.host

View File

@@ -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)
}

View File

@@ -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)
}

View File

@@ -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 CHAT

View File

@@ -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 nil

View File

@@ -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_increment
var count int64
err := db.Raw(`
err = db.Raw(`
SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS
WHERE 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.COLUMNS
WHERE 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' column
if idColumnExists > 0 {
// Modify existing id column to be auto_increment primary key
if err := tx.Exec(`
if err = tx.Exec(`
ALTER TABLE tenant_llm
MODIFY 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_llm
ADD 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.STATISTICS
WHERE 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_llm
ADD 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 1024
if 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 type
if 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))
}
}

View File

@@ -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)
}

View File

@@ -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"
}

View File

@@ -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"
}

View File

@@ -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 model
type 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.

View File

@@ -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"
}

View File

@@ -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"
}

View File

@@ -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{},

View File

@@ -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{},

View File

@@ -153,9 +153,6 @@ func collectEventTypes(t *testing.T, events <-chan canvas.RunEvent) (types []str
func 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.ChatIn
func 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{},

View File

@@ -40,7 +40,6 @@ func TestListVersions_Success(t *testing.T) {
// Migrate tables needed for agent versions
if 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{},

View File

@@ -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 {

View File

@@ -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{},