Open Sefriol opened 2 years ago
@Gabriel-403 @Zxilly @kingiw @nodece
Possible solutions to use: https://github.com/balmasi/migrate-mongoose https://github.com/seppevs/migrate-mongo
hey, @Sefriol I have some idea with migrate-mongo but how is it going to be a feature of the adapter? I am a little confused.
Adapter needs to identify that database schema is old and needs to be updated before use. migrate-mongo
would take care of the update and then adapter would work as expected.
I think in this particular case it would just update (up()
) all documents with p_type
to ptype
and possibility to downgrade (down()
), converting all documents back to p_type
. This should be quite reliable with MongoDB transactions.
Following up the discussion had here, mongoose adapter needs a way to adapt possible schema changes to ensure that previous users of the adapter have a possibility reliable and documented way to upgrade to a new version.
This requires some thinking and design. However the bare minimum should involve: