403Webshell
Server IP : 217.160.0.135  /  Your IP : 216.73.217.85
Web Server : Apache
System : Linux www 6.18.52-i1-ampere #1203 SMP Mon Sep 14 18:29:59 CEST 2026 aarch64
User : sws1074145052 ( 1074145052)
PHP Version : 8.3.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/django/db/migrations/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/django/db/migrations/__pycache__/executor.cpython-311.pyc
�

�|�e�E��l�ddlmZddlmZmZddlmZddlm	Z	ddl
mZddlm
Z
Gd�d	��Zd
S)�)�apps)�
migrations�router�)�InvalidMigrationPlan)�MigrationLoader)�MigrationRecorder)�ProjectStatec�`�eZdZdZdd�Zdd�Zdd�Zdd�Zd�Zd	�Z	dd
�Z
d�Zdd�Zd
�Z
d�ZdS)�MigrationExecutorzu
    End-to-end migration execution - load migrations and run them up or down
    to a specified set of targets.
    Nc��||_t|j��|_t|j��|_||_dS�N)�
connectionr�loaderr	�recorder�progress_callback)�selfrrs   �?/usr/lib/python3/dist-packages/django/db/migrations/executor.py�__init__zMigrationExecutor.__init__s9��$���%�d�o�6�6���)�$�/�:�:��
�!2�����Fc���	�g}|ri}nt|jj��}|D�]��	�	d��|jj���D]{}|d�	dkrg|jj�|��D]G}||vrA|�|jjj|df��|�|���H�|���	|vr�t�	fd�|jjj
�	jD����}|D]i}|jj�|��D]G}||vrA|�|jjj|df��|�|���H�j��M|jj��	��D]L}||vrF|�|jjj|df��|jjj|||<�M���|S)z\
        Given a set of targets, return a list of (Migration instance, backwards?).
        rNrTc3�@�K�|]}|d�dk�|V��dS)rN�)�.0�n�targets  �r�	<genexpr>z3MigrationExecutor.migration_plan.<locals>.<genexpr>/sB�����%�%����t�v�a�y�(�(��(�(�(�(�%�%rF)
�dictr�applied_migrations�graph�
root_nodes�backwards_plan�append�nodes�pop�sorted�node_map�children�
forwards_plan)
r�targets�clean_start�plan�applied�root�	migration�next_in_app�noders
         @r�migration_planz MigrationExecutor.migration_plans1������	;��G�G��4�;�9�:�:�G��	P�	P�F��a�y� � �K�-�8�8�:�:�7�7�D��A�w�&��)�+�+�)-��):�)I�)I�$�)O�)O�7�7�I�(�G�3�3� $���T�[�->�-D�Y�-O�QU�,V� W� W� W� '���I� 6� 6� 6���7��7�"�"�
%�%�%�%�%��K�%�.�v�6�?�%�%�%����
(�3�3�D�%)�[�%6�%E�%E�d�%K�%K�3�3�	�$��/�/� �K�K���):�)@��)K�T�(R�S�S�S�#�K�K�	�2�2�2��3�3�"&��!2�!@�!@��!H�!H�P�P�I� ��/�/����T�[�%6�%<�Y�%G��$O�P�P�P�-1�[�->�-D�Y�-O��	�*��P��rc�6��tt�jj�����}|rn���jj���d���}�fd��jjD��}|D] \}}||vr|�|d����!|S)z�
        Create a project state including all the applications without
        migrations and applied migrations if with_applied_migrations=True.
        )�	real_appsT�r+c�d��h|],}|�jjjv��jjj|��-Sr�rr r$�r�keyrs  �r�	<setcomp>z:MigrationExecutor._create_project_state.<locals>.<setcomp>IsC���"�"�"�14��$�+�+�1�1�1���!�'��,�1�1�1rF��preserve)	r
�listr�unmigrated_appsr2r �
leaf_nodesr�mutate_state)r�with_applied_migrations�state�	full_planrr/�_s`      r�_create_project_statez'MigrationExecutor._create_project_state@s����
�t�D�K�,G�'H�'H�I�I�I��"�		B��+�+�D�K�,=�,H�,H�,J�,J�X\�+�]�]�I�"�"�"�"�8<��8V�"�"�"��!*�
B�
B��	�1�� 2�2�2��*�*�5�5�*�A�A�A���rc�T�|j���|�|�|��}|�|jj���d���}t
d�|D����}t
d�|D����}|s|�|�d���}nc||krtd|���|r3|�|�d���}|�	|||||���}n|�
|||�	��}|���|S)
z�
        Migrate the database up to the given targets.

        Django first needs to create all project states before a migration is
        (un)applied and in a second step run all the database operations.
        NTr5c3�"K�|]
\}}|V��dSrr�r�mig�	backwardss   rrz,MigrationExecutor.migrate.<locals>.<genexpr>bs(����D�D�^�S�)�y�=�D�D�D�D�D�Drc3� K�|]	\}}|V��
dSrrrHs   rrz,MigrationExecutor.migrate.<locals>.<genexpr>cs&����A�A�.�#�y�I�A�A�A�A�A�Ar)rAz�Migration plans with both forwards and backwards migrations are not supported. Please split your migration process into separate plans of only forwards OR backwards migrations.��fake�fake_initial�rM)r�
ensure_schemar2rr r?�allrEr�_migrate_all_forwards�_migrate_all_backwards�check_replacements)	rr*r,rBrMrNrC�all_forwards�
all_backwardss	         r�migratezMigrationExecutor.migrateRsY��	
�
�#�#�%�%�%��<��&�&�w�/�/�D��'�'���(9�(D�(D�(F�(F�TX�'�Y�Y�	��D�D�t�D�D�D�D�D���A�A�D�A�A�A�A�A�
��	L��}��2�2�4�2�P�P���
�]�
*�
*�&�K��	��
��	L��}��2�2�4�2�P�P���.�.�u�d�I�D�_k�.�l�l�E�E��/�/��i�d�/�K�K�E����!�!�!��rc�*�d�|D��}|D]�\}}|sn{||vrvd|jvr?|jr|�d��|j|jr|�d��|�||||���}|�|����|S)z�
        Take a list of 2-tuples of the form (migration instance, False) and
        apply them in the order they occur in the full_plan.
        c��h|]
}|d��S�rr�r�ms  rr:z:MigrationExecutor._migrate_all_forwards.<locals>.<setcomp>����0�0�0�a�Q�q�T�0�0�0rr�render_start�render_successrL)�__dict__rr�apply_migration�remove)	rrBr,rCrMrN�migrations_to_runr/rDs	         rrRz'MigrationExecutor._migrate_all_forwardss���
1�0�4�0�0�0��%�	4�	4�L�I�q�$�
�
���-�-�-����/�/��-�?��.�.�~�>�>�>��J�J��-�A��.�.�/?�@�@�@��,�,�U�I�D�Wc�,�d�d��!�(�(��3�3�3���rc���d�|D��}i}����}�fd��jjD��}�jr��d��|D]j\}}	|snb||vrBd|jvr|j|||<|�|d���}|�|���O||vr|�|d����k�jr��d��|D]8\}}	��||||�	��|�|���9|d
d}
||
}t|��D];\}\}}	||
kr-||d�D] \}}	||vr|�|d����!n�<|S)
a�
        Take a list of 2-tuples of the form (migration instance, True) and
        unapply them in reverse order they occur in the full_plan.

        Since unapplying a migration requires the project state prior to that
        migration, Django will compute the migration states before each of them
        in a first run over the plan and then unapply them in a second run over
        the plan.
        c��h|]
}|d��SrZrr[s  rr:z;MigrationExecutor._migrate_all_backwards.<locals>.<setcomp>�r]rc�d��h|],}|�jjjv��jjj|��-Srr7r8s  �rr:z;MigrationExecutor._migrate_all_backwards.<locals>.<setcomp>�sC���
�
�
�-0��d�k�'�-�-�-�
�K��#�C�(�-�-�-rr^rTr;Fr_rO���rN)
rErrrr`rr@rb�unapply_migration�	enumerate)rr,rCrMrc�statesrBrr/rD�last_unapplied_migration�indexs`           rrSz(MigrationExecutor._migrate_all_backwards�s'���1�0�4�0�0�0�����*�*�,�,��
�
�
�
�48�K�4R�
�
�
���!�	3��"�"�>�2�2�2�%�	>�	>�L�I�q�$�
�
���-�-�-����/�/��J�J�$)��y�!�!�.�.�u�t�.�D�D��!�(�(��3�3�3�3��0�0�0��&�&�u�u�&�=�=�=���!�	5��"�"�#3�4�4�4� �	1�	1�L�I�q��"�"�6�)�#4�i�d�"�K�K�K��%�%�i�0�0�0�0�
$(��8�A�;� ��/�0��%.�y�%9�%9�	�	�!�E�>�I�q��4�4�4�$-�e�f�f�$5�F�F�L�I�q� �$6�6�6�!�.�.�u�u�.�E�E�E����	5��rc���d}|jr|�d||��|s�|r|�||��\}}|rd}|sl|j�|j���5}|�||��}|js|�|��d}ddd��n#1swxYwY|s|�|��|jr|�d||��|S)zRun a migration forwards.F�apply_startT��atomicN�
apply_success)r�detect_soft_appliedr�
schema_editorrp�apply�deferred_sql�record_migration)rrBr/rMrN�migration_recordedr-rss        rraz!MigrationExecutor.apply_migration�sW��"���!�	C��"�"�=�)�T�B�B�B��	2��
 �!%�!9�!9�%��!K�!K����� ��D��
2��_�2�2�)�:J�2�K�K�2�}�%�O�O�E�=�A�A�E�(�5�2��-�-�i�8�8�8�-1�*�	2�2�2�2�2�2�2�2�2�2�2����2�2�2�2�
"�	-��!�!�)�,�,�,��!�	E��"�"�?�I�t�D�D�D��s�$5B%�%B)�,B)c��|jr*|jD] \}}|j�||���!dS|j�|j|j��dSr)�replacesr�record_applied�	app_label�name)rr/r{r|s    rrvz"MigrationExecutor.record_migration�sn����	N�#,�#5�
>�
>��	�4��
�,�,�Y��=�=�=�=�
>�
>�
�M�(�(��)<�i�n�M�M�M�M�Mrc���|jr|�d||��|sN|j�|j���5}|�||��}ddd��n#1swxYwY|jr)|jD] \}}|j�||���!n%|j�|j|j	��|jr|�d||��|S)zRun a migration backwards.�
unapply_startroN�unapply_success)
rrrsrp�unapplyryr�record_unappliedr{r|)rrBr/rMrsr{r|s       rrhz#MigrationExecutor.unapply_migration�sR���!�	E��"�"�?�I�t�D�D�D��	@���.�.�i�6F�.�G�G�
@�=�!�)�)�%��?�?��
@�
@�
@�
@�
@�
@�
@�
@�
@�
@�
@����
@�
@�
@�
@���	P�#,�#5�
@�
@��	�4��
�.�.�y�$�?�?�?�?�
@�
�M�*�*�9�+>�	��O�O�O��!�	G��"�"�#4�i��F�F�F��s�A$�$A(�+A(c����|j����|jj���D]:\}}t�fd�|jD����}|r|�vr|jj|��;dS)a�
        Mark replacement migrations applied if their replaced set all are.

        Do this unconditionally on every migrate, rather than just when
        migrations are applied or unapplied, to correctly handle the case
        when a new squash migration is pushed to a deployment that already had
        all its replaced migrations applied. In this case no new migration will
        be applied, but the applied state of the squashed migration must be
        maintained.
        c3� �K�|]}|�vV��	dSrr)rr\r-s  �rrz7MigrationExecutor.check_replacements.<locals>.<genexpr>s'�����G�G�q�a�7�l�G�G�G�G�G�GrN)rrr�replacements�itemsrQryrz)rr9r/�all_appliedr-s    @rrTz$MigrationExecutor.check_replacementss�����-�2�2�4�4��"�k�6�<�<�>�>�	3�	3�N�C���G�G�G�G�I�4F�G�G�G�G�G�K��
3�s�'�1�1�,��
�,�c�2�2��	3�	3rc�n����fd�}�j�%t�fd��jD����rd|fSn
�jdurd|fS|�)�j��j�jfd���}n��|��}|j}d}d}�j	j
j}�j	���5}	t�j	j�|	����}
|rd�|
D��}
ddd��n#1swxYwY�jD�] }t#|t$j��r�|��j|j��}|jjrt/j|jj��}|�|��r�t|jj}
|r|
���}
|
|
vrd|fcSd}��t#|t$j���rb|��j|j��}|jjrt/j|jj��}|�|��r��|jj}|j�|j��}|jr:|jjjj}|r|���}||
vrd|fcSd}����j	���5}	�j	j� |	|��}ddd��n#1swxYwY|D]D}|j!}|j}|r(|���}|���}||krd}n�Ed|fcS��"|p||fS)z�
        Test whether a migration has been implicitly applied - that the
        tables or columns it would create exist. This is intended only for use
        on initial migrations (as it only looks for CreateModel and AddField).
        c���|jjp=|jjp0tj�jj|j|jj���S)z�
            No need to detect tables for proxy models, unmanaged models, or
            models that can't be migrated on the current database.
            )�
model_name)	�_meta�proxy�managedr�
allow_migrater�aliasr{r�)r/�modelrs  �r�should_skip_detecting_modelzJMigrationExecutor.detect_soft_applied.<locals>.should_skip_detecting_modelsV�����!����)<�%<���$��O�)�9�+>�$�{�5����A�
rNc3�4�K�|]\}}|�jkV��dSr)r{)r�appr|r/s   �rrz8MigrationExecutor.detect_soft_applied.<locals>.<genexpr>.s/�����V�V�)�#�t�3�)�-�-�V�V�V�V�V�VrFT)�at_endc�6�h|]}|�����Sr)�casefold)rr|s  rr:z8MigrationExecutor.detect_soft_applied.<locals>.<setcomp>?s ��'Y�'Y�'Y�D��
�
���'Y�'Y�'Yr)"�initial�any�dependenciesr�
project_stater{r|r@rr�features�ignores_table_name_case�cursor�set�
introspection�table_names�
operations�
isinstancer�CreateModel�	get_modelr��swapped�global_apps�db_tabler��AddFieldr��	get_field�many_to_many�remote_field�through�get_table_description�column)rr�r/r��after_stater�found_create_model_migration�found_add_field_migration�fold_identifier_caser��existing_table_names�	operationr�r��table�field�through_db_table�columnsr��field_column�column_names` `                  rrrz%MigrationExecutor.detect_soft_applieds_����	�	�	�	�	���$��V�V�V�V�y�?U�V�V�V�V�V�
,��m�+�+�
,�
�
�%�
'�
'��-�'�'�� ��+�3�3�Y�5H�)�.�4Y�bf�3�g�g�K�K�#�0�0��?�?�K����',�$�$)�!�#��7�O��
�_�
#�
#�
%�
%�	Z��#&�t��'D�'P�'P�QW�'X�'X�#Y�#Y� �#�
Z�'Y�'Y�DX�'Y�'Y�'Y�$�	Z�	Z�	Z�	Z�	Z�	Z�	Z�	Z�	Z�	Z�	Z����	Z�	Z�	Z�	Z�
#�-�1	0�1	0�I��)�Z�%;�<�<�0
0����y�':�I�N�K�K���;�&�G�(�1�%�+�2E�F�F�E�.�.�y�%�@�@��� �;�/��'�3�'�0�0�2�2�H��#7�7�7� �-�/�/�/�/�/3�,�,��I�z�':�;�;�"
0����y�':�I�<P�Q�Q���;�&�G�(�1�%�+�2E�F�F�E�.�.�y�%�@�@�����,����-�-�i�n�=�=���%�!�',�'9�'A�'G�'P�$�+�G�+;�+D�+D�+F�+F�(�'�/C�C�C�$�m�3�3�3�3�48�1� ��_�+�+�-�-�a��"�o�;�Q�Q�RX�Z_�`�`�G�a�a�a�a�a�a�a�a�a�a�a����a�a�a�a�%�
0�
0�F�#(�<�L�"(�+�K�+�?�&1�&:�&:�&<�&<��'3�'<�'<�'>�'>��"�l�2�2�48�1���3�!�-�/�/�/�/��-�I�0I�K�W�Ws$�6;C=�=D�D�*!K�K	�K	r)F)NNFF)FF)�__name__�
__module__�__qualname__�__doc__rr2rErWrRrSrarvrhrTrrrrrrr
s���������
3�3�3�3�(�(�(�(�T����$+�+�+�+�Z���2;�;�;�z����2N�N�N�����$3�3�3�"\X�\X�\X�\X�\XrrN)�django.apps.registryrr��	django.dbrr�
exceptionsrrrrr	rBr
rrrr�<module>r�s���4�4�4�4�4�4�(�(�(�(�(�(�(�(�,�,�,�,�,�,�#�#�#�#�#�#�'�'�'�'�'�'�������kX�kX�kX�kX�kX�kX�kX�kX�kX�kXr

Youez - 2016 - github.com/yon3zu
LinuXploit