I have a model class that inherits from two abstract models:
# vehicles app
class Car(
PolymorphicModel,
BaseSyncModel,
):
"""Car parent model."""
id: models.UUIDField = models.UUIDField( # noqa: A003
primary_key=True, default=uuid.uuid4
)
store: models.ForeignKey = models.ForeignKey(
CarStores, on_delete=models.CASCADE
)
price: models.IntegerField = models.IntegerField()
year: models.IntegerField = models.IntegerField(
validators=[MinValueValidator(1900), MaxValueValidator(2021)],
)
brand = models.TextField("Car's brand")
It inherits from the PolymorphicModel and from a class to make sync, it is like that:
class BaseSyncModel(models.Model):
updated_at = models.DateTimeField(auto_now=True, editable=False)
class Meta:
abstract = True
My problem is, when I pushed it to GitHub, the CI raised the following error:
django.db.utils.ProgrammingError: column "updated_at" of relation "vehicles_car" does not exist
I think it is related to the multiple inheritances because the other classes that don't inherit from PolymorphicModel didn't raise the same error.
I have no idea how to proceed with that.
EDIT - adding the migrations file
I've done the migrations
# Generated by Django 2.2.24 on 2021-07-25 12:53
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('vehicles', '0010_vehicles_context'),
]
operations = [
migrations.AddField(
model_name='motorcycles',
name='updated_at',
field=models.DateTimeField(auto_now=True),
),
migrations.AddField(
model_name='car',
name='updated_at',
field=models.DateTimeField(auto_now=True),
),
]
EDIT 2 - Polymorphic model
Here is the link to the polymorphic model on github
EDIT 3 - There is no relation with the polymorphic model
I've removed the Inheritance from the Car model and let it only on the motorcycle model and it raised the same error, but for the motorcycle model:
django.db.utils.ProgrammingError: column "updated_at" of relation "vehicles_motorcycles" does not exist