【问题标题】:In python how to update psql Table column from updated peewee schema在python中如何从更新的peewee模式更新psql表列
【发布时间】:2016-09-08 01:47:48
【问题描述】:

我在psql 数据库中有一个具有以下属性的标签:

author_ids = ArrayField(null=False)

我想用以下属性更新这个表的列:

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

我正在使用 Peewee 的迁移,但没有更新列。

【问题讨论】:

    标签: python database-migration psql peewee


    【解决方案1】:

    你说得对,Schema Migrations 中没有用于修改列类型的 API。但是从ArrayField,我想说默认已经是IntegerField,所以这里没有改变。

    这使得index = True 成为唯一的变化,它被add_index 覆盖。

    【讨论】:

      猜你喜欢
      • 2012-08-01
      • 2021-06-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-28
      • 2021-10-16
      • 1970-01-01
      相关资源
      最近更新 更多