diff --git a/app/app.go b/app/app.go index dadaad3..ba897dd 100644 --- a/app/app.go +++ b/app/app.go @@ -239,7 +239,7 @@ func connectDB(PSN string, isDebug bool) *bun.DB { db := bun.NewDB(sqldb, pgdialect.New()) if isDebug { - db.AddQueryHook(bundebug.NewQueryHook(bundebug.WithVerbose())) + db.AddQueryHook(bundebug.NewQueryHook(bundebug.WithVerbose(true))) } return db diff --git a/go.mod b/go.mod index e21ef5b..5cda64b 100644 --- a/go.mod +++ b/go.mod @@ -18,14 +18,15 @@ require ( github.com/mwitkow/go-proto-validators v0.3.2 github.com/rakyll/statik v0.1.7 github.com/stretchr/testify v1.7.0 - github.com/uptrace/bun v0.3.0 - github.com/uptrace/bun/dbfixture v0.2.10 - github.com/uptrace/bun/dialect/pgdialect v0.3.0 - github.com/uptrace/bun/dialect/sqlitedialect v0.2.4 - github.com/uptrace/bun/extra/bundebug v0.3.0 + github.com/uptrace/bun v1.0.22 + github.com/uptrace/bun/dbfixture v1.0.19 + github.com/uptrace/bun/dialect/pgdialect v1.0.19 + github.com/uptrace/bun/dialect/sqlitedialect v1.0.19 + github.com/uptrace/bun/extra/bundebug v1.0.22 github.com/urfave/cli/v2 v2.3.0 go4.org v0.0.0-20201209231011-d4a079459e60 golang.org/x/mod v0.4.2 // indirect + golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27 // indirect google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 google.golang.org/grpc v1.33.1 google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.0.1 diff --git a/go.sum b/go.sum index 4a6cb8e..0ef6424 100644 --- a/go.sum +++ b/go.sum @@ -110,8 +110,8 @@ github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.m github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/fatih/color v1.10.0 h1:s36xzo75JdqLaaWoiEHk767eHiwo0598uUxyfiPkDsg= -github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= +github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w= +github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= github.com/form3tech-oss/jwt-go v3.2.3+incompatible h1:7ZaBxOI7TMoYBfyA3cQHErNNyAWIKUMIwqxEtgHOs5c= github.com/form3tech-oss/jwt-go v3.2.3+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k= github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4= @@ -345,16 +345,18 @@ github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaO github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8= -github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-colorable v0.1.12 h1:jF+Du6AlPIjs2BiUiQlKOX0rt3SujHxPnksPKZbaA40= +github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= -github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= +github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y= +github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-sqlite3 v1.14.7 h1:fxWBnXkxfM6sRiuH3bqJ4CfzZojMOLVc0UTsTglEghA= github.com/mattn/go-sqlite3 v1.14.7/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= @@ -496,31 +498,24 @@ github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1 github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc h1:9lRDQMhESg+zvGYmW5DyG0UqvY96Bu5QYsTLvCHdrgo= github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc/go.mod h1:bciPuU6GHm1iF1pBvUfxfsH0Wmnc2VbpgvbI9ZWuIRs= -github.com/uptrace/bun v0.1.1/go.mod h1:y7OgTXdMe3wrAyp1He4Sx1o41kzCQQ8TeBFZyQp3SOg= -github.com/uptrace/bun v0.2.10 h1:MEpTqi9zNXLqscC6LuQDKCLPnlbtyPyuOu/kgB/Nc6Y= -github.com/uptrace/bun v0.2.10/go.mod h1:qgoGDJCYFjR+XmXYAiz8PJVkRRXmExHhzxC5eJIVsq4= -github.com/uptrace/bun v0.3.0 h1:nzQalsm/4X9TUFobZ+29tVn0aYnMNW78Y4no7lILDPE= -github.com/uptrace/bun v0.3.0/go.mod h1:aL6D9vPw8DXaTQTwGrEPtUderBYXx7ShUmPfnxnqscw= -github.com/uptrace/bun/dbfixture v0.2.10 h1:bg+oahZv5nrbvYOr3/M93XzGL22ypTAiMT+Pq1JIhaQ= -github.com/uptrace/bun/dbfixture v0.2.10/go.mod h1:kJmClyWQOgwbOQayFesy+uNMHe0Yob3qdVVEYijlGhQ= -github.com/uptrace/bun/dialect/pgdialect v0.2.10 h1:3HA0ipdYVvhCrZnrQRyUj49ttri2hnN/CmhPIGBiQqM= -github.com/uptrace/bun/dialect/pgdialect v0.2.10/go.mod h1:qr7yaz3EQDBF/txR3JN3Rx1fHxJOhpegrIsMivwdvRM= -github.com/uptrace/bun/dialect/pgdialect v0.3.0 h1:8gDwUpLHR2CMmmhCo6ocvrmrTjx0ObDsRnKqtTHOMOc= -github.com/uptrace/bun/dialect/pgdialect v0.3.0/go.mod h1:qr7yaz3EQDBF/txR3JN3Rx1fHxJOhpegrIsMivwdvRM= -github.com/uptrace/bun/dialect/sqlitedialect v0.2.4 h1:8M5XJx0giu5240prE3PlUPlZ+7ayxXRUxPMOu8byvvY= -github.com/uptrace/bun/dialect/sqlitedialect v0.2.4/go.mod h1:jAoFlOBNOGre5RcGosX3O7MlqjqfgASf2Up6QnaJdMM= -github.com/uptrace/bun/extra/bundebug v0.2.10 h1:YhWAXypbYuxhSpn1FQIB4v/+yrRLmPhGoTc76MBBTP8= -github.com/uptrace/bun/extra/bundebug v0.2.10/go.mod h1:7l3ovRZQS+hqY+hAd/xzMjIYTYX8OmCHRYoKjD6m11o= -github.com/uptrace/bun/extra/bundebug v0.3.0 h1:tlOox9loNCUPTANNc7nUOi3Yk/Qu1koK0/WvPPve2HY= -github.com/uptrace/bun/extra/bundebug v0.3.0/go.mod h1:7l3ovRZQS+hqY+hAd/xzMjIYTYX8OmCHRYoKjD6m11o= +github.com/uptrace/bun v1.0.19/go.mod h1:Uv7z0z+7dXnUS9P5hMF0hdiM/4M+xOUHQCrZpyDrpRc= +github.com/uptrace/bun v1.0.22 h1:0asZNOcM4eLq5Pgzu+LpZyJRxlt3ops+HahVkWPqxww= +github.com/uptrace/bun v1.0.22/go.mod h1:SkbOr4hdcYqqFPw4rbc1QAnLLvDLgq+X0w8OSllj1MU= +github.com/uptrace/bun/dbfixture v1.0.19 h1:1jKjs6vluS4e5F0U5kF3RW5SPCGbTj+64WiCbVIy09U= +github.com/uptrace/bun/dbfixture v1.0.19/go.mod h1:1mHn2Np4I3vDrGDWb6zzce+4D4StFwpMXBdtCxizRt8= +github.com/uptrace/bun/dialect/pgdialect v1.0.19 h1:8vdHpXRq3rbNDRn13llLxJ52wa+aBBn7QI0Q7IyW/d8= +github.com/uptrace/bun/dialect/pgdialect v1.0.19/go.mod h1:VMmro4cCcjC7xAIeWYvRHv8V2nF+q2Tm36WK+poCeuo= +github.com/uptrace/bun/dialect/sqlitedialect v1.0.19 h1:Oy0scO7sXbVBk9k6xc2yFF/X1maW5UU6uqO6coX/5/8= +github.com/uptrace/bun/dialect/sqlitedialect v1.0.19/go.mod h1:KXvO5WJYf+JNrabpLR9CdflPjOqbkIjoBalxePvoysU= +github.com/uptrace/bun/extra/bundebug v1.0.22 h1:wy5iiHKX/eG4rXovU/n4XoAhq2nBfhGZL5I7FDrknfQ= +github.com/uptrace/bun/extra/bundebug v1.0.22/go.mod h1:dKxkcaMPKJAJc1IHVobW3DmM5fldkBR8jKohaWDhTAQ= github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= github.com/urfave/cli v1.22.1 h1:+mkCCcOFKPnCmVYVcURKps1Xe+3zP90gSYGNfRkjoIY= github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/urfave/cli/v2 v2.3.0 h1:qph92Y649prgesehzOrQjdWyxFOp/QVM+6imKHad91M= github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI= -github.com/vmihailenco/msgpack/v5 v5.3.1/go.mod h1:7xyJ9e+0+9SaZT0Wt1RGleJXzli6Q/V5KbhBonMG9jc= -github.com/vmihailenco/msgpack/v5 v5.3.4 h1:qMKAwOV+meBw2Y8k9cVwAy7qErtYCwBzZ2ellBfvnqc= -github.com/vmihailenco/msgpack/v5 v5.3.4/go.mod h1:7xyJ9e+0+9SaZT0Wt1RGleJXzli6Q/V5KbhBonMG9jc= +github.com/vmihailenco/msgpack/v5 v5.3.5 h1:5gO0H1iULLWGhs2H5tbAHIZTV8/cYafcFOr9znI5mJU= +github.com/vmihailenco/msgpack/v5 v5.3.5/go.mod h1:7xyJ9e+0+9SaZT0Wt1RGleJXzli6Q/V5KbhBonMG9jc= github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g= github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= @@ -697,9 +692,13 @@ golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210507014357-30e306a8bba5/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210616094352-59db8d763f22 h1:RqytpXGR1iVNX7psjB3ff8y7sNFinVFvkx1c8SjBkio= -golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211123173158-ef496fb156ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27 h1:XDXtA5hveEEV8JB2l7nhMTp3t3cHp9ZpwcdjqyEWLlo= +golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/main.go b/main.go index 660aed7..6e3e885 100644 --- a/main.go +++ b/main.go @@ -263,7 +263,7 @@ func newDBCommand(migrations *migrate.Migrations) *cli.Command { migrator := migrate.NewMigrator(app.DB(c.String("env"), dbdebug), migrations) - _, err = migrator.CreateGo(ctx, c.Args().Get(0)) + _, err = migrator.CreateGoMigration(ctx, c.Args().Get(0)) return err }, @@ -285,7 +285,7 @@ func newDBCommand(migrations *migrate.Migrations) *cli.Command { } migrator := migrate.NewMigrator(app.DB(c.String("env"), dbdebug), migrations) - _, err = migrator.CreateSQL(ctx, c.Args().Get(0)) + _, err = migrator.CreateSQLMigrations(ctx, c.Args().Get(0)) return err }, diff --git a/server/suite_test.go b/server/suite_test.go index 6ee7833..252c887 100644 --- a/server/suite_test.go +++ b/server/suite_test.go @@ -75,7 +75,7 @@ func (suite *UserApiTestSuite) SetupSuite() { db := bun.NewDB(sqldb, pgdialect.New()) - db.AddQueryHook(bundebug.NewQueryHook(bundebug.WithVerbose())) + db.AddQueryHook(bundebug.NewQueryHook(bundebug.WithVerbose(true))) suite.cfg = cfg suite.ctx = context.Background()