简体   繁体   English

在python中如何从更新的peewee模式更新psql表列

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

I have a tabe in psql database with following property: 我在psql数据库中具有以下属性:

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. 我正在使用Peewee的迁移,但是没有更新列的内容。

You're right, there is no API in Schema Migrations for modifying a column's type. 没错, 架构迁移中没有用于修改列类型的API。 But from ArrayField , I'd say the default is already IntegerField , so no change here. 但是从ArrayField ,我想说的是默认值已经是IntegerField ,所以这里没有变化。

This leaves index = True as the only change, which is covered by add_index . 剩下的唯一更改就是index = True ,这由add_index覆盖。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM