Skip to content

Conversation

@GeertJohan
Copy link
Member

@GeertJohan GeertJohan commented Dec 12, 2025

Fixed #39

Copy link
Collaborator

@provokateurin provokateurin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

internal/diff.go Outdated
Comment on lines 22 to 30
fromDB := stdlib.OpenDB(*migrateConn.Config())
fromDB.SetMaxOpenConns(diffMaxOpenConns)
defer fromDB.Close()
err := fromDB.Ping()
err := fromDB.PingContext(ctx)
if err != nil {
return "", fmt.Errorf("failed to open 'from database' connection: %w", err)
}

toDB := stdlib.OpenDB(*migrateConn.Config())
toDB := stdlib.OpenDB(*targetConn.Config())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe name them fromConn and toConn to avoid mistakes in the future and also make it easier to understand?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I originally named them like this to match their names elsewhere in trek (e.g. generate.go)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But I guess from and to makes more sense from the perspective of the Diff function; it has no knowledge of the origin of target and migrate.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But I guess from and to makes more sense from the perspective of the Diff function; it has no knowledge of the origin of target and migrate.

mise.toml Outdated
@@ -0,0 +1,2 @@
[tools]
golangci-lint = "2.6.1"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI uses 2.7.2 already (which currently is the latest release):

version: v2.7.2

@GeertJohan GeertJohan merged commit 4563bb5 into main Dec 12, 2025
1 check passed
@provokateurin provokateurin deleted the improve-diff-output branch December 13, 2025 07:07
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.

Improve generated migration statements

3 participants