Skip to content

Commit

Permalink
fix db migration
Browse files Browse the repository at this point in the history
  • Loading branch information
zachmann committed Aug 3, 2021
1 parent db9933b commit df9b2ee
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
10 changes: 6 additions & 4 deletions cmd/mytoken-server/mytoken-migratedb/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@ import (
"strings"
"time"

"github.com/zachmann/cli/v2"
"golang.org/x/term"

"github.com/oidc-mytoken/server/internal/config"
"github.com/oidc-mytoken/server/internal/db"
"github.com/oidc-mytoken/server/shared/utils/fileutil"
"github.com/zachmann/cli/v2"
"golang.org/x/term"

"github.com/oidc-mytoken/server/internal/model/version"
log "github.com/sirupsen/logrus"

"github.com/oidc-mytoken/server/internal/model/version"
)

var configFile string
Expand Down Expand Up @@ -48,7 +50,7 @@ var app = &cli.App{
&cli.BoolFlag{
Name: "force",
Aliases: []string{"f"},
Usage: "Force a complete database migration. Mytoken servers are not checked if they are compatible with the changes.",
Usage: "Force a complete database migration. It is not checked if mytoken servers are compatible with the changes.",
Destination: &force,
HideDefaultValue: true,
},
Expand Down
6 changes: 0 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuy
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/andybalholm/brotli v1.0.0/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu3qAvBg8x/Y=
github.com/andybalholm/brotli v1.0.1/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu3qAvBg8x/Y=
github.com/andybalholm/brotli v1.0.2 h1:JKnhI/XQ75uFBTiuzXpzFrUriDPiZjlOSzh6wXogP0E=
github.com/andybalholm/brotli v1.0.2/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu3qAvBg8x/Y=
github.com/andybalholm/brotli v1.0.3 h1:fpcw+r1N1h0Poc1F/pHbW40cUm/lMEQslZtCkBQ0UnM=
github.com/andybalholm/brotli v1.0.3/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig=
Expand Down Expand Up @@ -166,12 +165,9 @@ github.com/goccy/go-json v0.7.4 h1:B44qRUFwz/vxPKPISQ1KhvzRi9kZ28RAf6YtjriBZ5k=
github.com/goccy/go-json v0.7.4/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
github.com/gofiber/fiber/v2 v2.2.2/go.mod h1:Aso7/M+EQOinVkWp4LUYjdlTpKTBoCk2Qo4djnMsyHE=
github.com/gofiber/fiber/v2 v2.7.1/go.mod h1:f8BRRIMjMdRyt2qmJ/0Sea3j3rwwfufPrh9WNBRiVZ0=
github.com/gofiber/fiber/v2 v2.14.0/go.mod h1:oZTLWqYnqpMMuF922SjGbsYZsdpE1MCfh416HNdweIM=
github.com/gofiber/fiber/v2 v2.16.0 h1:Bly40vAh4qofpCoVYGLYC0TS9lNGNA1OVSPuzhIK7Q8=
github.com/gofiber/fiber/v2 v2.16.0/go.mod h1:iftruuHGkRYGEXVISmdD7HTYWyfS2Bh+Dkfq4n/1Owg=
github.com/gofiber/helmet/v2 v2.1.0/go.mod h1:BWTRxVM8ILkx7pv+xrRSnEZcMriqMbtywhqHsDCB98s=
github.com/gofiber/helmet/v2 v2.1.7 h1:D9UhKjASJ0V/9wpciUMe9e1mh407XWsc/btdFSIbnG0=
github.com/gofiber/helmet/v2 v2.1.7/go.mod h1:ZI5amrsoR4H0Ak4mMqJ/1+g6mwhOlcGRxHkx+vF4YYU=
github.com/gofiber/helmet/v2 v2.2.0 h1:ZIJ+ypWcmq3i/GmZEdcH6DDutV5oi7WLi6klcU3hiD8=
github.com/gofiber/helmet/v2 v2.2.0/go.mod h1:4/j07d1B2JRy+V7FfZSwQ9NMGERlwvJipZUgmscmGHA=
github.com/gofiber/template v1.6.8/go.mod h1:9hx59OnW2CAO03HntVp44U9o5XWM5Ly1r0oIsQZQwsI=
Expand Down Expand Up @@ -334,7 +330,6 @@ github.com/klauspost/compress v1.10.5/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYs
github.com/klauspost/compress v1.10.7/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
github.com/klauspost/compress v1.11.8/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
github.com/klauspost/compress v1.11.12/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
github.com/klauspost/compress v1.12.2 h1:2KCfW3I9M7nSc5wOqXAlW2v2U6v+w6cbjvbfp+OykW8=
github.com/klauspost/compress v1.12.2/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg=
github.com/klauspost/compress v1.13.2 h1:YecVYiuZPySnUyT8Ar9d5VawPwybeQw9IcwsLfdfdEk=
github.com/klauspost/compress v1.13.2/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg=
Expand Down Expand Up @@ -721,7 +716,6 @@ golang.org/x/sys v0.0.0-20210319071255-635bc2c9138d/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210514084401-e8d321eab015 h1:hZR0X1kPW+nwyJ9xRxqZk1vx5RUObAPBdKVvXPDUH/E=
golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c h1:F1jZWGFhYfh0Ci55sIpILtKKK8p3i2/krTr0H1rg74I=
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
Expand Down
6 changes: 3 additions & 3 deletions internal/db/dbmigrate/v0.3.0.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ var v0_3_0_Before = []string{
"ALTER TABLE AuthInfo ADD code_verifier varchar(128) NULL",
"ALTER TABLE TransferCodesAttributes ADD max_token_len INT NULL",
"CREATE OR REPLACE" +
"ALGORITHM = UNDEFINED VIEW `mytoken_test`.`TransferCodes` AS" +
"ALGORITHM = UNDEFINED VIEW `TransferCodes` AS" +
"select" +
"`pt`.`id` AS `id`," +
"`pt`.`jwt` AS `jwt`," +
Expand All @@ -23,8 +23,8 @@ var v0_3_0_Before = []string{
"`tca`.`max_token_len` AS `max_token_len`," +
"`tca`.`consent_declined` AS `consent_declined`" +
"from" +
"(`mytoken_test`.`ProxyTokens` `pt`" +
"join `mytoken_test`.`TransferCodesAttributes` `tca` on" +
"(`ProxyTokens` `pt`" +
"join `TransferCodesAttributes` `tca` on" +
"(`pt`.`id` = `tca`.`id`))",

// Predefined Values
Expand Down

0 comments on commit df9b2ee

Please sign in to comment.