cleanerversion
cleanerversion copied to clipboard
Not possible to create Multi-Table Inheritance schemas using Versionable
Multi-table inheritance ( https://docs.djangoproject.com/en/1.7/topics/db/models/#multiple-inheritance ) with Versionable is not possible.
Just to make it clear, multi-table inheritance is when you don't declare abstract=True in your superclasses, and results in multiple tables being created (for the example below, adding a Spaceship object would create an entry in an appname_spaceship table, as well as a record in appname_vehicule, and these two tables would be linked with a foreign key.
For example, this code
class Vehicule(Versionable):
name = models.CharField(max_length=80)
make_year = models.IntegerField()
class Spaceship(Vehicule):
wormhole_ready = models.BooleanField(default=False)
fails with
django.db.utils.ProgrammingError: column "id" named in key does not exist'
(Django 1.7)
I'm not super motivated to try to fix this issue, because I've never used the multi-table inheritance feature, and I've seen it's use discouraged.
I just wanted to point out that it doesn't work. Perhaps if someone one day has a need for it they will make it work.
The docs mention that it won't work when using the Versionable on the parent class. So I wonder if multi-table inheritance will work when using Versionable on, all of, the child classes?