403Webshell
Server IP : 172.67.158.161  /  Your IP : 3.15.1.180
Web Server : LiteSpeed
System : Linux business53.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64
User : giankuin ( 1871)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /proc/self/root/opt/imunify360/venv/lib64/python3.11/site-packages/defence360agent/migrations/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /proc/self/root/opt/imunify360/venv/lib64/python3.11/site-packages/defence360agent/migrations//186_add_user_field_to_icontact_throttle.py
from peewee import CompositeKey, Model, CharField, IntegerField


def migrate(migrator, *_, fake=False, **__):
    if fake:
        return

    icontact_throttle = migrator.orm["icontact_throttle"]

    class TmpIContactThrottle(Model):
        class Meta:
            db_table = "tmp_icontact_throttle"
            primary_key = CompositeKey("message_type", "user")

        message_type = CharField()
        user = CharField(null=True)
        timestamp = IntegerField(default=0)

    migrator.add_fields(
        icontact_throttle,
        user=CharField(null=True),
    )

    # change the primary key
    migrator.create_model(TmpIContactThrottle)
    migrator.sql(
        "INSERT INTO tmp_icontact_throttle (message_type, user, timestamp) "
        "SELECT message_type, user, timestamp FROM icontact_throttle"
    )
    migrator.sql("DROP TABLE icontact_throttle")
    migrator.sql(
        "ALTER TABLE tmp_icontact_throttle RENAME TO icontact_throttle",
    )


def rollback(migrator, *_, fake=False, **__):
    if fake:
        return

    class TmpIContactThrottle(Model):
        class Meta:
            db_table = "icontact_throttle"

        message_type = CharField(primary_key=True)
        timestamp = IntegerField(default=0)

    migrator.create_model(TmpIContactThrottle)
    migrator.sql(
        "INSERT INTO tmp_icontact_throttle (message_type, timestamp) "
        "SELECT message_type, timestamp FROM icontact_throttle"
    )
    migrator.sql("DROP TABLE icontact_throttle")
    migrator.sql(
        "ALTER TABLE tmp_icontact_throttle RENAME TO icontact_throttle",
    )

Youez - 2016 - github.com/yon3zu
LinuXploit