gosora/patcher/utils.go
Azareal cdb2f0711d Attachments continue to function after the parent topic is moved now.
Changed the signature of AttachmentStore.Add
Added the MoveTo method to AttachmentStore.
Added the MoveToByExtra method to AttachmentStore.
Don't forget to actually add the pre script for topic_c_edit_post x.x

Added the extra column to the attachments table.

You will need to run the updater / patcher for this commit.
2019-04-13 21:54:22 +10:00

45 lines
779 B
Go

package main
import "database/sql"
import "github.com/Azareal/Gosora/query_gen"
func execStmt(stmt *sql.Stmt, err error) error {
if err != nil {
return err
}
_, err = stmt.Exec()
return err
}
/*func eachUserQuick(handle func(int)) error {
stmt, err := qgen.Builder.Select("users").Orderby("uid desc").Limit(1).Prepare()
if err != nil {
return err
}
var topID int
err := stmt.QueryRow(topID)
if err != nil {
return err
}
for i := 1; i <= topID; i++ {
err = handle(i)
if err != nil {
return err
}
}
}*/
func eachUser(handle func(int) error) error {
err := qgen.NewAcc().Select("users").Cols("uid").Each(func(rows *sql.Rows) error {
var uid int
err := rows.Scan(&uid)
if err != nil {
return err
}
return handle(uid)
})
return err
}