I just inherited a codebase for a client project and I'm a junior dev. I got my dev environment up and wanted to fill it with sample data. The previous dev left a file in lib/tasks/sample_data.rake It says:
namespace :db do
desc "Fill database with sample data"
task populate: :environment do
and then the sample data.
I ran bundle exec rake db:populate but didn't give it an environment argument. I now have the sample data on my local :-) but I'm worried that I may have somehow also overridden the production database? It's deployed on heroku. We have the pg gem in the gemfile for production, and sqlite3 for dev. The database.yml file still says
production:
adapter: sqlite3
database: db/production.sqlite3
pool: 5
timeout: 5000
but the heroku build log says: Writing config/database.yml to read from DATABASE_URL so I'm guessing that's how it knows to use postgres? But I don't really understand it.
Currently, the deployed site looks fine, but I'm worried that if I push anything to Heroku and do a new build it will overwrite it. Does anyone know if I'm ok or if I need to fix things?
Thank you so much!
You're fine. Heroku uses an automatically generated database.yml. In order for that task to affect your production deployment you would have to run heroku run rake db:populate
.