1
0
mirror of https://github.com/mattermost/focalboard.git synced 2024-12-12 09:04:14 +02:00
focalboard/server/services/store/sqlstore/params.go
Miguel de la Cruz e7c38c8822
Adds data migrations and the unique IDs migration (#1776)
* Adds data migrations and the unique IDs migration

* Adds GetSystemSetting tests

* Add log statements to data migrations

* Move migrations to the store and ensure they follow an order mixing database and data migrations

* Fix system settings

* Add tests for unique id migration

* Small comment change

* Make a couple of methods private and wrap the migration in a transaction

* Update public methods

* Add database mutex to data migrations

* Create server params and pass a mutex factory to the store

* Fix plugin linter

* Make isPlugin private

* Fix comment typo

Co-authored-by: Doug Lauder <wiggin77@warpmail.net>

Co-authored-by: Doug Lauder <wiggin77@warpmail.net>
2021-11-11 17:01:43 +01:00

35 lines
668 B
Go

package sqlstore
import (
"database/sql"
"fmt"
"github.com/mattermost/mattermost-server/v6/shared/mlog"
)
type Params struct {
DBType string
ConnectionString string
TablePrefix string
Logger *mlog.Logger
DB *sql.DB
IsPlugin bool
NewMutexFn MutexFactory
}
func (p Params) CheckValid() error {
if p.IsPlugin && p.NewMutexFn == nil {
return ErrStoreParam{name: "NewMutexFn", issue: "cannot be nil in plugin mode"}
}
return nil
}
type ErrStoreParam struct {
name string
issue string
}
func (e ErrStoreParam) Error() string {
return fmt.Sprintf("invalid store params: %s %s", e.name, e.issue)
}