Opened 17 years ago

Last modified 16 years ago

#7236 closed

Table containing ForeignKey created with wrong casing — at Initial Version

Reported by: narendra.tumkur@… Owned by: nobody
Component: Database layer (models, ORM) Version: dev
Severity: Keywords: mysql case table name lower_case_table_names
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Here is the models.py:

class Plugin(models.Model):
	name = models.CharField(max_length=50)
	description = models.CharField(max_length=100)

class PluginContainer(models.Model):
	title = models.CharField(max_length=50)
	plugin_settings = models.CharField(max_length=2000)
	plugin = models.ForeignKey(Plugin)

PluginContainer refers to Plugin object (ForeignKey)
Running manage.py syncdb produces the tables:

App_plugin
app_plugincontainer

notice the incorrect casing on app_plugincontainer.
Removing the ForeignKey from PluginContainer correctly creates the table as App_plugincontainer

This is causing a problem with running manage.py syncdb again as it cannot find App_plugincontainer and then tries to create app_plugincontainer and fails as the table already exists.

My environment:
OS: Mac OS X 10.5
DB: MySql 5.05
Python: 2.5
Django: SVN

MySql's lower_case_table_names variable is set to 2 (default on mac os x)

Cheers
Naren

Change History (0)

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