Commit 6a513fd1 authored by Andrei Mihu's avatar Andrei Mihu
Browse files

Log better startup error message when database schema is not set up at all.

parent 10ca1c17
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@ The format is based on [keep a changelog](http://keepachangelog.com) and this pr
- Pagination support for user groups listing operations.
- Filtering by group state in user groups listing operations.
- Allow max count to be set when creating groups from client calls.
- Log better startup error message when database schema is not set up at all.

### Changed
- Use Go 1.12.7 on Alpine 3.10 as base Docker container image and native builds.
+4 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import (
	"os"
	"os/signal"
	"runtime"
	"strings"
	"syscall"
	"time"

@@ -218,6 +219,9 @@ func dbConnect(multiLogger *zap.Logger, config server.Config) (*sql.DB, string)
	// Limit the time allowed to ping database and get version to 15 seconds total.
	ctx, _ := context.WithTimeout(context.Background(), 15*time.Second)
	if err = db.PingContext(ctx); err != nil {
		if strings.HasSuffix(err.Error(), "does not exist (SQLSTATE 3D000)") {
			multiLogger.Fatal("Database schema not found, run `nakama migrate up`", zap.Error(err))
		}
		multiLogger.Fatal("Error pinging database", zap.Error(err))
	}