Cobliteam / cassandra-migrate

Simple Cassandra schema migration tool written in Python
https://medium.com/@cobli/the-best-way-to-manage-schema-migrations-in-cassandra-92a34c834824
MIT License
150 stars 61 forks source link

Support migration reset to version 0 #25

Open BARJ opened 6 years ago

BARJ commented 6 years ago

At this moment it is not possible to undo all migrations.

For example, if version 1 migration is to create table books. And version 2 migration is to add column author to books. You can only undo version 2 migration by running cassandra-migrate reset 1. But you cannot undo version 1 migration by running cassandra-migrate reset 0. Since 0 causes a ValueError

ValueError: Invalid database version, must be a number > 0 or the name of an existing migration

danielkza commented 6 years ago

Reset consists of a dropping the keyspace and running migrations up to a given version afterwards. Since migrating to version 0 isn't supported (as it doesn't make much sense semantically), neither is resetting. Are you looking for a command that erases the keyspace, and just creates the migration state table, without actually running anything? Can you tell me a bit about what you want to achieve?