Search code examples
pythondatabase-migrationpsqlpeewee

In python how to update psql Table column from updated peewee schema


I have a tabe in psql database with following property:

author_ids = ArrayField(null=False)

I want to update this table's column with following property:

author_ids = ArrayField(IntegerField, null=False, index=True)

I am using Peewee's migration but there is nothing for updating columns.


Solution

  • You're right, there is no API in Schema Migrations for modifying a column's type. But from ArrayField, I'd say the default is already IntegerField, so no change here.

    This leaves index = True as the only change, which is covered by add_index.