Quantcast
Channel: Django-DB-Migrations: cannot ALTER TABLE because it has pending trigger events - Stack Overflow
Viewing all articles
Browse latest Browse all 11

Django-DB-Migrations: cannot ALTER TABLE because it has pending trigger events

$
0
0

I want to remove null=True from a TextField:

-    footer=models.TextField(null=True, blank=True)+    footer=models.TextField(blank=True, default='')

I created a schema migration:

manage.py schemamigration fooapp --auto

Since some footer columns contain NULL I get this error if I run the migration:

django.db.utils.IntegrityError: column "footer" contains null values

I added this to the schema migration:

    for sender in orm['fooapp.EmailSender'].objects.filter(footer=None):        sender.footer=''        sender.save()

Now I get:

django.db.utils.DatabaseError: cannot ALTER TABLE "fooapp_emailsender" because it has pending trigger events

What is wrong?


Viewing all articles
Browse latest Browse all 11

Latest Images

Trending Articles





Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>
<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596344.js" async> </script>