0

I have situation here, I have a database in production environment, and now I have to add few columns in table and drop 1 table from the database. I ran all the migrations such as rails g migration AddDeskToHelper desk:string and similar for dropping a table.

But now I want to upload this new generated schema into existing database without deleting any data from the database.

I'm searching about it and did not find any accurate answer.

For example, here it says that rake db:schema:load deletes all the data from Database in production environment.

Kindly help me in this case.

Community
  • 1
  • 1
user3290805
  • 445
  • 2
  • 10
  • 28

1 Answers1

1

If you have created the migrations to add some cols in existing tables or delete some tables, the rake db:migrate RAILS_ENV=production command will perform an "ALTER table..." without destroying your data, except you are dropping a col or table with data content.

But it's always recommended to perform a database backup before altering your production database.

Klaus
  • 1,591
  • 1
  • 12
  • 18