Skip to content
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

Closed
wants to merge 8 commits into from

Conversation

flaviofernandes004
Copy link
Contributor

Use trimmed sql-migrate
Config and db creation refactor.

Original PR: #985

Copy link
Member

@sesposito sesposito left a 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 👍

go.mod Outdated Show resolved Hide resolved

// Check migration status and fail fast if the schema has diverged.
migrate.StartupCheck(startupLogger, db)
conn, err := db.Conn(context.Background())
Copy link
Contributor

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

@@ -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 {
Copy link
Contributor

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

@@ -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]
Copy link
Contributor

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

@sesposito sesposito force-pushed the ff-spe-upgrade-pgx-v5-migrate branch from dd908aa to 1fae047 Compare August 9, 2023 17:46
@sesposito sesposito force-pushed the ff-spe-upgrade-pgx-v5-migrate branch 2 times, most recently from 14b9c61 to 498256f Compare September 13, 2023 17:59
@sesposito
Copy link
Member

Superseded by: #1218

@sesposito sesposito closed this May 23, 2024
@sesposito sesposito deleted the ff-spe-upgrade-pgx-v5-migrate branch May 23, 2024 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants