{"record":{"id":"b00f25674f42910c","repo":"mattermost-community/focalboard","slug":"database-type-is-unsupported","errorCode":null,"errorMessage":"database type is unsupported","messagePattern":"database type is unsupported","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"server/services/store/sqlstore/templates.go","lineNumber":14,"sourceCode":"package sqlstore\n\nimport (\n\t\"errors\"\n\t\"fmt\"\n\n\tsq \"github.com/Masterminds/squirrel\"\n\t\"github.com/mattermost/focalboard/server/model\"\n\n\t\"github.com/mattermost/mattermost/server/public/shared/mlog\"\n)\n\nvar (\n\tErrUnsupportedDatabaseType = errors.New(\"database type is unsupported\")\n)\n\n// removeDefaultTemplates deletes all the default templates and their children.\nfunc (s *SQLStore) removeDefaultTemplates(db sq.BaseRunner, boards []*model.Board) error {\n\tcount := 0\n\tfor _, board := range boards {\n\t\tif board.CreatedBy != model.SystemUserID {\n\t\t\tcontinue\n\t\t}\n\t\t// default template deletion does not need to go to blocks_history\n\t\tdeleteQuery := s.getQueryBuilder(db).\n\t\t\tDelete(s.tablePrefix + \"boards\").\n\t\t\tWhere(sq.Eq{\"id\": board.ID}).\n\t\t\tWhere(sq.Eq{\"is_template\": true})\n\n\t\tif _, err := deleteQuery.Exec(); err != nil {\n\t\t\treturn fmt.Errorf(\"cannot delete default template %s: %w\", board.ID, err)\n\t\t}","sourceCodeStart":1,"sourceCodeEnd":32,"githubUrl":"https://github.com/mattermost-community/focalboard/blob/a84bbb65e32edf972856b329417096ac413518e9/server/services/store/sqlstore/templates.go#L1-L32","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Set the database config to a supported driver: 'mysql' or 'postgres'.","Check your config file's database settings (driver, datasource) for typos or unsupported values.","Verify you are running a build/flavor of Focalboard that supports your configured database type.","If embedding the store, set dbType via model.MysqlDBType/model.PostgresDBType constants instead of free-form strings."],"exampleFix":"// before\ndatabaseCfg := config.SqlSettings.DriverName // \"sqlite3\" -> unsupported\n// after\ndatabaseCfg = model.MysqlDBType // or model.PostgresDBType","handlingStrategy":"validation","validationCode":"supported := map[string]bool{model.MysqlDBType: true, model.PostgresDBType: true}\nif !supported[dbType] {\n    return fmt.Errorf(\"database type %q is not supported; use mysql or postgres\", dbType)\n}","typeGuard":"func isSupportedDB(dbType string) bool {\n    return dbType == model.MysqlDBType || dbType == model.PostgresDBType\n}","tryCatchPattern":"err := store.RunMigrations()\nif errors.Is(err, sqlstore.ErrUnsupportedDatabaseType) {\n    log.Fatal(\"unsupported database type; configure mysql or postgres\")\n}","preventionTips":["Configure only supported drivers (mysql/postgres) in the database settings.","Validate the database config at startup, before migrations.","Use model.DBType constants rather than raw strings when embedding the store.","Don't point deployments at SQLite or experimental engines."],"tags":["go","database","migrations","configuration"],"backgroundTag":"unsupported-database-type","analyzedSha":"a84bbb65e32edf972856b329417096ac413518e9","analyzedAt":"2026-08-30T09:22:20.720Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}