Alexandre Forget wrote: > I wonder what people are using *right now* to evolve their data ? > > I'm using this: > > # create a fixture with all data in the current db > python manage.py dumpdata --indent=4 > initial_data.json > > # delete de database > rm db.sqlite > > # edit the model > > # recreate db and reload data > manage syncdb --noinput > > I know this is really rough... that's why I'm wondering if there any > better solution. > > > alex
Presumably, you're talking about a development database here? I usually develop with SQLite and create a script which populates the database with data using the ORM, then when I've changed the structure and updated the data script, I do something like: del database.db manage.py syncdb --noinput create-test-data.py For production data, I use ALTER TABLE (SQLite's shortcomings here are one of the reasons I would never use it for a production application). Here's a sample from a file named 1.1-1.2.sql for one of my applications which is in production on an intranet: # Existing table updates for version 1.2 # This script should be executed after the new Title model has been installed by # running 'manage.py syncdb' BEGIN; ALTER TABLE `contacts_contact` ADD COLUMN `title_id` integer NULL REFERENCES `contacts_title` (`id`); CREATE INDEX contacts_contact_title_id ON `contacts_contact` (`title_id`); COMMIT; Jonathan. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---