관리-도구
편집 파일: 151_change_constraint_for_iplist.py
import peewee as pw def migrate(migrator, database, fake=False, **kwargs): orm_IPList = migrator.orm["iplist"] IP_LISTS = ("WHITE", "BLACK", "GRAY", "GRAY_SPLASHSCREEN") migrator.change_fields( orm_IPList, listname=pw.CharField( null=False, constraints=[ pw.Check("listname in ('{}')".format("','".join(IP_LISTS))) ], ), ) def rollback(migrator, database, fake=False, **kwargs): pass