简体   繁体   中英

Ruby on Rails migrations run, schema.rb updated but changes not reflecting in psql database

I have a ruby on rails application already running in production. The database has records which I do not want to loose. I had to add and run new migrations to add some new columns to existing tables. The migrations run successfully and the schema.rb file reflects the changes but the changes do not appear in the database or existing table structure.

Based on research online, rake db:schema:load updates the db based on the schema.rb file. But this resets the database.

It is crucial that I do not loose the data in the tables.Is there any way to solve this? I am fairly new to ruby on rails.

I was able to fix it. I checked the status of migrations in the production environment rake db:migrate:status RAILS_ENV=production and realised they were down. I then run rake db:migrate RAILS_ENV=production and that did it. Changes now reflect in the db. Thanks @muistooshort for the nudge in the right direction

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM