Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 498
Noah Clark Avatar asked Jan 24 '26 10:01

Noah Clark


1 Answers

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
like image 130
Frans Avatar answered Jan 26 '26 03:01

Frans



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!