mirror of https://github.com/usememos/memos.git
fix(test): satisfy golangci-lint in migration coverage
This commit is contained in:
parent
5443e9386a
commit
34c9f0c813
|
|
@ -23,7 +23,6 @@ import (
|
|||
"github.com/testcontainers/testcontainers-go/wait"
|
||||
|
||||
// Database drivers for connection verification.
|
||||
_ "github.com/go-sql-driver/mysql"
|
||||
_ "github.com/lib/pq"
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
storepb "github.com/usememos/memos/proto/gen/store"
|
||||
|
|
@ -189,10 +190,10 @@ func legacyInsertUserSQL(driver string, id int, username string) string {
|
|||
switch driver {
|
||||
case "mysql":
|
||||
table = "`user`"
|
||||
case "postgres":
|
||||
table = `"user"`
|
||||
case "sqlite":
|
||||
case "postgres", "sqlite":
|
||||
table = `"user"`
|
||||
default:
|
||||
// Keep the unquoted fallback for unknown test drivers.
|
||||
}
|
||||
|
||||
return fmt.Sprintf(
|
||||
|
|
@ -262,6 +263,6 @@ func tableExists(ctx context.Context, db *sql.DB, driver, table string) (bool, e
|
|||
err := db.QueryRowContext(ctx, "SELECT to_regclass($1)", "public."+table).Scan(®class)
|
||||
return regclass.Valid && strings.EqualFold(regclass.String, table), err
|
||||
default:
|
||||
return false, fmt.Errorf("unsupported driver: %s", driver)
|
||||
return false, errors.Errorf("unsupported driver: %s", driver)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue