mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-01 06:36:38 +08:00
530a9dd3ee
BREAKING: pkg/migrator/ deleted entirely. Migration SQL files are now owned by each plugin in its own migrations/ directory. Architecture: - Delete pkg/migrator/ (26 global SQL files + ClickHouse migration) - Move global SQL to per-plugin migrations/ with go:embed + Register() - Rewrite cmd/app.go gooseEngine: uses Inject[DBService] for DB, iterates all plugin-registered MigrationEntry, runs goose.Up per entry - core.MigrationEngine.Migrate signature changed: *Context instead of context.Context, so engine can resolve services via IoC Per-plugin migration ownership: auth/ → w_access_tokens, w_auth_sources, w_external_accounts user/ → w_users (seed system user) admin/ → w_system_configs, w_templates (seeds) upload/ → w_uploads, w_upload_stats message_gateway/ → w_push_*, w_message_* risk_control/ → w_user_access_logs (PG + ClickHouse) driver_asynq_cron/ → w_schedules driver_asynq_worker/ → w_task_executions Dependencies: - cmd/banner.go: removed migration report display (migrations are automatic) - cmd/reset_passwd.go: removed PreRun migrator.Migrate() call - go.mod: clickhouse-go kept (used by plugins/infra/database/clickhouse.go)
47 lines
1.1 KiB
Go
47 lines
1.1 KiB
Go
// Copyright 2026 Arctel.net
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package cmd
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
|
|
"github.com/Rain-kl/Wavelet/pkg/buildinfo"
|
|
"github.com/Rain-kl/Wavelet/pkg/config"
|
|
)
|
|
|
|
func TestFormatStartupBanner(t *testing.T) {
|
|
previousVersion := buildinfo.Version
|
|
previousBuildTime := buildinfo.BuildTime
|
|
previousEnv := config.Config.App.Env
|
|
previousAddr := config.Config.App.Addr
|
|
t.Cleanup(func() {
|
|
buildinfo.Version = previousVersion
|
|
buildinfo.BuildTime = previousBuildTime
|
|
config.Config.App.Env = previousEnv
|
|
config.Config.App.Addr = previousAddr
|
|
})
|
|
|
|
buildinfo.Version = "v3.2.1"
|
|
buildinfo.BuildTime = "2026-07-13T08:00:00Z"
|
|
config.Config.App.Env = "production"
|
|
config.Config.App.Addr = ":3000"
|
|
|
|
banner := formatStartupBanner(startupState{
|
|
mode: "API",
|
|
listensForHTTP: true,
|
|
})
|
|
|
|
for _, want := range []string{
|
|
"Wavelet v3.2.1",
|
|
"Environment: production",
|
|
"Build time: 2026-07-13T08:00:00Z",
|
|
"Listening: http://:3000",
|
|
"Mode: API",
|
|
} {
|
|
if !strings.Contains(banner, want) {
|
|
t.Errorf("banner missing %q:\n%s", want, banner)
|
|
}
|
|
}
|
|
} |