[tx] Test that datom flags are written to SQL store correctly
#274 aberto em 9 de fev. de 2017
Métricas do repositório
- Stars
- (1.661 stars)
- Métricas de merge de PR
- (Métricas PR pendentes)
Description
This is follow-up to #267 and similar to #268. What we want is tests to ensure the datoms table gets the correct index_* flags set, based on the attribute flags. The datoms schema is around https://github.com/mozilla/mentat/blob/42580539b8a58f9d10e5891a22112f8c1b697bff/db/src/db.rs#L56.
To test this, use the existing transact code to transact assertions using some of the bootstrap attributes. Then use raw SQL to query the datoms table, following the examples in https://github.com/mozilla/mentat/blob/42580539b8a58f9d10e5891a22112f8c1b697bff/db/src/debug.rs. (You might add a helper there to produce EDN for the "full" or "raw" datoms, making this a little easier to test, and possibly helping later on when we want to compare other parts of the raw tables.)
The interesting cases are:
- attribute is
:db/index true=> datom hasindex_avet = 1 - attribute is
:db/valueType :db.type/ref=> datom hasindex_vaet = 1 - attribute is
:db/fulltext true=> datom hasindex_fulltext = 1Note: this can't be tested yet, since fulltext datoms aren't yet supported! - attribute is
:db/unique :db.unique/value=> datom hasunique_value = 1
Check the positive and negative cases for each of those, and we're good! This is a pretty good first bug, I think, since there's lots of code similar to this in the tree already.