| 1 | | Hmm, looks like this has to do with the use of django polymorphic. Somehow the foreign keys here are not getting updated. |
| | 1 | Hmm, looks like this has to do with the use of django polymorphic. |
| | 2 | |
| | 3 | Somehow the foreign keys here are not getting updated. |
| | 4 | {{{ |
| | 5 | class JuntagricoBasePoly(PolymorphicModel): |
| | 6 | |
| | 7 | class Meta: |
| | 8 | abstract = True |
| | 9 | |
| | 10 | class Billable(JuntagricoBasePoly): |
| | 11 | ... |
| | 12 | |
| | 13 | class Subscription(Billable, SimpleStateModel): |
| | 14 | ... |
| | 15 | |
| | 16 | class SubscriptionMembership(JuntagricoBaseModel): |
| | 17 | member = models.ForeignKey('Member', on_delete=models.CASCADE) |
| | 18 | subscription = models.ForeignKey('Subscription', db_constraint=False, on_delete=models.CASCADE) |
| | 19 | ... |
| | 20 | }}} |
| | 21 | |
| | 22 | Error received when running migration |
| | 23 | {{{ |
| | 24 | MySQLdb._exceptions.OperationalError: (1833, "Cannot change column 'billable_ptr_id': used in a foreign key constraint 'juntagrico_subscript_subscription_id_1f724c85_fk_juntagric' of table 'juntagrico.juntagrico_subscriptionmembership'") |
| | 25 | }}} |
| | 26 | |
| | 27 | }}} |