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
