mirror of
https://github.com/owncast/owncast.git
synced 2025-11-01 19:32:20 +08:00
Messages table fixes to improve query performance (#2026)
* Move to yaml sqlc config * Add util for ungraceful sql execs * Fix messages schema + add indexes * Add migration to drop+recreate messages table * Create index only if does not exist * Fix typo * Unexport function
This commit is contained in:
20
core/data/utils.go
Normal file
20
core/data/utils.go
Normal file
@ -0,0 +1,20 @@
|
||||
package data
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
// mustExec will execute a SQL statement on a provided database instance.
|
||||
func mustExec(s string, db *sql.DB) {
|
||||
stmt, err := db.Prepare(s)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
defer stmt.Close()
|
||||
_, err = stmt.Exec()
|
||||
if err != nil {
|
||||
log.Warnln(err)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user