mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2024-10-31 22:40:01 +00:00
[bugfix] use Exec to rename media_attachments (#498)
The `database/sql` package in the Go stdlib has two methods that can run queries against the database driver: `Query` and `Exec`. When the query returns rows, such as "SELECT", the package expects the use of `Query`, and returns `*sql.Rows`. When the query does not return rows, the package expects the use of `Exec`, which returns `sql.Result`. This changeset corrects the "media_attachments" migration to using `ExecContext`, as "ALTER TABLE" does not return rows. Signed-off-by: Terin Stock <terinjokes@gmail.com>
This commit is contained in:
parent
9cf66bf298
commit
8e80f983b3
1 changed files with 1 additions and 1 deletions
|
@ -142,7 +142,7 @@ func init() {
|
|||
}
|
||||
|
||||
// rename the new table to the same name as the old table was
|
||||
if _, err := tx.QueryContext(ctx, "ALTER TABLE new_media_attachments RENAME TO media_attachments;"); err != nil {
|
||||
if _, err := tx.ExecContext(ctx, "ALTER TABLE new_media_attachments RENAME TO media_attachments;"); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue