2022-09-10 11:39:07 +00:00
|
|
|
package v2migrator
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/pkg/errors"
|
|
|
|
|
2022-11-02 21:38:14 +00:00
|
|
|
"github.com/Luzifer/twitch-bot/v3/internal/actors/quotedb"
|
|
|
|
"github.com/Luzifer/twitch-bot/v3/pkg/database"
|
2022-09-10 11:39:07 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
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 {
|
2022-10-22 22:08:02 +00:00
|
|
|
if err := quotedb.SetQuotes(db, channel, quotes); err != nil {
|
|
|
|
return errors.Wrap(err, "setting quotes for channel")
|
2022-09-10 11:39:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|