add index cleanup function#142
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Spec: Add Index Cleanup Command
Motivation
In development and test environments, index state can drift from migration files.
Common situations:
Current commands support migrate, rollback, dump, and adopt, but there is no single command to reset all secondary indexes in one step.
CouchbaseORM should provide an explicit cleanup command to delete all non-primary indexes from the configured bucket.
Goals
Non-Goals
Command
Introduce:
bundle exec couchbaseorm index:cleanupUpdate usage output in:
to include:
Behavior
index:cleanupperforms:system:indexesfor the configured bucket.If no secondary indexes are found, the command is a no-op and returns an empty result.
Internal API
Introduce:
and instance method:
Implementation outline:
Notes:
IndexIntrospectoralready filters out primary indexes.remove_indexuses the existing query builder and execution path.CLI Output
When indexes are removed:
When there is nothing to remove:
Error Handling
This keeps behavior consistent with other index commands.
Tests
Add coverage for:
IndexMigrator.cleanupdelegates to instance cleanup.index:cleanuptriggers cleanup and prints expected output.index:cleanup.