[LRUG] Migrating SQLlite to MySQL

Jocke Selin jocke at selincite.com
Mon Nov 16 05:15:37 PST 2009


On 16 Nov 2009, at 13:06, Matthew Rudy Jacobs wrote:
> I assume what you want to do is;
> 	• tag your current code with the database.yml pointing to sqlite
> 	• make the necessary changes to point to your mysql instance
> 	• tag this version of the code
> 	• put up a maintenance page (make apache or nginx return 503 status code, and say "please be patient. we're busy making blahblah.com better. see you in a moment" - capistrano can do most of this for you)
> 	• dump your sqlite database ("sqlite3 db/production.sqlite3 '.dump' > dbdump.sql")
> 	• load this into your mysql ("mysql my_database_production < dbdump.sql")
> 	• now redeploy your code with the mysql tag of your code
> 	• restart your server
> 	• take down the maintenance page.


And naturally, script it, even with a simple bash script, so that you can run it again, and again, and again should you need to. But also so you can test it on one non-live-machine, then run it on the live machine. Then keep the script so you don't have to remember what to do the next time this sort of thing comes up again. :)

Good luck!

/Jocke


More information about the Chat mailing list