mattermost-community/focalboard · critical

database type is unsupported

Error message

database type is unsupported

What it means

ErrUnsupportedDatabaseType is the SQLStore migration helper's sentinel for a database engine the code does not recognize. Column-add/drop, index-create, table-rename, column-rename, and table-existence generators (genAddColumnIfNeeded, genDropColumnIfNeeded, genCreateIndexIfNeeded, genRenameTableIfNeeded, genRenameColumnIfNeeded, doesTableExist) return it when s.dbType is neither MySQL nor PostgreSQL (nor the supported set). It stops migrations from emitting dialect-specific SQL against an unknown engine.

Source

Thrown at server/services/store/sqlstore/templates.go:14

package sqlstore

import (
	"errors"
	"fmt"

	sq "github.com/Masterminds/squirrel"
	"github.com/mattermost/focalboard/server/model"

	"github.com/mattermost/mattermost/server/public/shared/mlog"
)

var (
	ErrUnsupportedDatabaseType = errors.New("database type is unsupported")
)

// removeDefaultTemplates deletes all the default templates and their children.
func (s *SQLStore) removeDefaultTemplates(db sq.BaseRunner, boards []*model.Board) error {
	count := 0
	for _, board := range boards {
		if board.CreatedBy != model.SystemUserID {
			continue
		}
		// default template deletion does not need to go to blocks_history
		deleteQuery := s.getQueryBuilder(db).
			Delete(s.tablePrefix + "boards").
			Where(sq.Eq{"id": board.ID}).
			Where(sq.Eq{"is_template": true})

		if _, err := deleteQuery.Exec(); err != nil {
			return fmt.Errorf("cannot delete default template %s: %w", board.ID, err)
		}

View on GitHub (pinned to a84bbb65e3)

Solutions

  1. Set the database config to a supported driver: 'mysql' or 'postgres'.
  2. Check your config file's database settings (driver, datasource) for typos or unsupported values.
  3. Verify you are running a build/flavor of Focalboard that supports your configured database type.
  4. If embedding the store, set dbType via model.MysqlDBType/model.PostgresDBType constants instead of free-form strings.

Example fix

// before
databaseCfg := config.SqlSettings.DriverName // "sqlite3" -> unsupported
// after
databaseCfg = model.MysqlDBType // or model.PostgresDBType
Defensive patterns

Strategy: validation

Validate before calling

supported := map[string]bool{model.MysqlDBType: true, model.PostgresDBType: true}
if !supported[dbType] {
    return fmt.Errorf("database type %q is not supported; use mysql or postgres", dbType)
}

Type guard

func isSupportedDB(dbType string) bool {
    return dbType == model.MysqlDBType || dbType == model.PostgresDBType
}

Try / catch

err := store.RunMigrations()
if errors.Is(err, sqlstore.ErrUnsupportedDatabaseType) {
    log.Fatal("unsupported database type; configure mysql or postgres")
}

Prevention

When it happens

Trigger: Running schema migrations when the configured database driver string maps to an unsupported dbType, e.g. SQLite builds, a mistyped database config, or a new engine not covered by the switch statements in the migration generators.

Common situations: Misconfigured database config (wrong driver name), attempting to run Focalboard against SQLite/other engines in deployments that only support MySQL/Postgres, or version mismatches where a new dbType constant is unknown to older migration code.

Related errors


AI-assisted analysis of mattermost-community/focalboard@a84bbb65e3 (2026-08-30). Data as JSON: /api/errors/b00f25674f42910c. Report an issue: GitHub.