Skip to content

mysql update docs with env vars, update test with json field, fill cl… #742

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/.idea/
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,9 @@ go test --tags=exp ./...

To run the tests in the examples folder, a running PostgreSQL instance is
required. The tests use the following environment variables to connect to the
database:
database

#### For PostgreSQL

```
Variable Default Value
Expand All @@ -492,6 +494,18 @@ PG_PASSWORD mysecretpassword
PG_DATABASE dinotest
```

#### For MySQL

```
Variable Default Value
-------------------------
MYSQL_HOST 127.0.0.1
MYSQL_PORT 3306
MYSQL_USER root
MYSQL_ROOT_PASSWORD mysecretpassword
MYSQL_DATABASE dinotest
```

```
go test --tags=examples,exp ./...
```
Expand Down
7 changes: 6 additions & 1 deletion internal/sqltest/mysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,10 @@ func MySQL(t *testing.T, migrations []string) (*sql.DB, func()) {
}
}

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