Rails, how to migrate data from development sqlite3 database to production MySQL database?

前端 未结 2 782
暗喜
暗喜 2021-01-31 22:58

With Rails, how do you migrate data from development sqlite3 database to production MySQL database?

How to make it easier?

2条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-31 23:53

    Assuming your database configurations are properly set up in config/database.yml, the following should get the database structure set up in production for you.

    Runs against development database by default:

    rake db:schema:dump
    

    Run this against your production database by virtue of the RAILS_ENV environment variable:

    rake RAILS_ENV=production db:schema:load
    

提交回复
热议问题