Added a migration with South... Ran it.
---
Running migrations for news:
- Migrating forwards to 0002_add_slug.
> news: 0002_add_slug
Traceback (most recent call last):
File "/home/tezro/lib/python2.5/South-0.6.2-py2.5.egg/south/
migration.py", line 330, in run_migrations
db.execute_deferred_sql()
File "/home/tezro/lib/python2.5/South-0.6.2-py2.5.egg/south/db/
generic.py", line 120, in execute_deferred_sql
self.execute(sql)
File "/home/tezro/lib/python2.5/South-0.6.2-py2.5.egg/south/db/
generic.py", line 86, in execute
cursor.execute(sql, params)
File "/home/tezro/apps/apache_django/lib/python2.5/django/db/
backends/mysql/base.py", line 84, in execute
return self.cursor.execute(query, args)
File "/usr/local/lib/python2.5/site-packages/MySQLdb/cursors.py",
line 166, in execute
self.errorhandler(self, exc, value)
File "/usr/local/lib/python2.5/site-packages/MySQLdb/
connections.py", line 35, in defaulterrorhandler
raise errorclass, errorvalue
OperationalError: (1061, "Duplicate key name 'news_element_slug'")
---
By the way, there was no slug field in the base. I made it the initial
way, just like I've never changed anything.
On Dec 12, 3:25 am, Shawn Milochik <[email protected]> wrote:
> Why did you manually add a 'slug' field to your database after modifying the
> model? Django's syncdb does a lot more than just create the field; depending
> on which database you're using, it does a few other things and overrides some
> defaults. I wonder if there's a disconnect there. If this project is
> currently in production and you can't re-run syncdb, then I highly recommend
> South (south.aeracode.org) for database migrations.
>
> I suspect that the problem is because the field was added manually. Try
> adding the field with South. It takes care of the nitty gritty details for
> you.
>
> Worst-case, make a copy of the model in question with a different name. Then
> try to create new instances of it from your external script. If that works
> (after adding that new model to the database with syncdb), then it's almost
> definitely due to the way the model and database were modified after-the-fact
> manually.
>
> Shawn
--
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.