from time import time _MAX_TIMEOUT = 4294967 def migrate(migrator, database, fake=False, **kwargs): IPListModel = migrator.orm["iplist"] # if expiration more that ipset limit, setting max available expiration IPListModel.update(expiration=_MAX_TIMEOUT).where( (IPListModel.listname == "WHITE") & (IPListModel.expiration - time() > _MAX_TIMEOUT) ).execute() def rollback(migrator, database, fake=False, **kwargs): pass