Skip to content

Commit d07d594

Browse files
authored
Merge branch 'master' into error-names
2 parents 83e4900 + 7141539 commit d07d594

File tree

3 files changed

+25
-5
lines changed

3 files changed

+25
-5
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/.idea/

README.md

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ Use "sqlc [command] --help" for more information about a command.
267267

268268
## Settings
269269

270-
The `sqlc` tool is configured via a `sqlc.yaml` file. This file must be
270+
The `sqlc` tool is configured via a `sqlc.yaml` or `sqlc.json` file. This file must be
271271
in the directory where the `sqlc` command is run.
272272

273273
```yaml
@@ -291,9 +291,9 @@ Each package document has the following keys:
291291
- `path`:
292292
- Output directory for generated code
293293
- `queries`:
294-
- Directory of SQL queries or path to single SQL file
294+
- Directory of SQL queries or path to single SQL file; or a list of paths
295295
- `schema`:
296-
- Directory of SQL migrations or path to single SQL file
296+
- Directory of SQL migrations or path to single SQL file; or a list of paths
297297
- `engine`:
298298
- Either `postgresql` or `mysql`. Defaults to `postgresql`. MySQL support is experimental
299299
- `emit_json_tags`:
@@ -480,7 +480,9 @@ go test --tags=exp ./...
480480

481481
To run the tests in the examples folder, a running PostgreSQL instance is
482482
required. The tests use the following environment variables to connect to the
483-
database:
483+
database
484+
485+
#### For PostgreSQL
484486

485487
```
486488
Variable Default Value
@@ -492,6 +494,18 @@ PG_PASSWORD mysecretpassword
492494
PG_DATABASE dinotest
493495
```
494496

497+
#### For MySQL
498+
499+
```
500+
Variable Default Value
501+
-------------------------
502+
MYSQL_HOST 127.0.0.1
503+
MYSQL_PORT 3306
504+
MYSQL_USER root
505+
MYSQL_ROOT_PASSWORD mysecretpassword
506+
MYSQL_DATABASE dinotest
507+
```
508+
495509
```
496510
go test --tags=examples,exp ./...
497511
```

internal/sqltest/mysql.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,5 +76,10 @@ func MySQL(t *testing.T, migrations []string) (*sql.DB, func()) {
7676
}
7777
}
7878

79-
return sdb, func() {}
79+
return sdb, func() {
80+
// Drop the test db after test runs
81+
if _, err := db.Exec("DROP DATABASE " + dbName); err != nil {
82+
t.Fatal(err)
83+
}
84+
}
8085
}

0 commit comments

Comments
 (0)