I am currently deploying my django application to Heroku and I keep getting an error when migrating my database table to the Postgresql database.
I get the following error: django.db.utils.ProgrammingError: multiple default values specified for column "id" of table "planning_location"
I already tried the solution specified in this post: django.db.utils.ProgrammingError: multiple default values specified for column "_id" of table "Asset_movie". However, that didn't solve it unfortunately..
This is the structure of the planning_location model:
class Location(models.Model):
name = models.CharField(primary_key=True,max_length=200, unique=True)
locationid = models.UUIDField(default=uuid.uuid4, editable=False)
slug = models.SlugField(max_length=200, editable=False)
description = models.TextField(blank=True, null=True)
created_date = models.DateTimeField(auto_now_add=True)
def save(self, *args, **kwargs): # create slug from name when saving for the first time
if not self.slug:
self.slug = slugify(self.name)
super(Location, self).save(*args, **kwargs)
The name is the primary key, which is essential for another part of the application. Since I do not have another id field I created an UUID field which serves kind of as a second id, without being a primary key.
Does anybody know why this does not work, and what can be changed to make it succeed?