Thanks for the help,
-Chad
In the meantime, just use the loaddata command on the initial_data if
you want to update it, that's all syncdb/migrate calls.
Andrew
Another related thing we ran into is using South to do data
migrations.
We had a 0001_initial and 0002 was referencing data that gets loaded
with an initial_data fixture. In development everything went fine.
When we made it to our staging machine 0002 failed because
initial_data doesn't get loaded until the end of the migration (in our
case I think we had 4 or so to do).
Our workaround was to add a management call_command('loaddata', ...)
to get our fixture in there as the first thing that 0002 forward()
does. Kinda hacky but got us out of the bind.
At first, I was thinking that any 0001 initial migration could just be
followed by a loaddata initial_data for that app. But this won't
work, initial_data may be serialized in a format that is compatible
with migration 0008 or something. In other words, it may not match
the schema right after 0001 runs.
This one seems really tricky. Anyone have any ideas?
Rob
Basically, you should move to calling loaddata (as you did there) from
inside a migration, on a known fixture file (you might want to name them
after the migration). That way, things will always get loaded at the
right point.
If you then want to add things in future, you can add in a new migration
and fixture file (the old one will get overwritten if needed - if you
want to delete things, do it from inside the same migration using the ORM).
Andrew
Andrew
Well, it has the caveat that you're then not testing against a
production-like setup - you won't catch any schema errors in the
migrations. If you have other tests to catch that, though, running one
test suite without migrations seems fair.
Andrew