Code

Opened 5 years ago

Closed 5 years ago

Last modified 3 years ago

#10713 closed (duplicate)

Problem extending a model with ManyToMany field

Reported by: jjgod Owned by: nobody
Component: Core (Other) Version: master
Severity: Keywords: manytomany
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Currently, syncdb command will only create ManyToMany tables for a field if the model that field belongs to are newly created. For example, if I first have:

class A(models.Model):
      foo = ...

Then I run python manage.py syncdb, it will create a table for A model.

Then I add a new field to this model, say:

class B(models.Model):
    ...

class A(models.Model):
      foo = ...
      bar = models.ManyToManyField(B)

Then I run python manage.py syncdb again, it won't create the needed ManyToMany table for me, the only way to have this table created is to drop the previously created table for A first, then let syncdb to create them for me again. I think it is inconvenient and need to be fixed.

Attachments (0)

Change History (2)

comment:1 Changed 5 years ago by Alex

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to duplicate
  • Status changed from new to closed

There's another ticket for schema migration somewhere, but long story short, this has been discussed 101 times, schema evolution will come to Djanog eventually, for now use an external project.

comment:2 Changed 3 years ago by jacob

  • milestone 1.1 deleted

Milestone 1.1 deleted

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.