Skip to content

Conversation

@tejaslodayadd
Copy link

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

@Copilot Copilot AI review requested due to automatic review settings October 21, 2025 23:03
Copy link

Copilot AI left a 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 deprecated github.com/gocql/gocql v1.x to the newer github.com/apache/cassandra-gocql-driver/v2 v2.0.0, following the Apache Cassandra gocql driver upgrade guide.

Key changes:

  • Updated module dependency from gocql/gocql to apache/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 or learn how to get started.

Comment on lines -283 to -285
if _, ok := err.(*gocql.Error); ok {
return database.NilVersion, false, nil
}
Copy link
Author

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
Copy link

Coverage Status

coverage: 54.057% (+0.02%) from 54.037%
when pulling e623eb5 on tejaslodayadd:tl-cassandra-gocql
into 8b9c5f7 on golang-migrate:master.

@tejaslodayadd
Copy link
Author

CC: @dhui pls feel free to leave comments

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.

2 participants