Reputation: 4515
I have two model classes Base and Derived (inherits from Base) and Base is abstract. Now I realize Base should be concrete. How can I create migrations that do the switch for me?
The main problem for me currently is the base_ptr_id column needed in the Derived table, which is a primary key. This column must be added and receive the correct values pointing to the corresponding rows in table Base. Currently I am doing these migration operations:
Currently the process fails at step 3. It looks like Django nevertheless creates a primary key column base_ptr_id, which fails because the existing rows would have the same default value.
So what can I do?
Upvotes: 2
Views: 418
Reputation: 4515
Going further I came up with the following solution:
This way it seems to work.
Upvotes: 4