I have a schema that goes like the following
class Order(models.Model):
order_id = models.AutoField(max_length=120,primary_key=True)
timestamp = models.DateTimeField(auto_now_add=True, auto_now=False)
delivery_address = models.CharField(max_length=200, blank=True)
order_Desc= ArrayField(JSONField(),default=list, null=True);
order_by = models.ForeignKey(User,null=True, blank=True,on_delete=models.CASCADE);
I was initially trying to set a list of JSON objects into the order description columns but was constantly facing an issue column "order_Desc" is of type jsonb[] but expression is of type text[] while model object create. So I tried to convert order_Desc= ArrayField(JSONField(),default=list, null=True); to order_Desc= JSONField(blank =True,null=True) but I get the following error while migrating
django.db.utils.ProgrammingError: cannot cast type jsonb[] to jsonb
LINE 1: ...TER COLUMN "order_Desc" TYPE jsonb USING "order_Desc"::jsonb
I am not sure what to do. I tried reverting back to the old state but somehow I still get the same issue which was weird. I also tried adding a new column to the model of type JSONField keeping the old state as it was but this error never seem to go. Thank for your help in advance.