Skip to content

Commit

Permalink
return error for ft.alter w/o schema (#1754)
Browse files Browse the repository at this point in the history
* return error for ft.alter w/o schema

* Add test
  • Loading branch information
ashtul committed Dec 28, 2020
1 parent 5f7f105 commit 97f9d94
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/module.c
Expand Up @@ -582,6 +582,8 @@ static int AlterIndexInternalCommand(RedisModuleCtx *ctx, RedisModuleString **ar
}
}
IndexSpec_AddFields(sp, ctx, &ac, initialScan, &status);
} else {
return RedisModule_ReplyWithError(ctx, "ALTER must be followed by SCHEMA");
}

if (QueryError_HasError(&status)) {
Expand Down
2 changes: 2 additions & 0 deletions tests/pytests/test.py
Expand Up @@ -1896,6 +1896,8 @@ def testAlterIndex(env):
env.expect('FT.ALTER', 'idx', 'SCHEMA', 'NOT_ADD', 'f2', 'TEXT').error()
env.expect('FT.ALTER', 'idx', 'SCHEMA', 'ADD').error()
env.expect('FT.ALTER', 'idx', 'SCHEMA', 'ADD', 'f2').error()
env.expect('FT.ALTER', 'idx', 'ADD', 'SCHEMA', 'f2', 'TEXT').error()
env.expect('FT.ALTER', 'idx', 'f2', 'TEXT').error()

def testAlterValidation(env):
# Test that constraints for ALTER comand
Expand Down

0 comments on commit 97f9d94

Please sign in to comment.