feat: 后台打包测试部署
All checks were successful
Backend Deploy (Go + Docker) / deploy (push) Successful in 1m29s
All checks were successful
Backend Deploy (Go + Docker) / deploy (push) Successful in 1m29s
This commit is contained in:
@@ -21,9 +21,6 @@ import (
|
||||
"github.com/zs/InsightReply/internal/service"
|
||||
"github.com/zs/InsightReply/internal/worker"
|
||||
|
||||
"github.com/golang-migrate/migrate/v4"
|
||||
_ "github.com/golang-migrate/migrate/v4/database/postgres"
|
||||
_ "github.com/golang-migrate/migrate/v4/source/file"
|
||||
"gorm.io/driver/postgres"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
@@ -58,19 +55,6 @@ func main() {
|
||||
}
|
||||
fmt.Println("Database connection established")
|
||||
|
||||
// 2.1 Run Database Migrations
|
||||
log.Println("Running database migrations...")
|
||||
m, err := migrate.New("file://migrations", dsn)
|
||||
if err != nil {
|
||||
log.Printf("Failed to initialize migrate, skipping: %v", err)
|
||||
} else {
|
||||
if err := m.Up(); err != nil && err != migrate.ErrNoChange {
|
||||
log.Printf("Failed to run migrate (maybe tables already exist), continuing: %v", err)
|
||||
} else {
|
||||
log.Println("Database migrations applied successfully")
|
||||
}
|
||||
}
|
||||
|
||||
// 3. Initialize Layers
|
||||
userRepo := repository.NewUserRepository(db)
|
||||
userSvc := service.NewUserService(userRepo)
|
||||
|
||||
Reference in New Issue
Block a user