I've replace keyspaces.first with keyspaces.filter. At the moment keyspaces.first will throw a NoSuchElementException. With keyspaces.filter the full statement will return false and a CassandraMigrationException will be thrown.
Stack trace before:
Exception in thread "main" java.util.NoSuchElementException: Collection contains no element matching the predicate.
at com.builtamont.cassandra.migration.CassandraMigration.execute$cassandra_migration(CassandraMigration.kt:535)
at com.builtamont.cassandra.migration.CassandraMigration.execute$cassandra_migration$default(CassandraMigration.kt:263)
at com.builtamont.cassandra.migration.CassandraMigration.migrate(CassandraMigration.kt:168)
at com.builtamont.cassandra.migration.CommandLine.main(CommandLine.kt:68)
Stack trace after:
Exception in thread "main" com.builtamont.cassandra.migration.api.CassandraMigrationException: Keyspace: cassandra_migration_test does not exist.
at com.builtamont.cassandra.migration.CassandraMigration.execute$cassandra_migration(CassandraMigration.kt:347)
at com.builtamont.cassandra.migration.CassandraMigration.execute$cassandra_migration$default(CassandraMigration.kt:263)
at com.builtamont.cassandra.migration.CassandraMigration.migrate(CassandraMigration.kt:168)
at com.builtamont.cassandra.migration.CommandLine.main(CommandLine.kt:68)
Summary
I've replace
keyspaces.first
withkeyspaces.filter
. At the momentkeyspaces.first
will throw aNoSuchElementException
. Withkeyspaces.filter
the full statement will returnfalse
and aCassandraMigrationException
will be thrown.Stack trace before:
Stack trace after:
Pull Request (PR) Checklist
Documentation
README.md
or Wiki updatedCode Review
TODO
s, or call them out in the PR commentsTests