- Notifications
You must be signed in to change notification settings - Fork1.5k
Migrate from gocql v1.x to v2#1321
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:master
Are you sure you want to change the base?
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.
Pull Request Overview
This PR migrates the Cassandra driver from the deprecatedgithub.com/gocql/gocql v1.x to the newergithub.com/apache/cassandra-gocql-driver/v2 v2.0.0, following the Apache Cassandra gocql driver upgrade guide.
Key changes:
- Updated module dependency from
gocql/gocqltoapache/cassandra-gocql-driver/v2 - Replaced import statements across Cassandra database implementation files
- Updated documentation to reflect protocol version 5 support
Reviewed Changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| go.mod | Added new v2 driver dependency, removed old gocql dependency and transitive dependencies |
| database/cassandra/cassandra.go | Updated import to use aliased v2 driver |
| database/cassandra/cassandra_test.go | Updated imports with proper organization and v2 driver alias |
| database/cassandra/README.md | Updated protocol version documentation to include version 5 |
Tip: Customize your code reviews with copilot-instructions.md.Create the file orlearn how to get started.
| if_,ok:=err.(*gocql.Error);ok { | ||
| returndatabase.NilVersion,false,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.
> golangci-lint run ./database/cassandra/...database/cassandra/cassandra.go:283:21: SA1019: gocql.Error is deprecated: Unused (staticcheck) if _, ok := err.(*gocql.Error); ok {The code is checking for *gocql.Error which is deprecated in v2. Looking at the context, this check appears to be trying to handle the case where the table doesn't exist yet. However, since ensureVersionTable() is always called before Version() (as seen in line 78-80), the table should already exist, making this check unnecessary.
coveralls commentedOct 21, 2025
tejaslodayadd commentedOct 22, 2025
CC:@dhui pls feel free to leave comments |
tejaslodayadd commentedNov 25, 2025
@dhui any updates on this? |
gocql has recently upgraded from v1.x to v2 with some breaking changes.
Upgrade guide:https://github.com/apache/cassandra-gocql-driver/blob/trunk/UPGRADE_GUIDE.md
We'd like to change this and have it as part of golang-migrate/migrate