Skip to content

resource_id设置默认值以及唯一索引的原因导致写入失败 #23

Description

@guoxiaod
resource_id = Column('resource_id', String(50), unique=True, default="rg-{}".format(uuid()))

这块设置resource_id默认值后,实际上首次运行生成一个默认值,以后会一直使用这个默认值了,所有的默认值都是这个了。然后唯一索引会导致写入失败。
我们期望的是,每次写入的时候,类似update_time的默认值一样,重新运行uuid函数,但是实际不是。

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions