diff --git a/.github/actions/setup-sqlc/action.yaml b/.github/actions/setup-sqlc/action.yaml index c123cb8cc3..8e1cf8c50f 100644 --- a/.github/actions/setup-sqlc/action.yaml +++ b/.github/actions/setup-sqlc/action.yaml @@ -5,6 +5,13 @@ runs: using: "composite" steps: - name: Setup sqlc - uses: sqlc-dev/setup-sqlc@c0209b9199cd1cce6a14fc27cabcec491b651761 # v4.0.0 - with: - sqlc-version: "1.27.0" + # uses: sqlc-dev/setup-sqlc@c0209b9199cd1cce6a14fc27cabcec491b651761 # v4.0.0 + # with: + # sqlc-version: "1.30.0" + + # Switched to coder/sqlc fork to fix ambiguous column bug, see: + # - https://github.com/coder/sqlc/pull/1 + # - https://github.com/sqlc-dev/sqlc/pull/4159 + shell: bash + run: | + CGO_ENABLED=1 go install github.com/coder/sqlc/cmd/sqlc@aab4e865a51df0c43e1839f81a9d349b41d14f05 diff --git a/coderd/database/models.go b/coderd/database/models.go index ade3348ba3..0c132a33d0 100644 --- a/coderd/database/models.go +++ b/coderd/database/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.27.0 +// sqlc v1.30.0 package database diff --git a/coderd/database/querier.go b/coderd/database/querier.go index b1a4509398..2739cb7430 100644 --- a/coderd/database/querier.go +++ b/coderd/database/querier.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.27.0 +// sqlc v1.30.0 package database diff --git a/coderd/database/queries.sql.go b/coderd/database/queries.sql.go index ff32a11267..eafe73279b 100644 --- a/coderd/database/queries.sql.go +++ b/coderd/database/queries.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.27.0 +// sqlc v1.30.0 package database diff --git a/dogfood/coder/Dockerfile b/dogfood/coder/Dockerfile index a8fe252554..df668f7c8f 100644 --- a/dogfood/coder/Dockerfile +++ b/dogfood/coder/Dockerfile @@ -62,7 +62,12 @@ RUN apt-get update && \ # charts and values files go install github.com/norwoodj/helm-docs/cmd/helm-docs@v1.5.0 && \ # sqlc for Go code generation - (CGO_ENABLED=1 go install github.com/sqlc-dev/sqlc/cmd/sqlc@v1.27.0) && \ + # (CGO_ENABLED=1 go install github.com/sqlc-dev/sqlc/cmd/sqlc@v1.27.0) && \ + # + # Switched to coder/sqlc fork to fix ambiguous column bug, see: + # - https://github.com/coder/sqlc/pull/1 + # - https://github.com/sqlc-dev/sqlc/pull/4159 + (CGO_ENABLED=1 go install github.com/coder/sqlc/cmd/sqlc@aab4e865a51df0c43e1839f81a9d349b41d14f05) && \ # gcr-cleaner-cli used by CI to prune unused images go install github.com/sethvargo/gcr-cleaner/cmd/gcr-cleaner-cli@v0.5.1 && \ # ruleguard for checking custom rules, without needing to run all of diff --git a/flake.nix b/flake.nix index c76c5bbba6..38eb53b68f 100644 --- a/flake.nix +++ b/flake.nix @@ -84,6 +84,31 @@ vendorHash = null; }; + # Custom sqlc build from coder/sqlc fork to fix ambiguous column bug, see: + # - https://github.com/coder/sqlc/pull/1 + # - https://github.com/sqlc-dev/sqlc/pull/4159 + # + # To update hashes: + # 1. Run: `nix --extra-experimental-features 'nix-command flakes' build .#devShells.x86_64-linux.default` + # 2. Nix will fail with the correct sha256 hash for src + # 3. Update the sha256 and run again + # 4. Nix will fail with the correct vendorHash + # 5. Update the vendorHash + sqlc-custom = unstablePkgs.buildGo124Module { + pname = "sqlc"; + version = "coder-fork-aab4e865a51df0c43e1839f81a9d349b41d14f05"; + + src = pkgs.fetchFromGitHub { + owner = "coder"; + repo = "sqlc"; + rev = "aab4e865a51df0c43e1839f81a9d349b41d14f05"; + sha256 = "sha256-zXjTypEFWDOkoZMKHMMRtAz2coNHSCkQ+nuZ8rOnzZ8="; + }; + + subPackages = [ "cmd/sqlc" ]; + vendorHash = "sha256-69kg3qkvEWyCAzjaCSr3a73MNonub9sZTYyGaCW+UTI="; + }; + # Packages required to build the frontend frontendPackages = with pkgs; @@ -163,7 +188,8 @@ ripgrep shellcheck (pinnedPkgs.shfmt) - sqlc + # sqlc + sqlc-custom syft unstablePkgs.terraform typos