I have alter my model from arrayfield to json field now i am receiving error
cannot cast type character varying[] to jsonb LINE 1: ...LUMN "questionaires" TYPE jsonb USING "questionaires"::jsonb.
How to fix this ? and how it did occur?
from
questionaires = ArrayField(models.CharField(max_length=4000), null=True, blank=True)
to
questionaires = JSONField(null = True,blank = True)
I think you have to perform multiple stage migrates:
More advance: refer to this https://stackoverflow.com/a/21997589/533738
Not tested!!!
ALTER TABLE <Your Table>
ALTER COLUMN questionaires TYPE JSONB
USING translate(questionaires::text, '{}','[]')::JSONB;