Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use Exec to rename media_attachments #498

Merged
merged 1 commit into from
Apr 28, 2022

Conversation

terinjokes
Copy link
Contributor

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.

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>
@NyaaaWhatsUpDoc NyaaaWhatsUpDoc merged commit 8e80f98 into superseriousbusiness:main Apr 28, 2022
@terinjokes terinjokes deleted the sql-exec branch April 28, 2022 08:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants