I’ve never used migrations, and everyone on IRC calls me crazy because
of that. Still have yet to get any real responses as to why I’m crazy
I’m writing a new app now, but I don’t know the whole db schema for
the entire app. Go figure, that’s just how it works. I’ll add a
bunch of tables, edit tables, etc as the app chugs along. Figured
that migrations would be a good way of handling this, compared to
editing a schema file and having to drop and create the database every
time. Migrations are also apparently good for updating production
DBs, where you obviously can’t just drop them.
My question is how to get started then…ideally I’d do everything in
the migrations as opposed to having a SQL create script, because I
don’t want to have to maintain it in two places. Can I do everything
with migrations that I can with SQL, such as create serial columns and
custom sequences in PostgreSQL? How about foreign key constraints?
I’m just unable to find the docs for migrations really, because I’ve
yet to find a lot of info on them. Some stuff in the wiki, but
nothing that answers my questions. They seem to be very popular, but
surely nobody’s using them if they don’t have the ability to handle
things that everyone uses in their databases (auto_incremement in
MySQL, etc). Can anyone answer these questions, or point me to a
source for more info?