#15926 closed New feature (fixed)
Option to not load initial fixtures during syncdb
Reported by: | msiedlarek | Owned by: | msiedlarek |
---|---|---|---|
Component: | Core (Management commands) | Version: | dev |
Severity: | Normal | Keywords: | management syncdb options fixtures |
Cc: | msiedlarek, albrecht.andi@…, Jonathan Paugh | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | yes | Patch needs improvement: | yes |
Easy pickings: | yes | UI/UX: | no |
Description
There are some situation in which you may want to prevent automatic loading of initial fixtures by syncdb
management command. One example is when you want to create a database schema and fill it with data from the other database. If there were initial fixtures loaded in both databases there probably would be some primary key conflicts raised.
There is a stealth option for that, called load_initial_data
, and used by testing setup, by I believe it's not fair to take away from user such a useful one.
Attachments (5)
Change History (20)
by , 14 years ago
Attachment: | ticket15926.patch added |
---|
comment:1 by , 14 years ago
Has patch: | set |
---|
comment:2 by , 14 years ago
Needs documentation: | set |
---|---|
Needs tests: | set |
Triage Stage: | Unreviewed → Design decision needed |
Why not, but it sounds like you're misusing the initial_data fixtures.
In my understanding, they exist for data that will always be in your database and will not change. For example, you have some fixed categories used by M2M fields in other models, so you create a model for them and hardcode the list in a fixture.
comment:3 by , 14 years ago
I see your point, but as I said -- when you're using django-admin fixtures and syncdb everything should be ok, but when using some Django-independent database management utilities existence of initial data in freshly created database schema can cost you some trouble. In fact -- I'm facing this problem right now. Besides -- this is nice, simple feature which doesn't complicate anything that much.
comment:5 by , 13 years ago
Cc: | added |
---|---|
UI/UX: | unset |
comment:6 by , 13 years ago
Easy pickings: | set |
---|---|
Triage Stage: | Design decision needed → Accepted |
comment:8 by , 13 years ago
Patch needs improvement: | set |
---|
What about the flush command? This change should be included there, too. I'm marking the patch as 'needs improvement.' By the way, I think this feature can be very useful, for development anyway. Whenever I change my models and need to resync, I often want to quickly verify the model without having to update my initial data---sometimes this is necessary anyway, but not always.
by , 13 years ago
Attachment: | ticket15926-with-flush.patch added |
---|
Reincarnation of patch supporting the flush command as well
comment:9 by , 13 years ago
Cc: | added |
---|---|
Needs documentation: | unset |
Patch needs improvement: | unset |
I think with the new patch and the documentation patch, this is ready for review by a core dev. Sorry for stealing your thunder, msiedlarek.
comment:10 by , 13 years ago
Version: | 1.3 → SVN |
---|
I made my patches against the SVN (git) tip, so I changed the version. I'm guessing that's the protocol.
comment:11 by , 13 years ago
Patch needs improvement: | set |
---|
Could you:
- consolidate all the changes in a single diff file?
- ensure you're indenting consistently with the surrounding code?
Also, this still needs tests.
comment:12 by , 13 years ago
I've consolidated the three pathes into one and are now up-todate with the current head. There is another patch which contains tests.
by , 13 years ago
Attachment: | 15926.patch added |
---|
by , 13 years ago
Attachment: | 15926_test.patch added |
---|
comment:13 by , 13 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Patch