Code

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#9348 closed (duplicate)

manage.py reset appname fails to reset MySql database because of foreign key constraints

Reported by: jfenwick Owned by: nobody
Component: Core (Management commands) Version: 1.0
Severity: Keywords: mysql reset
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

I'm running the latest Django from SVN on Windows XP using MySQL as the database.

When I try to reset the database the following happens:

C:\projects\django\foo>python manage.py reset fooapp

You have requested a database reset.
This will IRREVERSIBLY DESTROY any data for
the "fooapp" application in the database "foo".
Are you sure you want to do this?

Type 'yes' to continue, or 'no' to cancel: yes
Error: Error: weather couldn't be reset. Possible reasons:
  * The database isn't running or isn't configured correctly.
  * At least one of the database tables doesn't exist.
  * The SQL was invalid.
Hint: Look at the output of 'django-admin.py sqlreset fooapp'. That's the SQL t
his command wasn't able to run.
The full error: (1217, 'Cannot delete or update a parent row: a foreign key cons
traint fails')

If I run manage.py sqlreset fooapp and copy the generated SQL into the MySQL command line the tables are recreated correctly.

Attachments (0)

Change History (3)

comment:1 Changed 6 years ago by jfenwick

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

Disregard my comment about the SQL statements working when I pasted them directly into MySQL, they still didn't work.

comment:2 Changed 6 years ago by russellm

  • Resolution set to duplicate
  • Status changed from new to closed

Essentially a duplicate of [2493]

comment:3 Changed 6 years ago by micsco

Err russel means #2493 not [2493]

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.