Skip to content

Commit 7141539

Browse files
mysql update docs with env vars, update test with json field, fill cleanup function wip see why error happens unkown json type with mysql engine (#742)
Co-authored-by: Kristi Jorgji <=> Co-authored-by: Kyle Conroy <kyle@conroy.org>
1 parent e091281 commit 7141539

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
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: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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)