Hey all,
I've ported my schema evolution work from my SoC project last summer to
Django v0.96. To use it, download the patch below, and run the following:
$ cd /<path_to_python_dir>/site-packages/django/
$ patch -p1 < ~/<download_dir>/django_schema_evolution-v096patch.txt
It should output the following:
patching file core/management.py
patching file db/backends/mysql/base.py
patching file db/backends/mysql/introspection.py
patching file db/backends/postgresql/base.py
patching file db/backends/postgresql/introspection.py
patching file db/backends/sqlite3/base.py
patching file db/backends/sqlite3/introspection.py
patching file db/models/fields/__init__.py
patching file db/models/options.py
To use it:
$ cd /<path_to_project_dir>/
$ ./manage.py sqlevolve <app_name>
It should output something like this:
BEGIN;
ALTER TABLE `main_query` CHANGE COLUMN `accuracy` `accuracynew`
numeric(10, 6) NULL;
ALTER TABLE `main_query` ADD COLUMN `price` varchar(256) NULL;
COMMIT;
Assuming you have a model such as this:
class Query(models.Model):
query = models.CharField(maxlength=256, blank=False)
accuracynew = models.FloatField(max_digits=10, decimal_places=6,
null=True, blank=True, aka='accuracy')
price = models.CharField(maxlength=256, null=True, blank=True) #
new column
Note the aka field where I changed the name of "accuracy" to "accuracynew".
Let me know if you find any bugs.
http://kered.org/blog/2007-07-19/django-schema-evolution/
http://kered.org/blog/wp-content/uploads/2007/07/django_schema_evolution-v096patch.txt
-- Derek
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---