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:
25
server/scripts/update-db.go
Normal file
25
server/scripts/update-db.go
Normal 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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user