Closed craicoverflow closed 4 years ago
Indexes can be passed quite easily on the data layer initialisation ensureIndex
For migration, we can recommend:
https://github.com/awapps/mongration
Dropped investigation as we going to explore options for migrations etc.
CC @ssd71
Indexes can be passed quite easily on the data layer initialisation ensureIndex
Agreed, sounds good
Auto-incrementing IDs
I am not sure autoincrementing primary keys is a good idea in hindsight, as we are using primary keys to both delete and update, wdyt? Other than that, +1 for autoincrementing fields. MongoDB does not have that built-in, In mongoose, it can be achieved by this workaround, although since we do not use hooks etc, some other kind of workaround is required here, I will see what I can dig up.
I found this but like it was last updated 4 years ago not sure it is maintained anymore. I believe it's like mongo driver except with some features like hooks and createdAt, updatedAt(although I believe offix mongo does the latter already). We could always cook up a solution of our own (is that a weird thing to say?)
I will need to do some more research on graphql-migrations
to see what other annotation features we could add
Let me know what you guys think :)
I think this issue was just investigation. There are two things: migrations and indexes. We should do indexes quite easy (for both DB actually) and this can be done in migrations package to the postgress and for Mongo it can be directly in service
Migrations are of lower priority.
Auto-incrementing IDs
Mongo does not need that - it has hash generated id.
It would nice if we could have some migration capabilities mapping a GraphQL schema to a Mongo database (using annotations to customisation migration).
There may already be a library out there so this is to research/investigate.
Things needed: