Closed SimonSimCity closed 10 months ago
@SimonSimCity This is good and can be merged after a few things.
unique: true
without index: true
and then you remove unique
or set to false
because it is wrapped in if ('index' in definition || definition.unique === true)
. The conditional logic will probably have to be tweaked a bit.unique
and sparse
, might as well make it work when you remove index
without setting it to false
, right? The correct approach to make it all work might be to loop through the existing indices before the schema loop, and if any don't match their schema, drop them. Then do the current loop through the schema to re-add them.We would also need to be careful that we don't drop existing indices added outside of this package. When adding them to existingIndexes
, you should check first to make sure that index.name
starts with c2_
. Add a test for this, too.
Sorry for it taking soo long time for me to get back to you here ...
I've now rebased it on master
and tried to run the tests, but wasn't able to. The command, stated in the README.md
(npm test:watch
or npm test
) resulted in an error and calling meteor test-packages ./package/indexing/
- which was my next guess, since this is a meteor package - left me without any tests. Can you please help me in getting this going?
@aldeed could you please help me to run the tests?
This fixes #19 and requires #20 to be merged first.
The only downside is, that this script doesn't handle a changed definition from
{ name: 'foo', unique: true }
to{ name: 'foo', unique: false }
. It will not delete the unique index of this property, neither will it re-create the index without uniqueness required.Should I change the cod so it removes such an index?