Joe Van Dyk <joevandyk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> I''ve decided to use sqlite3 to power my rails app. But
I''m having
> difficulities trying to figure out how I should perform upgrades on
> the database once the site goes live.
>
> A minute or two of downtime is no big deal and the database
doesn''t
> have inserts or updates all that often. But what if inserts and
> updates happened a lot, or uptime was crucial? What are good
> strategies to use for performing database upgrades?
1. Make a copy of your application and the database file.
2. Change the database schema and you application in the copy.
When you''re happy with the changes:
3. Write a program that transfers data from the old schema to the new one.
4. Prepare your new app for deployment, empty the affected database tables(s).
5. Turn your web server off, switch over to the new app & database.
6. Run the program from step 3.
7. Turn your web server back on, running the new app & database.
In other words, make changes to a development/staging version of both
application and database, then switch over when ready.
Greg Jorgensen
PDXperts LLC
Portland, Oregon, USA