From b1f2063a9a9725ed991a3c610ae09c5236499976 Mon Sep 17 00:00:00 2001 From: blotus Date: Thu, 16 Mar 2023 11:02:31 +0100 Subject: [PATCH] Only support pgx driver for postgresql (#2118) --- go.mod | 1 - go.sum | 3 --- pkg/csconfig/database.go | 7 ++++--- pkg/database/database.go | 1 - 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/go.mod b/go.mod index 4a0881390..00a6098cc 100644 --- a/go.mod +++ b/go.mod @@ -40,7 +40,6 @@ require ( github.com/jackc/pgx/v4 v4.14.1 github.com/jarcoal/httpmock v1.1.0 github.com/jszwec/csvutil v1.5.1 - github.com/lib/pq v1.10.7 github.com/mattn/go-sqlite3 v1.14.15 github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 github.com/nxadm/tail v1.4.6 diff --git a/go.sum b/go.sum index acbee193a..baaa391fb 100644 --- a/go.sum +++ b/go.sum @@ -88,8 +88,6 @@ github.com/alexliesenfeld/health v0.5.1 h1:cohQdtQbJdA6bj0aMD4gdXA9xQyvh9NxWO9XL github.com/alexliesenfeld/health v0.5.1/go.mod h1:N4NDIeQtlWumG+6z1ne1v62eQxktz5ylEgGgH9emdMw= github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/antonmedv/expr v1.12.1 h1:GTGrGN1kxxb+le0uQKaFRK8By4cvq1sleUCGE/U6hHg= -github.com/antonmedv/expr v1.12.1/go.mod h1:FPC8iWArxls7axbVLsW+kpg1mz29A1b2M6jt+hZfDkU= github.com/antonmedv/expr v1.12.2 h1:nlRcu4uHI6oSKCf6GHJTcT7hIf7dFAjgfvG0MWb7Cu0= github.com/antonmedv/expr v1.12.2/go.mod h1:FPC8iWArxls7axbVLsW+kpg1mz29A1b2M6jt+hZfDkU= github.com/apparentlymart/go-textseg/v13 v13.0.0 h1:Y+KvPE1NYz0xl601PVImeQfFyEy6iT90AvPUL1NNfNw= @@ -640,7 +638,6 @@ github.com/lib/pq v1.1.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.10.2/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/lib/pq v1.10.7 h1:p7ZhMD+KsSRozJr34udlUrhboJwWAgCg34+/ZZNvZZw= -github.com/lib/pq v1.10.7/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/lithammer/dedent v1.1.0 h1:VNzHMVCBNG1j0fh3OrsFRkVUwStdDArbgBWoPAffktY= github.com/lithammer/dedent v1.1.0/go.mod h1:jrXYCQtgg0nJiN+StA2KgR7w6CiQNv9Fd/Z9BP0jIOc= github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4= diff --git a/pkg/csconfig/database.go b/pkg/csconfig/database.go index af646ea15..e7f67d474 100644 --- a/pkg/csconfig/database.go +++ b/pkg/csconfig/database.go @@ -102,9 +102,10 @@ func (d *DatabaseCfg) ConnectionDialect() (string, string, error) { return "sqlite3", dialect.SQLite, nil case "mysql": return "mysql", dialect.MySQL, nil - case "postgres", "postgresql": - return "postgres", dialect.Postgres, nil - case "pgx": + case "pgx", "postgresql", "postgres": + if d.Type != "pgx" { + log.Debugf("database type '%s' is deprecated, switching to 'pgx' instead", d.Type) + } return "pgx", dialect.Postgres, nil } return "", "", fmt.Errorf("unknown database type '%s'", d.Type) diff --git a/pkg/database/database.go b/pkg/database/database.go index e6427ab9b..3c0828705 100644 --- a/pkg/database/database.go +++ b/pkg/database/database.go @@ -14,7 +14,6 @@ import ( "github.com/go-co-op/gocron" _ "github.com/go-sql-driver/mysql" _ "github.com/jackc/pgx/v4/stdlib" - _ "github.com/lib/pq" _ "github.com/mattn/go-sqlite3" "github.com/pkg/errors" log "github.com/sirupsen/logrus"