1
0
mirror of https://github.com/mgerb/go-discord-bot synced 2026-01-11 17:42:48 +00:00

use permissions from database - updated bot-scripts

This commit is contained in:
2018-10-20 13:42:37 -05:00
parent 3f650e7c65
commit b004d4f29a
15 changed files with 126 additions and 57 deletions

View File

@@ -0,0 +1,25 @@
package main
import (
"fmt"
"github.com/mgerb/go-discord-bot/server/db"
)
// keep change script embedded in go files for ease of use
const changeScript = `
-- script to update all users default permission to a value of 1 (user)
UPDATE users SET permissions = 1 WHERE permissions IS NULL OR permissions = 0;
`
func updateDB() {
db.Init()
conn := db.GetConn()
err := conn.Exec(changeScript).Error
if err != nil {
fmt.Println(err)
}
}