You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey guys, I would like to be able to automatically create Mongoid indexes on each deploy, like we do with migrations with relational databases.
(I think that it's totally OK to do so, just not to forget to create some new indexes for some new models for example, if I'm wrong please correct me.)
I have wrote some code, based on your code for migrations, it doesn't work locally yet, and I don't really know why, but it's close to something that should work :) Maybe it could be added to this gem, take a look at what I got so far:
namespace:mongoiddodesc'Runs rake db:mongoid:create_indexes'taskcreate_indexes: [:set_rails_env]doonfetch(:mongoid_servers)doinfo'[mongoid:create_indexes] Run `rake db:mongoid:create_indexes`'withinrelease_pathdowithrails_env: fetch(:rails_env)doexecute:rake,'db:mongoid:create_indexes'endendendendafter'deploy:updated','mongoid:create_indexes'endnamespace:loaddotask:defaultsdoset:mongoid_role,fetch(:mongoid_role,:db)set:mongoid_servers,->{primary(fetch(:mongoid_role))}endend
The text was updated successfully, but these errors were encountered:
Hey guys, I would like to be able to automatically create Mongoid indexes on each deploy, like we do with migrations with relational databases.
(I think that it's totally OK to do so, just not to forget to create some new indexes for some new models for example, if I'm wrong please correct me.)
I have wrote some code, based on your code for migrations, it doesn't work locally yet, and I don't really know why, but it's close to something that should work :) Maybe it could be added to this gem, take a look at what I got so far:
The text was updated successfully, but these errors were encountered: