-
Notifications
You must be signed in to change notification settings - Fork 804
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1fea9f7
commit bc37e81
Showing
10 changed files
with
557 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,17 @@ | ||
.wy-side-nav-search img { | ||
padding: 5px 60px !important; | ||
} | ||
|
||
#banner { | ||
text-align: center; | ||
background: #2980b9; | ||
border: 1px solid rgb(52, 49, 49); | ||
color: #F0F0F4; | ||
padding: 10px; | ||
margin-bottom: 1.618em; | ||
} | ||
|
||
#banner > div > a { | ||
color: #F0F0F4; | ||
text-decoration: underline; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{% extends "!breadcrumbs.html" %} | ||
|
||
{% block breadcrumbs %} | ||
{% if show_banner %} | ||
<header id="banner"> | ||
<div>✨ <strong>Big news:</strong> we're working full-time on sqlc. Read more <a href="https://sqlc.dev/posts/2023/07/06/working-on-sqlc-full-time">here</a>.</div> | ||
</header> | ||
{% endif %} | ||
{{ super() }} | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
{% extends "!layout.html" %} | ||
|
||
{% block extrahead %} | ||
<script defer data-domain="docs.sqlc.dev" src="https://plausible.io/js/plausible.js"></script> | ||
{{ super() }} | ||
{% endblock %} | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
# Suggested CI/CD setup | ||
|
||
If your project has more than a single developer, we suggest running `sqlc` as | ||
part of your CI/CD pipeline. The two commands you'll want to run are `diff` and `vet` | ||
|
||
`sqlc diff` ensures that code is up to date. New developers to a project may | ||
forget to run `sqlc generate`. They also might edit generated code. `diff` will | ||
catch both scenarios. | ||
|
||
```diff | ||
% sqlc-dev diff | ||
--- a/postgresql/query.sql.go | ||
+++ b/postgresql/query.sql.go | ||
@@ -55,7 +55,7 @@ | ||
|
||
const listAuthors = `-- name: ListAuthors :many | ||
SELECT id, name, bio FROM authors | ||
-ORDER BY name | ||
+ORDER BY bio | ||
` | ||
``` | ||
|
||
`sqlc vet` runs a set of lint checks against your SQL queries. These checks are | ||
helpful in catching anti-patterns before they make it into production. Please | ||
see the [vet](../reference/cli.html#vet) documentation for a complete guide on adding checks to your | ||
project. | ||
|
||
## General setup | ||
|
||
Install `sqlc` using the [suggested instructions](../overview/install). | ||
|
||
Create two steps in your pipelines, one for `sqlc diff`and one for `sqlc vet`. | ||
|
||
## GitHub Actions | ||
|
||
We provide the [setup-sqlc](https://github.com/marketplace/actions/setup-sqlc) | ||
GitHub Action to install `sqlc`. The action uses the built-in | ||
[tool-cache](https://github.com/actions/toolkit/blob/main/packages/tool-cache/README.md) | ||
to speed up the installation process. | ||
|
||
The following workflow runs `sqlc diff` on every push. | ||
|
||
```yaml | ||
name: sqlc | ||
on: [push] | ||
jobs: | ||
diff: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: sqlc-dev/setup-sqlc@v3 | ||
with: | ||
sqlc-version: '1.19.0' | ||
- run: sqlc diff | ||
``` | ||
We also encourage running [`sqlc vet`](../reference/cli.html#vet). To get the most value out of `vet`, | ||
you'll want to set up a running database. See the [vet] documentation for a | ||
complete guide on adding checks to your project. | ||
|
||
```yaml | ||
name: sqlc | ||
on: [push] | ||
jobs: | ||
vet: | ||
runs-on: ubuntu-latest | ||
services: | ||
postgres: | ||
image: "postgres:15" | ||
env: | ||
POSTGRES_DB: postgres | ||
POSTGRES_PASSWORD: postgres | ||
POSTGRES_USER: postgres | ||
ports: | ||
- 5432:5432 | ||
# needed because the postgres container does not provide a healthcheck | ||
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | ||
env: | ||
PG_PORT: ${{ job.services.postgres.ports['5432'] }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: sqlc-dev/setup-sqlc@v3 | ||
with: | ||
sqlc-version: '1.19.0' | ||
# Connect and migrate your database here. This is an example which runs | ||
# commands from a `schema.sql` file. | ||
- run: psql -h localhost -U postgres -p $PG_PORT -d postgres -f schema.sql | ||
env: | ||
PGPASSWORD: postgres | ||
- run: sqlc vet | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,6 +54,7 @@ code ever again. | |
howto/ddl.md | ||
howto/structs.md | ||
|
||
howto/ci-cd.md | ||
howto/upload.md | ||
|
||
.. toctree:: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.