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

[BUGFIX] Update Cassandra driver to drop materialized views before tables #984

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

bryanvaz
Copy link

@bryanvaz bryanvaz commented Oct 4, 2023

Issue Type: Bugfix

Issue Summary

If a cassandra keyspace has a materialized view, the drop command will fail as views must be dropped before underlying tables.

Change Summary

Updated Drop() implementation for the cassandra driver to find materialized views and drop them before dropping table.

Detailed Description:

If Cassandra (or ScyllaDB, which uses the cassandra driver) has a materialized view on a table, current version of migrate will fail on the drop command. This is because the current implementation of the driver only executes DROP TABLE commands. When migrate attempts to drop a table that has a materialized view the following error will be returned from migrate and the drop command will halt:

❯ ./migrate drop -f
2023/10/04 14:59:02 Dropping the entire database schema
2023/10/04 14:59:02 error: Cannot drop table when materialized views still depend on it
 (mv_test.{materialized_view_to_block_migrate_drop})

Test Results

Has been tested on both Cassandra 3.0 and ScyllaDB 5.2.

Note: Materialized views were introduced in Cassandra 3.0 (2015) and ScyllaDB 3.0 (2019)

@bryanvaz bryanvaz changed the title Update Cassandra driver to drop materialized views before tables [BUGFIX] Update Cassandra driver to drop materialized views before tables Oct 4, 2023
@bryanvaz
Copy link
Author

Hey Dale (@dhui),
The CI checks died because the gitlab runner ran out of space on its local disk, but I don't have the ability to rerun the CI (assuming it was a fluke).

Assuming the CI is totally borked, can run it locally so the PR can be merged?

We're running of a fork right now which is fine, but I don't want to end up in rebase-hell to support a core Cassandra feature.

Cheers,
Bryan

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.

None yet

1 participant