-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Support clickhouse v2 #1261
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
Open
kokizzu
wants to merge
16
commits into
golang-migrate:master
Choose a base branch
from
kokizzu:support-clickhouse-v2
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Support clickhouse v2 #1261
Changes from 10 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
6b84fed
merge conflict
kokizzu 1596f36
add rizal patch
kokizzu bf4106c
fix gomod merge
kokizzu 3095dc1
linter fix
kokizzu a4d96db
another linter fix
kokizzu 11bbd04
remove database query string until clickhouse-go for patch merged
kokizzu 4dfeff2
Merge branch 'master' into support-clickhouse-v2
kokizzu b90713b
use filtered custom query string
kokizzu 2a55cd9
Merge branch 'support-clickhouse-v2' of github.com:kokizzu/migrate in…
kokizzu 4711dff
fix other query string that no longer supported
kokizzu 259fddb
downgrade docker to 27
kokizzu aa6d06b
downgrade clickhouse/v2 to downgrade docker
kokizzu 2b7d958
go mod tidy
kokizzu 5191ae4
Revert "go mod tidy"
kokizzu 039e35b
Revert "downgrade clickhouse/v2 to downgrade docker"
kokizzu 09a326d
Revert "downgrade docker to 27"
kokizzu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,9 +6,10 @@ import ( | |
sqldriver "database/sql/driver" | ||
"fmt" | ||
"log" | ||
"net/url" | ||
"testing" | ||
|
||
_ "github.com/ClickHouse/clickhouse-go" | ||
_ "github.com/ClickHouse/clickhouse-go/v2" | ||
"github.com/dhui/dktest" | ||
"github.com/golang-migrate/migrate/v4" | ||
"github.com/golang-migrate/migrate/v4/database/clickhouse" | ||
|
@@ -33,12 +34,12 @@ var ( | |
func clickhouseConnectionString(host, port, engine string) string { | ||
if engine != "" { | ||
return fmt.Sprintf( | ||
"clickhouse://%v:%v?username=user&password=password&database=db&x-multi-statement=true&x-migrations-table-engine=%v&debug=false", | ||
"clickhouse://%v:%v/db?username=user&password=password&x-multi-statement=true&x-migrations-table-engine=%v&debug=false", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this one needed at least until this one merged: ref: ClickHouse/clickhouse-go#757 other related issue: #380 |
||
host, port, engine) | ||
} | ||
|
||
return fmt.Sprintf( | ||
"clickhouse://%v:%v?username=user&password=password&database=db&x-multi-statement=true&debug=false", | ||
"clickhouse://%v:%v/db?username=user&password=password&x-multi-statement=true&debug=false", | ||
host, port) | ||
} | ||
|
||
|
@@ -48,7 +49,9 @@ func isReady(ctx context.Context, c dktest.ContainerInfo) bool { | |
return false | ||
} | ||
|
||
db, err := sql.Open("clickhouse", clickhouseConnectionString(ip, port, "")) | ||
addr := clickhouseConnectionString(ip, port, "") | ||
purl, _ := url.Parse(addr) | ||
db, err := sql.Open("clickhouse", migrate.FilterCustomQuery(purl).String()) | ||
|
||
if err != nil { | ||
log.Println("open error", err) | ||
|
@@ -114,7 +117,8 @@ func testSimpleWithInstanceDefaultConfigValues(t *testing.T) { | |
} | ||
|
||
addr := clickhouseConnectionString(ip, port, "") | ||
conn, err := sql.Open("clickhouse", addr) | ||
purl, _ := url.Parse(addr) | ||
conn, err := sql.Open("clickhouse", migrate.FilterCustomQuery(purl).String()) | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Can you add a v2 db driver similar to how we use pgxv4 and pgxv5? That way users can decide when to migrate themselves.
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.
i don't think it's possible, clickhouse v2 autoregister as "clickhouse" same as v1 (that already deprecated)
while pgx it using different name "pgx5"
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.
I've confirmed this behavior in the code:
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.
finally green btw @dhui