乐趣区

关于python:peewee-定义-createdat-和-updatedat

class SearchEngineCheck(Model):
    category = CharField()
    track_source_id = IntegerField()
    keyword = CharField()
    clip_len = IntegerField(null=True)
    has_error = BooleanField(default=False)
    created_at = DateTimeField(
        null=False,
        constraints=[SQL('DEFAULT CURRENT_TIMESTAMP')],
        help_text='应用数据库工夫'
    )
    updated_at = DateTimeField(
        null=False,
        constraints=[SQL('DEFAULT CURRENT_TIMESTAMP'),
            SQL('ON UPDATE CURRENT_TIMESTAMP'),
        ]
    )

    class Meta:
        database = db
        table_name = 'parse_monitoring'
        indexes = (('parsed_at', 'track_source_id'),
        )
退出移动版