Hey there! I've looked around online and haven't been able to find a solution, but apologies if this question has been asked before.
I am trying to create an index on a jsonb column similar to the raw query:
CREATE INDEX idx ON table((jb_column::text));
where jb_column is the jsonb field.
I'm running into issues applying the index using the model class. I've tried mytable.add_index(SQL(CREATE INDEX idx ...)). While this does create the desired index, when I try to reset my database using the built-in model.delete().execute() functionality it fails to delete this index.
Therefore, I've also tried creating the index using more built-in peewee functionality. I have attempted:
idx = (mytable.index(
mytable.jb_column.cast('text')))
mytable.add_index(idx)
However, this does not create the desired index. Any advice?
Thank you :)