mirror of
https://github.com/Luzifer/twitch-bot.git
synced 2024-11-09 08:40:01 +00:00
[raffle] Insert newly created raffles with NULL
reminder time
as MySQL 8 in opposite to MariaDB 10 does not support the time `0000-00-00 00:00:00` fixes #51 Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
29df9e59b5
commit
db3c4f4efa
1 changed files with 2 additions and 2 deletions
|
@ -56,7 +56,7 @@ type (
|
||||||
TextEntryFailPost bool `json:"textEntryFailPost"`
|
TextEntryFailPost bool `json:"textEntryFailPost"`
|
||||||
TextReminder string `json:"textReminder"`
|
TextReminder string `json:"textReminder"`
|
||||||
TextReminderInterval time.Duration `json:"textReminderInterval"`
|
TextReminderInterval time.Duration `json:"textReminderInterval"`
|
||||||
TextReminderNextSend time.Time `json:"-"`
|
TextReminderNextSend *time.Time `json:"-"`
|
||||||
TextReminderPost bool `json:"textReminderPost"`
|
TextReminderPost bool `json:"textReminderPost"`
|
||||||
TextWin string `json:"textWin"`
|
TextWin string `json:"textWin"`
|
||||||
TextWinPost bool `json:"textWinPost"`
|
TextWinPost bool `json:"textWinPost"`
|
||||||
|
@ -143,7 +143,7 @@ func (d *dbClient) AutoSendReminders() (err error) {
|
||||||
var rr []raffle
|
var rr []raffle
|
||||||
|
|
||||||
if err = d.db.DB().
|
if err = d.db.DB().
|
||||||
Where("status = ? AND text_reminder_post = ? AND text_reminder_next_send < ?", raffleStatusActive, true, time.Now().UTC()).
|
Where("status = ? AND text_reminder_post = ? AND (text_reminder_next_send IS NULL OR text_reminder_next_send < ?)", raffleStatusActive, true, time.Now().UTC()).
|
||||||
Find(&rr).
|
Find(&rr).
|
||||||
Error; err != nil {
|
Error; err != nil {
|
||||||
return errors.Wrap(err, "fetching raffles to send reminders")
|
return errors.Wrap(err, "fetching raffles to send reminders")
|
||||||
|
|
Loading…
Reference in a new issue