0

I would like to update max length of django char field of base model and overwrite it in a concrete model that extends from parent, but when i execute migrate command on heroku bash cli appears this error:

django.db.utils.OperationalError: cannot ALTER TABLE "cms_categoria" because it has pending trigger events

Here i leave the change:

Before

class Entidad(models.Model):
  titulo = models.CharField(verbose_name=_("Título"), max_length=100)
  ...

class Categoria(Entidad):
  ...

************

After

class Entidad(models.Model):
  titulo = models.CharField(verbose_name=_("Título"), max_length=30)

class Categoria(Entidad):
  titulo = models.CharField(max_length=20)
  ...

How should I do the update ? Anybody could help me ? Thanks

8
  • 1
    1. make changes in models.py 2. create migration file using makemigration command 3. Push your changes to Heroku 4. Get into the server and migrate the DB using migrate command Commented Sep 23, 2019 at 8:05
  • @JPG that is that I’m doing, but the migarte command on Heroku cli through this error Commented Sep 23, 2019 at 8:08
  • 1
    A bit explaining 2, 3 and 4 in @JPG comment, on your local machine you run python manage.py makemigrations, that will create a migration file, then you push the file to heroku, after that in heroku bash run python manage.py migrate Commented Sep 23, 2019 at 8:10
  • i'm doing that, after all those steps, when i run on heroku cli python mange.py migrate appears the error. Commented Sep 23, 2019 at 8:13
  • Related post, stackoverflow.com/q/12838111/8283848 Commented Sep 23, 2019 at 8:14

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.