-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade pgx to v5 and use trimmed sql-migrate (Rebase:4bf4c19) #1067
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a minor comment but otherwise LGTM 👍
|
||
// Check migration status and fail fast if the schema has diverged. | ||
migrate.StartupCheck(startupLogger, db) | ||
conn, err := db.Conn(context.Background()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like this leaks connection. needs conn.Close()
on success and errors paths
server/console_channel.go
Outdated
@@ -55,7 +55,7 @@ func (s *ConsoleServer) DeleteChannelMessages(ctx context.Context, in *console.D | |||
|
|||
var res sql.Result | |||
var err error | |||
if res, err = s.db.ExecContext(ctx, query, &pgtype.Timestamptz{Time: deleteBefore, Status: pgtype.Present}); err != nil { | |||
if res, err = s.db.ExecContext(ctx, query, &pgtype.Timestamptz{Time: deleteBefore, Valid: true}); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIK time.Time
is natively supported for both args and scanning into
server/core_account.go
Outdated
@@ -72,7 +73,7 @@ func GetAccount(ctx context.Context, logger *zap.Logger, db *sql.DB, statusRegis | |||
var updateTime pgtype.Timestamptz | |||
var verifyTime pgtype.Timestamptz | |||
var disableTime pgtype.Timestamptz | |||
var deviceIDs pgtype.VarcharArray | |||
var deviceIDs pgtype.Array[string] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is FlatArray[T]
which is just a newtype for []T
and doesn't support multidimentional arrays because of that, but otherwise should work just as well here
dd908aa
to
1fae047
Compare
14b9c61
to
498256f
Compare
Use trimmed sql-migrate Config and db creation refactor.
Bug fixes. Improve performance of notification persist.
498256f
to
76bda02
Compare
Superseded by: #1218 |
Use trimmed sql-migrate
Config and db creation refactor.
Original PR: #985