Skip to content

Commit

Permalink
fix migration error with PostgresSQL and ClickHouse (#464)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhenghaoz authored May 24, 2022
1 parent d615237 commit c25ebfe
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 40 deletions.
7 changes: 4 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ require (
github.com/thoas/go-funk v0.9.1
go.mongodb.org/mongo-driver v1.5.1
go.uber.org/atomic v1.9.0
go.uber.org/zap v1.17.0
go.uber.org/zap v1.21.0
golang.org/x/exp v0.0.0-20220303212507-bbda1eaf7a17
gonum.org/v1/gonum v0.0.0-20190409070159-6e46824336d2
google.golang.org/grpc v1.43.0
Expand All @@ -51,6 +51,7 @@ require (
gorm.io/gorm v1.23.5
modernc.org/mathutil v1.4.1
modernc.org/sortutil v1.1.0
moul.io/zapgorm2 v1.1.3
)

require (
Expand Down Expand Up @@ -111,7 +112,7 @@ require (
github.com/xdg-go/stringprep v1.0.2 // indirect
github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect
github.com/yuin/gopher-lua v0.0.0-20200816102855-ee81675732da // indirect
go.uber.org/multierr v1.6.0 // indirect
go.uber.org/multierr v1.8.0 // indirect
golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 // indirect
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2 // indirect
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
Expand All @@ -122,4 +123,4 @@ require (
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
)

replace gorm.io/driver/clickhouse v0.3.2 => github.com/gorse-io/clickhouse v0.3.3-0.20220513132205-2b1bb29ef150
replace gorm.io/driver/clickhouse v0.3.2 => github.com/gorse-io/clickhouse v0.3.3-0.20220524142000-fcf212533ab0
24 changes: 16 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN
github.com/aws/aws-sdk-go v1.34.28 h1:sscPpn/Ns3i0F4HPEWAVcwdIRaZZCuL7llJ2/60yPIk=
github.com/aws/aws-sdk-go v1.34.28/go.mod h1:H7NKnBqNVzoTJpGfLrQkkD+ytBA93eiDYi/+8rV9s48=
github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g=
github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8=
github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
Expand Down Expand Up @@ -235,8 +237,8 @@ github.com/gorilla/securecookie v1.1.1 h1:miw7JPhV+b/lAHSXz4qd/nN9jRiAFV5FwjeKyC
github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4=
github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
github.com/gorse-io/clickhouse v0.3.3-0.20220513132205-2b1bb29ef150 h1:Ak8RDhY+ep14kvqYu7edCPEFh2PY/xX5UVsHNjBWZ5s=
github.com/gorse-io/clickhouse v0.3.3-0.20220513132205-2b1bb29ef150/go.mod h1:V2TzR8ORGn4aktUMKkDJo9XX1STN3paUOsIBnFXJvWQ=
github.com/gorse-io/clickhouse v0.3.3-0.20220524142000-fcf212533ab0 h1:j87cgitZMpflxv4PFYXFY3S3qf3YfvWatvnEHPok/BY=
github.com/gorse-io/clickhouse v0.3.3-0.20220524142000-fcf212533ab0/go.mod h1:V2TzR8ORGn4aktUMKkDJo9XX1STN3paUOsIBnFXJvWQ=
github.com/gorse-io/dashboard v0.0.0-20220504033926-54e0e80acf0a h1:ezb+DwZv15acWhUBiYp7WC9gY5W6eBWYgq1YfqtAyTk=
github.com/gorse-io/dashboard v0.0.0-20220504033926-54e0e80acf0a/go.mod h1:TLQBh+sD73+HSL6uEZJFRLv1SgUnqef02AYzo61ZdiE=
github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs=
Expand Down Expand Up @@ -614,6 +616,7 @@ github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:
github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d h1:splanxYIlg+5LfHAM6xpdFEAYOk8iySO56hMFq6uLyA=
github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
github.com/yuin/gopher-lua v0.0.0-20200816102855-ee81675732da h1:NimzV1aGyq29m5ukMK0AMWEhFaL/lrEOaephfuoiARg=
github.com/yuin/gopher-lua v0.0.0-20200816102855-ee81675732da/go.mod h1:E1AXubJBdNmFERAOucpDIxNzeGfLzg0mYh+UfMWdChA=
github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q=
Expand All @@ -633,19 +636,22 @@ go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE=
go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
go.uber.org/goleak v1.1.10 h1:z+mqJhf6ss6BSfSM671tgKyZBFPTTJM+HLxnhPC3wu0=
go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A=
go.uber.org/goleak v1.1.11 h1:wy28qYRKZgnJTxGxvye5/wgWr1EKjmUDGYox5mGlRlI=
go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ=
go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4=
go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU=
go.uber.org/multierr v1.6.0 h1:y6IPFStTAIT5Ytl7/XYmHvzXQ7S3g/IeZW9hyZ5thw4=
go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU=
go.uber.org/multierr v1.7.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95ak=
go.uber.org/multierr v1.8.0 h1:dg6GjLku4EH+249NNmoIciG9N/jURbDG+pFlTkhzIC8=
go.uber.org/multierr v1.8.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95ak=
go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA=
go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM=
go.uber.org/zap v1.17.0 h1:MTjgFu6ZLKvY6Pvaqk97GlxNBuMpV4Hy/3P6tRGlI2U=
go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo=
go.uber.org/zap v1.21.0 h1:WefMeulhovoZ2sYXz7st6K0sLj7bBhpiFaud4r4zST8=
go.uber.org/zap v1.21.0/go.mod h1:wjWOCqI0f2ZZrJF/UufIOkiC8ii6tm1iqIsLo76RfJw=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
Expand Down Expand Up @@ -673,11 +679,11 @@ golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvx
golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5 h1:2M3HP5CCK1Si9FQhwnzYhXdG6DXeebvUHFpre8QvbyI=
golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
Expand Down Expand Up @@ -803,7 +809,7 @@ golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapK
golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.0.0-20210112230658-8b4aab62c064/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.1.8-0.20211029000441-d6a9af8af023 h1:0c3L82FDQ5rt1bjTBlchS8t6RQ6299/+5bWMnRLh+uI=
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
Expand Down Expand Up @@ -904,5 +910,7 @@ modernc.org/mathutil v1.4.1 h1:ij3fYGe8zBF4Vu+g0oT7mB06r8sqGWKuJu1yXeR4by8=
modernc.org/mathutil v1.4.1/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E=
modernc.org/sortutil v1.1.0 h1:oP3U4uM+NT/qBQcbg/K2iqAX0Nx7B1b6YZtq3Gk/PjM=
modernc.org/sortutil v1.1.0/go.mod h1:ZyL98OQHJgH9IEfN71VsamvJgrtRX9Dj2gX+vH86L1k=
moul.io/zapgorm2 v1.1.3 h1:PP9224dk0l2f56KE1anr3vcS2HzKV9PusKUE6UT9ncI=
moul.io/zapgorm2 v1.1.3/go.mod h1:HTO6sXgHhQD0s2D9HA4xcnJ+qxFRFwsCUxIeFDnKtq0=
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU=
2 changes: 1 addition & 1 deletion master/metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func TestOnlineEvaluator(t *testing.T) {
evaluator2.Positive("star", 2, 3, time.Date(2005, 6, 16, 0, 0, 0, 0, time.UTC))
evaluator2.Positive("fork", 3, 3, time.Date(2005, 6, 16, 0, 0, 0, 0, time.UTC))
result = evaluator2.Evaluate()
assert.Equal(t, []server.Measurement{
assert.ElementsMatch(t, []server.Measurement{
{"PositiveFeedbackRate/star", time.Date(2005, 6, 16, 0, 0, 0, 0, time.UTC), 0},
{"PositiveFeedbackRate/star", time.Date(2005, 6, 15, 0, 0, 0, 0, time.UTC), 0.35},
{"PositiveFeedbackRate/like", time.Date(2005, 6, 16, 0, 0, 0, 0, time.UTC), 0},
Expand Down
58 changes: 30 additions & 28 deletions storage/data/sql.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"github.com/zhenghaoz/gorse/base/log"
"gorm.io/gorm"
"gorm.io/gorm/schema"
"moul.io/zapgorm2"
"strings"
"time"
)
Expand All @@ -41,6 +42,7 @@ const (
)

var gormConfig = &gorm.Config{
Logger: zapgorm2.New(log.Logger()),
NamingStrategy: schema.NamingStrategy{
SingularTable: true,
},
Expand Down Expand Up @@ -73,24 +75,24 @@ func (d *SQLDatabase) Init() error {
// create tables
type Items struct {
ItemId string `gorm:"column:item_id;type:varchar(256) not null;primaryKey"`
IsHidden bool `gorm:"column:is_hidden;type:bool not null"`
Categories []string `gorm:"column:categories;type:json not null"`
Timestamp time.Time `gorm:"column:time_stamp;type:datetime not null"`
Labels []string `gorm:"column:labels;type:json not null"`
Comment string `gorm:"column:comment;type:text not null"`
IsHidden bool `gorm:"column:is_hidden;type:bool;not null"`
Categories []string `gorm:"column:categories;type:json;not null"`
Timestamp time.Time `gorm:"column:time_stamp;type:datetime;not null"`
Labels []string `gorm:"column:labels;type:json;not null"`
Comment string `gorm:"column:comment;type:text;not null"`
}
type Users struct {
UserId string `gorm:"column:user_id;type:varchar(256) not null;primaryKey"`
Labels []string `gorm:"column:labels;type:json not null"`
Subscribe []string `gorm:"column:subscribe;type:json not null"`
Comment string `gorm:"column:comment;type:text not null"`
UserId string `gorm:"column:user_id;type:varchar(256);not null;primaryKey"`
Labels []string `gorm:"column:labels;type:json;not null"`
Subscribe []string `gorm:"column:subscribe;type:json;not null"`
Comment string `gorm:"column:comment;type:text;not null"`
}
type Feedback struct {
FeedbackType string `gorm:"column:feedback_type;type:varchar(256) not null;primaryKey"`
UserId string `gorm:"column:user_id;type:varchar(256) not null;primaryKey;index:user_id"`
ItemId string `gorm:"column:item_id;type:varchar(256) not null;primaryKey;index:item_id"`
Timestamp time.Time `gorm:"column:time_stamp;type:datetime not null"`
Comment string `gorm:"column:comment;type:text not null"`
FeedbackType string `gorm:"column:feedback_type;type:varchar(256);not null;primaryKey"`
UserId string `gorm:"column:user_id;type:varchar(256);not null;primaryKey;index:user_id"`
ItemId string `gorm:"column:item_id;type:varchar(256);not null;primaryKey;index:item_id"`
Timestamp time.Time `gorm:"column:time_stamp;type:datetime;not null"`
Comment string `gorm:"column:comment;type:text;not null"`
}
err := d.gormDB.Set("gorm:table_options", "ENGINE=InnoDB").AutoMigrate(Users{}, Items{}, Feedback{})
if err != nil {
Expand All @@ -109,25 +111,25 @@ func (d *SQLDatabase) Init() error {
case Postgres:
// create tables
type Items struct {
ItemId string `gorm:"column:item_id;type:varchar(256) not null;primaryKey"`
IsHidden bool `gorm:"column:is_hidden;type:bool not null default false"`
Categories []string `gorm:"column:categories;type:json not null default '[]'"`
Timestamp time.Time `gorm:"column:time_stamp;type:timestamptz not null default '0001-01-01'"`
Labels []string `gorm:"column:labels;type:json not null default '[]'"`
Comment string `gorm:"column:comment;type:text not null default ''"`
ItemId string `gorm:"column:item_id;type:varchar(256);not null;primaryKey"`
IsHidden bool `gorm:"column:is_hidden;type:bool;not null;default:false"`
Categories []string `gorm:"column:categories;type:json;not null;default:'[]'"`
Timestamp time.Time `gorm:"column:time_stamp;type:timestamptz;not null;default:'0001-01-01'::timestamptz"`
Labels []string `gorm:"column:labels;type:json;not null;default:'[]'"`
Comment string `gorm:"column:comment;type:text;not null;default:''"`
}
type Users struct {
UserId string `gorm:"column:user_id;type:varchar(256) not null;primaryKey"`
Labels []string `gorm:"column:labels;type:json not null default '[]'"`
Subscribe []string `gorm:"column:subscribe;type:json not null default '[]'"`
Comment string `gorm:"column:comment;type:text not null default ''"`
Labels []string `gorm:"column:labels;type:json;not null;default:'[]'"`
Subscribe []string `gorm:"column:subscribe;type:json;not null;default:'[]'"`
Comment string `gorm:"column:comment;type:text;not null;default:''"`
}
type Feedback struct {
FeedbackType string `gorm:"column:feedback_type;type:varchar(256) not null;primaryKey"`
UserId string `gorm:"column:user_id;type:varchar(256) not null;primaryKey;index:user_id_index"`
ItemId string `gorm:"column:item_id;type:varchar(256) not null;primaryKey;index:item_id_index"`
Timestamp time.Time `gorm:"column:time_stamp;type:timestamptz not null default '0001-01-01'"`
Comment string `gorm:"column:comment;type:text not null default ''"`
FeedbackType string `gorm:"column:feedback_type;type:varchar(256);not null;primaryKey"`
UserId string `gorm:"column:user_id;type:varchar(256);not null;primaryKey;index:user_id_index"`
ItemId string `gorm:"column:item_id;type:varchar(256);not null;primaryKey;index:item_id_index"`
Timestamp time.Time `gorm:"column:time_stamp;type:timestamptz;not null;default:'0001-01-01'::timestamptz"`
Comment string `gorm:"column:comment;type:text;not null;default:''"`
}
err := d.gormDB.AutoMigrate(Users{}, Items{}, Feedback{})
if err != nil {
Expand Down
18 changes: 18 additions & 0 deletions storage/data/sql_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,12 @@ func TestMySQL_Timezone(t *testing.T) {
testTimeZone(t, db.Database)
}

func TestMySQL_Init(t *testing.T) {
db := newTestMySQLDatabase(t)
defer db.Close(t)
assert.NoError(t, db.Init())
}

func newTestPostgresDatabase(t *testing.T) *testSQLDatabase {
// retrieve test name
var testName string
Expand Down Expand Up @@ -223,6 +229,12 @@ func TestPostgres_Timezone(t *testing.T) {
testTimeZone(t, db.Database)
}

func TestPostgres_Init(t *testing.T) {
db := newTestPostgresDatabase(t)
defer db.Close(t)
assert.NoError(t, db.Init())
}

func newTestClickHouseDatabase(t *testing.T) *testSQLDatabase {
// retrieve test name
var testName string
Expand Down Expand Up @@ -304,3 +316,9 @@ func TestClickHouse_Timezone(t *testing.T) {
defer db.Close(t)
testTimeZone(t, db.Database)
}

func TestClickHouse_Init(t *testing.T) {
db := newTestClickHouseDatabase(t)
defer db.Close(t)
assert.NoError(t, db.Init())
}

0 comments on commit c25ebfe

Please sign in to comment.