Opened 9 years ago

Closed 9 years ago

#1031 closed enhancement (worksforme)

Add some notes so mysql users can use ForeignKey fields

Reported by: chmod Owned by: jacob
Component: Documentation Version:
Severity: major Keywords: mysql innodb foreignkey
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

ForeignKey fields will not work on 4.0.x version of mysql unless the default the table engine is InnoDB. And mysql will
silently let django-admin's create table queries run. You just won't get any nice relational methods in your app.

This causes the Poll, Choice example to make polls and choices fine, however, a Poll doesn't have the methods add_choice(),
get_choice(), etc...

Please add a note to the following page that explains to MySQL users that their default table type must be Innodb for ForeignKeys
to work properly.

Also can I just beg that we somehow have an option to django-admin or the meta.Model class that explicitly sets the engine type?
After all, explicit is better than implicit :)

http://www.djangoproject.com/documentation/model_api/

Change History (3)

comment:1 Changed 9 years ago by eugene@…

I ran my app for months with MyISAM (the default engine of MySQL) with plenty of ForeignKeys in models. Are you sure it's not your setup problem?

comment:2 Changed 9 years ago by ubernostrum

Ditto Eugene's comment; I've used Django with MySQL 4.x versions and MyISAM tables on a couple different servers, and it's worked fine, including the poll app as written up in the tutorial.

comment:3 Changed 9 years ago by adrian

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

Looks like this isn't a problem, judging from the comments.

Note: See TracTickets for help on using tickets.
Back to Top