简体   繁体   中英

How to copy data in development db to product db using sqlite

I am using sqlite for both (for now) my development and production system on rails. I have a development.sqlite3 file that I want to copy over to production.sqlite3 to run some testing in a production environment.

I've tried to copy the development db over to the production just by doing mv development.sqlite3 production.sqlite3 and that doesn't seem to be working.

Any ideas on how best to go about doing this?

According to this question the following code does it.

RAILS_ENV=production rake db:create db:schema:load

This empties out the current production.sqlite3 . After the database creation and loading of the structure you can copy the development.sqlite3 to production.sqlite3 to copy your data.

cp db/development.sqlite3 db/production.sqlite3

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