mirror of
https://github.com/Luzifer/twitch-bot.git
synced 2024-11-08 16:20:02 +00:00
24 lines
526 B
Go
24 lines
526 B
Go
package v2migrator
|
|
|
|
import (
|
|
"github.com/pkg/errors"
|
|
|
|
"github.com/Luzifer/twitch-bot/internal/actors/quotedb"
|
|
"github.com/Luzifer/twitch-bot/pkg/database"
|
|
)
|
|
|
|
type (
|
|
storageModQuoteDB struct {
|
|
ChannelQuotes map[string][]string `json:"channel_quotes"`
|
|
}
|
|
)
|
|
|
|
func (s storageModQuoteDB) migrate(db database.Connector) (err error) {
|
|
for channel, quotes := range s.ChannelQuotes {
|
|
if err := quotedb.SetQuotes(db, channel, quotes); err != nil {
|
|
return errors.Wrap(err, "setting quotes for channel")
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|