Ticket #427 (closed defect: fixed)
Fixtures not always loaded
| Reported by: | matt@… | Owned by: | andrew |
|---|---|---|---|
| Priority: | minor | Milestone: | 0.7.1 |
| Component: | migrations | Version: | 0.7 |
| Keywords: | Cc: |
Description
If an initial_data fixture exists for an app, then this will be loaded, but only if migrations are run for this app.
However, there is one situation where migrations for this app are run, but the fixture is not loaded: when the migration(s) are all 'used' as depends_on migrations. When this app comes to run its migration, it reports there is nothing to migrate, and no fixtures are loaded.
A workaround is to have a fake migration that does nothing, just so the fixtures will be loaded.
Attachments
Change History
comment:2 Changed 3 years ago by andrew
- Status changed from new to closed
- Resolution set to fixed
- Milestone set to 0.7.1
Actually, what I've done is replicate the syncdb behaviour of django - whenever you run syncdb, the initial data is loaded, so South will do the same, but for migrations. This solves your problem as when the app is reached to migrate, even though there's nothing, it's still recent, so initial data is loaded.
Closing for commit [ab027396dc98].

Perhaps the migration runner can notice if the last migration in an app is run as a dependency, and install fixtures if that is the case.