Fix build and run issues
All checks were successful
CI / Go tests & lint (push) Successful in 8s
CI / Frontend tests & type-check (push) Successful in 40s
CI / Go tests & lint (pull_request) Successful in 7s
CI / Frontend tests & type-check (pull_request) Successful in 35s

This commit is contained in:
2026-04-08 14:58:58 -03:00
parent 9905234b34
commit e82a39f2e4
7 changed files with 34 additions and 29 deletions

View File

@@ -3,9 +3,10 @@ package db
import (
"context"
"database/sql"
"errors"
"fmt"
_ "github.com/go-sql-driver/mysql"
"github.com/go-sql-driver/mysql"
)
func Open(dsn string) (*sql.DB, error) {
@@ -22,6 +23,10 @@ func Open(dsn string) (*sql.DB, error) {
func Migrate(ctx context.Context, db *sql.DB) error {
for _, stmt := range statements {
if _, err := db.ExecContext(ctx, stmt); err != nil {
var mysqlErr *mysql.MySQLError
if errors.As(err, &mysqlErr) && mysqlErr.Number == 1060 {
continue // duplicate column — already exists
}
return fmt.Errorf("migrate: %w", err)
}
}