Modify

Ticket #477 (assigned defect)

Opened 4 years ago

Last modified 4 years ago

Related models from a parent model that has been inherited are not available in migrations

Reported by: KyleMac Owned by: andrew
Priority: major Milestone: 1.0
Component: migrations Version: 0.7.1
Keywords: Cc:

Description

If you migrate a child model then the parent is available on the orm but foreign keys to and from the parent model are not.

This comes into play with data migratons as you can't update related fields from the child model, and there's no way to do it the other way round (i.e. do all children from the parent) because the parent rightly has no idea about the children.

Attachments

Change History

comment:1 Changed 4 years ago by KyleMac

The only way I can think of solving this is to have some kind of --include-model option to pull in models that South can't autodetect.

comment:2 Changed 4 years ago by andrew

  • Status changed from new to assigned
  • Milestone set to 1.0

This actually seems like it might be possible to replicate in the frozen ORM; after all, the same data is available there as in the main ORM (and the parent should be auto-frozen).

comment:4 Changed 4 years ago by KyleMac

My quick solution of this at the time was exactly that; copy and paste the model I needed from a migration in the "core" app into the frozen ORM in the inheriting app.

But now I've run into another problem with this since when the model in the core app is updated, any apps with the copy and pasted frozen orm is not. This leads to things from obvious errors to data just disappearing unless I remember to manually copy and paste the current model.

comment:5 Changed 4 years ago by andrew

  • Status changed from assigned to infoneeded

It seems the solution to this is to just use --freeze other_app on the app that contains the related models - that should include them, if I'm not mistaken?

comment:6 Changed 4 years ago by KyleMac

  • Status changed from infoneeded to assigned

--freeze works and is the solution to this.

View

Add a comment

Modify Ticket

Action
as assigned
Author


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

 
Note: See TracTickets for help on using tickets.