What does bundle exec rake db:migrate mean? Or just bundle exec rake <command> in general?
I understand that bundle takes care of maintaining things in the Gemfile. I know what the word “exec” means. I understand that rake maintains all the different scripty things you can do, and I know that db:migrate is one of those. I just don’t know what all these words are doing together. Why should bundle be used to execute rake to execute a database migrate?
bundle execis a Bundler command to execute a script in the context of the current bundle (the one from your directory’s Gemfile).rake db:migrateis the script where db is the namespace and migrate is the task name defined.So
bundle exec rake db:migrateexecutes the rake script with the commanddb:migratein the context of the current bundle.As to the “why?” I’ll quote from the bundler page: