Server IP : 162.0.209.157 / Your IP : 18.119.19.251 [ Web Server : LiteSpeed System : Linux premium178.web-hosting.com 4.18.0-513.24.1.lve.2.el8.x86_64 #1 SMP Fri May 24 12:42:50 UTC 2024 x86_64 User : balaoqob ( 2395) PHP Version : 8.0.30 Disable Function : NONE Domains : 1 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /opt/imunify360/venv/lib/python3.11/site-packages/defence360agent/migrations/ |
Upload File : |
import logging from time import time import peewee as pw import ipaddress from tempfile import TemporaryFile logger = logging.getLogger(__name__) def migrate(migrator, database, fake=False, **kwargs): """Write your migrations here.""" Country = migrator.orm["country"] class IPListNew(pw.Model): # available list names ip = pw.CharField(null=False) listname = pw.CharField( null=False, constraints=[pw.Check("listname in ('WHITE','BLACK','GRAY')")], ) expiration = pw.IntegerField( default=0, null=True # 0 - never ) # null - the same :( imported_from = pw.CharField(null=True) ctime = pw.IntegerField( null=True, default=lambda: int(time()) # those ) # are OK deep = pw.IntegerField(null=True) comment = pw.CharField(null=True) country = pw.ForeignKeyField(Country, null=True) no_captcha = pw.BooleanField(null=False, default=False) full_access = pw.BooleanField(null=True) auto_whitelisted = pw.BooleanField(null=True, default=False) network_address = pw.IntegerField(null=False) netmask = pw.IntegerField(null=False) version = pw.IntegerField(null=False) class Meta: db_table = "iplist_new" primary_key = pw.CompositeKey( "network_address", "netmask", "version" ) migrator.create_model(IPListNew) def rollback(migrator, database, fake=False, **kwargs): """Write your rollback migrations here.""" pass