I'm trying out Fixtures and South for the first time, so hopefully this is something easy.
I had a functioning database that I dumped as json with the dumpdata
command. I put that in my initial_data.json
file, set up the fixtures directory, and went on my way. In the mean time, I'd also set up my initial south migration, but I'm not sure if that has an impact here. I decided I wanted to test it out, so I dropped my database entirely and ran manage.py syncdb
to see if it would load properly. Upon that happening, A large chunk of the tables in my database did not get created and syncdb threw an error:
> django.db.utils.ProgrammingError: Problem installing fixture
> '/Users/jim/dev/testapp/testing/fixtures/initial_data.json': Could not
> load booker.Position(pk=1): (1146, "Table 'testing.booker_position'
> doesn't exist")
What's going on here? Why is the fixture stopping my tables from getting created, and why isn't this working?
If you DROP DATABASE
, but then still have South Migrations in your App / Project, then you are going to get errors because the history of your database changes are in the migrations.
The best way if you wish to reload your tables is to delete the database migrations (the South Migration folder in each App), and then re- syncdb
and do the initial schemamigration
again with South
.