Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
56e708a
Create dependabot.yml
jinzhu Sep 3, 2020
a8d26c3
Update go.mod
jinzhu Sep 3, 2020
04d298c
Bump gorm.io/gorm from 1.20.0 to 1.20.1
dependabot[bot] Sep 11, 2020
00a00d2
Bump gorm.io/driver/sqlite from 1.1.1 to 1.1.2
dependabot[bot] Sep 11, 2020
08299bc
Merge pull request #138 from go-gorm/dependabot/go_modules/gorm.io/go…
jinzhu Sep 11, 2020
466eebb
Merge pull request #137 from go-gorm/dependabot/go_modules/gorm.io/dr…
jinzhu Sep 11, 2020
1ed045d
Bump gorm.io/driver/sqlite from 1.1.2 to 1.1.3
dependabot[bot] Sep 16, 2020
9d25708
Merge pull request #141 from go-gorm/dependabot/go_modules/gorm.io/dr…
jinzhu Sep 16, 2020
1fb4cb4
Bump gorm.io/driver/sqlserver from 1.0.3 to 1.0.4
dependabot[bot] Sep 16, 2020
af61c2e
Merge pull request #139 from go-gorm/dependabot/go_modules/gorm.io/dr…
jinzhu Sep 16, 2020
7c3396c
Bump gorm.io/driver/postgres from 1.0.0 to 1.0.1
dependabot[bot] Sep 21, 2020
ef4536a
Merge pull request #148 from go-gorm/dependabot/go_modules/gorm.io/dr…
jinzhu Sep 27, 2020
49d9c4f
Bump gorm.io/gorm from 1.20.1 to 1.20.2
dependabot[bot] Sep 28, 2020
184f248
Merge pull request #159 from go-gorm/dependabot/go_modules/gorm.io/go…
jinzhu Sep 28, 2020
ad38b68
Bump gorm.io/driver/postgres from 1.0.1 to 1.0.2
dependabot[bot] Sep 29, 2020
b9c0604
Merge pull request #160 from go-gorm/dependabot/go_modules/gorm.io/dr…
jinzhu Sep 29, 2020
5d473a1
Update go.mod
jinzhu Oct 30, 2020
2ba9fc4
Update go.mod
jinzhu Nov 25, 2020
905e311
Update README
jinzhu Dec 14, 2020
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
15 changes: 15 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "daily"
52 changes: 33 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,50 @@
# GORM PlayGround
# GORM Playground

GORM PlayGround can be used to play GORM and reports issues
GORM Playground can be used to play GORM and reports issues, if you encounter a bug in GORM, please report it at [https://github.com/go-gorm/gorm/issues](https://github.com/go-gorm/gorm/issues) with the Playground Pull Request's link

[![test status](https://github.com/go-gorm/playground/workflows/tests/badge.svg?branch=master "test status")](https://github.com/go-gorm/playground/actions)

### Usage
### Quick Start

Modify [https://github.com/go-gorm/playground/edit/master/main_test.go](https://github.com/go-gorm/playground/edit/master/main_test.go) and create pull report, your code will run with SQLite, MySQL, Postgres and SQL server with the help of Github Action
##### 1. [Fork this repo](https://docs.github.com/en/free-pro-team@latest/github/getting-started-with-github/fork-a-repo)

If you encounter a bug in GORM, please report it at [https://github.com/go-gorm/gorm/issues](https://github.com/go-gorm/gorm/issues) with the PlayGround Pull Request's link
##### 2. [Clone the forked repo to your local](https://docs.github.com/en/free-pro-team@latest/github/creating-cloning-and-archiving-repositories/cloning-a-repository)

We are using the following configuration run your code (GORM's latest master branch, database drivers: sqlite, mysql, postgres, sqlserver), you could change it in the above [link](https://github.com/go-gorm/playground/edit/master/main_test.go)
##### 3. Setup test database

```go
// GORM_REPO: https://github.com/go-gorm/gorm.git
// GORM_BRANCH: master
// TEST_DRIVERS: sqlite, mysql, postgres, sqlserver
```
```bash
# install docker-compose https://docs.docker.com/compose/install/

BTW, we have prepared some structs with relationships in [https://github.com/go-gorm/playground/blob/master/models.go](https://github.com/go-gorm/playground/blob/master/models.go) that you may be interested to use
# setup test databases
docker-compose up
```

### Run Locally
##### 4. Run tests with lastest GORM and all drivers

```go
// Setup Databases
docker-compose up
```bash
./test.sh

// Run tests with cached GORM and latest drivers
# Run tests with cached GORM and latest drivers
GORM_ENABLE_CACHE=true ./test.sh

// Run tests with latest GORM specified with GORM_REPO, GORM_BRANCH and latest drivers
./test.sh
# Run tests with specfied database
GORM_DIALECT=mysql go test
```

##### 5. Modify tests and make it fail

##### 6. [Create Playground Pull Request](https://docs.github.com/en/free-pro-team@latest/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request) and [Create a GORM issue](https://github.com/go-gorm/gorm/issues/new?template=bug_report.md) with the link

### Advanced Usage

We are using the following configuration run your code (GORM's latest master branch, latest database drivers: sqlite, mysql, postgres, sqlserver), you could change the configuration in file [main_test.go](https://github.com/go-gorm/playground/edit/master/main_test.go)

```go
// GORM_REPO: https://github.com/go-gorm/gorm.git
// GORM_BRANCH: master
// TEST_DRIVERS: sqlite, mysql, postgres, sqlserver
```

We have prepared some structs with relationships in [https://github.com/go-gorm/playground/blob/master/models.go](https://github.com/go-gorm/playground/blob/master/models.go) that you can use for your tests

## Happy Hacking!
2 changes: 1 addition & 1 deletion db.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func OpenTestConnection() (db *gorm.DB, err error) {
case "postgres":
log.Println("testing postgres...")
if dbDSN == "" {
dbDSN = "user=gorm password=gorm dbname=gorm port=9920 sslmode=disable TimeZone=Asia/Shanghai"
dbDSN = "user=gorm password=gorm host=localhost dbname=gorm port=9920 sslmode=disable TimeZone=Asia/Shanghai"
}
db, err = gorm.Open(postgres.Open(dbDSN), &gorm.Config{})
case "sqlserver":
Expand Down
11 changes: 5 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@ module gorm.io/playground
go 1.14

require (
github.com/jinzhu/now v1.1.1
gorm.io/driver/mysql v0.2.9
gorm.io/driver/postgres v0.2.5
gorm.io/driver/sqlite v1.0.8
gorm.io/driver/sqlserver v0.2.4
gorm.io/gorm v0.2.20
gorm.io/driver/mysql v1.0.3
gorm.io/driver/postgres v1.0.5
gorm.io/driver/sqlite v1.1.4
gorm.io/driver/sqlserver v1.0.5
gorm.io/gorm v1.20.8
)

replace gorm.io/gorm => ./gorm