Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

chore: validate queries using sqlc-vet in github actions#11163

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Emyrk merged 6 commits intomainfromstevenmasley/sqlc-vet
Dec 12, 2023

Conversation

Emyrk
Copy link
Member

@EmyrkEmyrk commentedDec 12, 2023
edited
Loading

What this does

This runssqlc vet using our queries and schema for a given commit. The only sql lint rule we currently have is that a query can be prepared against our schema.

This protects us from writing a migration that breaks an existing query, or writing a new query that will not execute.

We unit testalmost all of our queries, so this failure will likely be caught intest-go-pg. However, the reported failure will correspond to some number of Go tests, and the output might not be straight forward.sqlc vet will have clearer reporting and easier debugging.

Example

Found a query that does not work: (https://github.com/coder/coder/actions/runs/7186260845/job/19574288356)

--- sqlc vet# package queries/tailnet.sql:101:8: column "tailnet_clients.id" must appear in the GROUP BY clause or be used in an aggregate function

@EmyrkEmyrk changed the titlechore: add sqlc-vet to github actions for validating querieschore: validate queries using sqlc-vet in github actionsDec 12, 2023
@EmyrkEmyrk changed the base branch frommain tostevenmasley/invalid_tailnet_queryDecember 12, 2023 20:55
@EmyrkGraphite App
Copy link
MemberAuthor

Base automatically changed fromstevenmasley/invalid_tailnet_query tomainDecember 12, 2023 21:02
@EmyrkEmyrk marked this pull request as ready for reviewDecember 12, 2023 21:12
@EmyrkEmyrk requested a review fromcoadlerDecember 12, 2023 21:21
@EmyrkEmyrk merged commite52d848 intomainDec 12, 2023
@EmyrkEmyrk deleted the stevenmasley/sqlc-vet branchDecember 12, 2023 21:53
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsDec 12, 2023
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.

Reviewers

1 more reviewer

@coadlercoadlercoadler approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

@EmyrkEmyrk

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@Emyrk@coadler

[8]ページ先頭

©2009-2025 Movatter.jp