Skip to content

Commit b77ef1f

Browse files
committed
build: switch to coder/sqlc fork
Refs coder/sqlc#1 Unblocks #20501 Upstream sqlc-dev/sqlc#4159
1 parent 0d765f5 commit b77ef1f

File tree

6 files changed

+43
-8
lines changed

6 files changed

+43
-8
lines changed

.github/actions/setup-sqlc/action.yaml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ runs:
55
using: "composite"
66
steps:
77
- name: Setup sqlc
8-
uses: sqlc-dev/setup-sqlc@c0209b9199cd1cce6a14fc27cabcec491b651761 # v4.0.0
9-
with:
10-
sqlc-version: "1.27.0"
8+
# uses: sqlc-dev/setup-sqlc@c0209b9199cd1cce6a14fc27cabcec491b651761 # v4.0.0
9+
# with:
10+
# sqlc-version: "1.30.0"
11+
12+
# Switched to coder/sqlc fork to fix ambiguous column bug, see:
13+
# - https://github.com/coder/sqlc/pull/1
14+
# - https://github.com/sqlc-dev/sqlc/pull/4159
15+
shell: bash
16+
run: |
17+
CGO_ENABLED=1 go install github.com/coder/sqlc/cmd/sqlc@aab4e865a51df0c43e1839f81a9d349b41d14f05

coderd/database/models.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/querier.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/queries.sql.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dogfood/coder/Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,10 @@ RUN apt-get update && \
6262
# charts and values files
6363
go install github.com/norwoodj/helm-docs/cmd/helm-docs@v1.5.0 && \
6464
# sqlc for Go code generation
65-
(CGO_ENABLED=1 go install github.com/sqlc-dev/sqlc/cmd/sqlc@v1.27.0) && \
65+
# Switched to coder/sqlc fork to fix ambiguous column bug, see:
66+
# - https://github.com/coder/sqlc/pull/1
67+
# - https://github.com/sqlc-dev/sqlc/pull/4159
68+
(CGO_ENABLED=1 go install github.com/coder/sqlc/cmd/sqlc@aab4e865a51df0c43e1839f81a9d349b41d14f05) && \
6669
# gcr-cleaner-cli used by CI to prune unused images
6770
go install github.com/sethvargo/gcr-cleaner/cmd/gcr-cleaner-cli@v0.5.1 && \
6871
# ruleguard for checking custom rules, without needing to run all of

flake.nix

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,31 @@
8484
vendorHash = null;
8585
};
8686

87+
# Custom sqlc build from coder/sqlc fork to fix ambiguous column bug, see:
88+
# - https://github.com/coder/sqlc/pull/1
89+
# - https://github.com/sqlc-dev/sqlc/pull/4159
90+
#
91+
# To update hashes:
92+
# 1. Run: `nix --extra-experimental-features 'nix-command flakes' build .#devShells.x86_64-linux.default`
93+
# 2. Nix will fail with the correct sha256 hash for src
94+
# 3. Update the sha256 and run again
95+
# 4. Nix will fail with the correct vendorHash
96+
# 5. Update the vendorHash
97+
sqlc-custom = unstablePkgs.buildGo124Module {
98+
pname = "sqlc";
99+
version = "coder-fork-aab4e865a51df0c43e1839f81a9d349b41d14f05";
100+
101+
src = pkgs.fetchFromGitHub {
102+
owner = "coder";
103+
repo = "sqlc";
104+
rev = "aab4e865a51df0c43e1839f81a9d349b41d14f05";
105+
sha256 = "sha256-TWrP9VlmbNiLD8p+SOHLxoZ44y8mrIoD7tfM/2Asy10=";
106+
};
107+
108+
subPackages = [ "cmd/sqlc" ];
109+
vendorHash = "sha256-69kg3qkvEWyCAzjaCSr3a73MNonub9sZTYyGaCW+UTI=";
110+
};
111+
87112
# Packages required to build the frontend
88113
frontendPackages =
89114
with pkgs;
@@ -163,7 +188,7 @@
163188
ripgrep
164189
shellcheck
165190
(pinnedPkgs.shfmt)
166-
sqlc
191+
sqlc-custom
167192
syft
168193
unstablePkgs.terraform
169194
typos

0 commit comments

Comments
 (0)