Skip to content

Commit 184491c

Browse files
authored
Merge branch 'sqlc-dev:main' into main
2 parents aaa8cbb + e476db9 commit 184491c

File tree

196 files changed

+6495
-567
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

196 files changed

+6495
-567
lines changed

.github/workflows/buf.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ jobs:
44
build:
55
runs-on: ubuntu-latest
66
steps:
7-
- uses: actions/checkout@v5
7+
- uses: actions/checkout@v6
88
- uses: bufbuild/buf-setup-action@v1
99
- uses: bufbuild/buf-lint-action@v1

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
name: build ${{ matrix.os }}
1010
runs-on: ${{ matrix.os }}
1111
steps:
12-
- uses: actions/checkout@v5
12+
- uses: actions/checkout@v6
1313
- uses: actions/setup-go@v6
1414
with:
1515
go-version: '1.25.0'

.github/workflows/ci-kotlin.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ jobs:
1010
name: test
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v5
13+
- uses: actions/checkout@v6
1414
- uses: actions/setup-go@v6
1515
with:
1616
go-version: '1.24.1'
1717
- name: install ./...
1818
run: go install ./...
19-
- uses: actions/checkout@v5
19+
- uses: actions/checkout@v6
2020
with:
2121
repository: sqlc-dev/sqlc-gen-kotlin
2222
path: kotlin

.github/workflows/ci-python.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ jobs:
1010
name: test
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v5
13+
- uses: actions/checkout@v6
1414
- uses: actions/setup-go@v6
1515
with:
1616
go-version: '1.24.1'
1717
- name: install ./...
1818
run: go install ./...
19-
- uses: actions/checkout@v5
19+
- uses: actions/checkout@v6
2020
with:
2121
repository: sqlc-dev/sqlc-gen-python
2222
path: python

.github/workflows/ci-typescript.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ jobs:
1010
name: test
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v5
13+
- uses: actions/checkout@v6
1414
- uses: actions/setup-go@v6
1515
with:
1616
go-version: '1.24.1'
1717
- name: install ./...
1818
run: go install ./...
19-
- uses: actions/checkout@v5
19+
- uses: actions/checkout@v6
2020
with:
2121
repository: sqlc-dev/sqlc-gen-typescript
2222
path: typescript

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
name: build ${{ matrix.goos }}/${{ matrix.goarch }}
1414
runs-on: ubuntu-24.04
1515
steps:
16-
- uses: actions/checkout@v5
16+
- uses: actions/checkout@v6
1717
- uses: actions/setup-go@v6
1818
with:
1919
go-version: '1.25.0'
@@ -25,7 +25,7 @@ jobs:
2525
test:
2626
runs-on: ubuntu-24.04
2727
steps:
28-
- uses: actions/checkout@v5
28+
- uses: actions/checkout@v6
2929
- uses: actions/setup-go@v6
3030
with:
3131
go-version: '1.25.0'

.github/workflows/gen.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
# needed because the postgres container does not provide a healthcheck
1818
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
1919
steps:
20-
- uses: actions/checkout@v5
20+
- uses: actions/checkout@v6
2121
- uses: actions/setup-go@v6
2222
with:
2323
go-version-file: go.mod
@@ -32,7 +32,7 @@ jobs:
3232
PG_PASSWORD: postgres
3333
PG_PORT: ${{ job.services.postgres.ports['5432'] }}
3434
- name: Save results
35-
uses: actions/upload-artifact@v4
35+
uses: actions/upload-artifact@v6
3636
with:
3737
name: sqlc-pg-gen-results
3838
path: gen

CLAUDE.md

Lines changed: 100 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,108 @@ This document provides essential information for working with the sqlc codebase,
77
### Prerequisites
88

99
- **Go 1.25.0+** - Required for building and testing
10-
- **Docker & Docker Compose** - Required for integration tests with databases
10+
- **Docker & Docker Compose** - Required for integration tests with databases (local development)
1111
- **Git** - For version control
1212

13+
## Claude Code Remote Environment Setup
14+
15+
When running in the Claude Code remote environment (or any environment without Docker), you can install PostgreSQL and MySQL natively. The test framework automatically detects and uses native database installations.
16+
17+
### Step 1: Configure apt Proxy (Required in Remote Environment)
18+
19+
The Claude Code remote environment requires an HTTP proxy for apt. Configure it:
20+
21+
```bash
22+
bash -c 'echo "Acquire::http::Proxy \"$http_proxy\";"' | sudo tee /etc/apt/apt.conf.d/99proxy
23+
```
24+
25+
### Step 2: Install PostgreSQL
26+
27+
```bash
28+
sudo apt-get update
29+
sudo apt-get install -y postgresql
30+
sudo service postgresql start
31+
```
32+
33+
Configure PostgreSQL for password authentication:
34+
35+
```bash
36+
# Set password for postgres user
37+
sudo -u postgres psql -c "ALTER USER postgres PASSWORD 'postgres';"
38+
39+
# Enable password authentication for localhost
40+
echo 'host all all 127.0.0.1/32 md5' | sudo tee -a /etc/postgresql/16/main/pg_hba.conf
41+
sudo service postgresql reload
42+
```
43+
44+
Test the connection:
45+
46+
```bash
47+
PGPASSWORD=postgres psql -h 127.0.0.1 -U postgres -c "SELECT 1;"
48+
```
49+
50+
### Step 3: Install MySQL 9
51+
52+
MySQL 9 is required for full test compatibility (includes VECTOR type support). Download and install from Oracle:
53+
54+
```bash
55+
# Download MySQL 9 bundle
56+
curl -LO https://dev.mysql.com/get/Downloads/MySQL-9.1/mysql-server_9.1.0-1ubuntu24.04_amd64.deb-bundle.tar
57+
58+
# Extract packages
59+
mkdir -p /tmp/mysql9
60+
tar -xf mysql-server_9.1.0-1ubuntu24.04_amd64.deb-bundle.tar -C /tmp/mysql9
61+
62+
# Install packages (in order)
63+
cd /tmp/mysql9
64+
sudo dpkg -i mysql-common_*.deb \
65+
mysql-community-client-plugins_*.deb \
66+
mysql-community-client-core_*.deb \
67+
mysql-community-client_*.deb \
68+
mysql-client_*.deb \
69+
mysql-community-server-core_*.deb \
70+
mysql-community-server_*.deb \
71+
mysql-server_*.deb
72+
73+
# Make init script executable
74+
sudo chmod +x /etc/init.d/mysql
75+
76+
# Initialize data directory and start MySQL
77+
sudo mysqld --initialize-insecure --user=mysql
78+
sudo /etc/init.d/mysql start
79+
80+
# Set root password
81+
mysql -u root -e "ALTER USER 'root'@'localhost' IDENTIFIED BY 'mysecretpassword'; FLUSH PRIVILEGES;"
82+
```
83+
84+
Test the connection:
85+
86+
```bash
87+
mysql -h 127.0.0.1 -u root -pmysecretpassword -e "SELECT VERSION();"
88+
```
89+
90+
### Step 4: Run End-to-End Tests
91+
92+
With both databases running, the test framework automatically detects them:
93+
94+
```bash
95+
# Run all end-to-end tests
96+
go test --tags=examples -timeout 20m ./internal/endtoend/...
97+
98+
# Run example tests
99+
go test --tags=examples -timeout 20m ./examples/...
100+
101+
# Run the full test suite
102+
go test --tags=examples -timeout 20m ./...
103+
```
104+
105+
The native database support (in `internal/sqltest/native/`) automatically:
106+
- Detects running PostgreSQL and MySQL instances
107+
- Starts services if installed but not running
108+
- Uses standard connection URIs:
109+
- PostgreSQL: `postgres://postgres:postgres@127.0.0.1:5432/postgres?sslmode=disable`
110+
- MySQL: `root:mysecretpassword@tcp(127.0.0.1:3306)/mysql`
111+
13112
### Running Tests
14113

15114
#### Basic Unit Tests (No Database Required)

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# STEP 1: Build sqlc
2-
FROM golang:1.25.3 AS builder
2+
FROM golang:1.25.5 AS builder
33

44
COPY . /workspace
55
WORKDIR /workspace

docs/reference/environment-variables.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
11
# Environment variables
22

3+
## SQLCEXPERIMENT
4+
5+
The `SQLCEXPERIMENT` variable controls experimental features within sqlc. It is
6+
a comma-separated list of experiment names. This is modeled after Go's
7+
[GOEXPERIMENT](https://pkg.go.dev/internal/goexperiment) environment variable.
8+
9+
Experiment names can be prefixed with `no` to explicitly disable them.
10+
11+
```
12+
SQLCEXPERIMENT=foo,bar # enable foo and bar experiments
13+
SQLCEXPERIMENT=nofoo # explicitly disable foo experiment
14+
SQLCEXPERIMENT=foo,nobar # enable foo, disable bar
15+
```
16+
17+
Currently, no experiments are defined. Experiments will be documented here as
18+
they are introduced.
19+
320
## SQLCCACHE
421

522
The `SQLCCACHE` environment variable dictates where `sqlc` will store cached

0 commit comments

Comments
 (0)