Hacked By AnonymousFox

Current Path : /opt/cloudlinux/venv/lib64/python3.11/site-packages/alembic/autogenerate/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib64/python3.11/site-packages/alembic/autogenerate/__pycache__/compare.cpython-311.pyc

�

�܋f���	��UddlmZddlZddlZddlZddlmZddlmZddlmZddlm	Z	ddlm
Z
ddlmZdd	lmZdd
lm
Z
ddlmZddlmZdd
lmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlm Z ddl!m"Z"ddl m#Z#erZddlm$Z$ddl%m&Z&ddl'm(Z(ddl'm)Z)ddl*m+Z+ddl*m,Z,dd l*m-Z-dd!l*m.Z.dd"l*m/Z/dd#l0m1Z1dd$l2m3Z3dd%l4m5Z5dd&l4m6Z6dd'l4m7Z7dd(l4m8Z8ej9e:��Z;d{d/�Z<e j=d0�1��Z>d|d4�Z?e>�@d5��d}d8���ZAd~d>�ZBe jCejDejEejFejGejFejGd?���ZHd@eIdA<ddG�ZJd�dI�ZKd�dK�ZLejMd�dS���ZNGdT�dU��ZOGdV�dWeO��ZPGdX�dYeO��ZQGdZ�d[eO��ZRe>�@d\��d�d_���ZSd`�ZTe>�@da��d�dh���ZUe>�@da��d�dj���ZVe>�@da��d�dk���ZWd�dn�ZXd�dq�ZYd�dr�ZZd�ds�Z[dt�Z\e>�@da��d�dv���Z]e>�@da��d�dx���Z^e>�@d\��d�dy���Z_e>�@d\��d�dz���Z`dS)��)�annotationsN)�Any)�cast)�Dict)�Iterator)�List)�Mapping)�Optional)�Set)�Tuple)�
TYPE_CHECKING)�Union)�event)�inspect��schema)�text)�types)�
expression)�
OrderedSet)�_fk_spec�)�util)�ops)�sqla_compat)�Literal)�	Inspector)�quoted_name)�
TextClause)�Column)�ForeignKeyConstraint)�Index)�Table)�UniqueConstraint)�AutogenContext)�DefaultImpl)�
AlterColumnOp)�MigrationScript)�ModifyTableOps)�
UpgradeOps�autogen_contextr%�migration_scriptr(�return�Nonec��|jd}|jd}t||��|�|��dS)N���)�upgrade_ops_list�downgrade_ops_list�_produce_net_changes�reverse_into)r+r,�upgrade_ops�
downgrade_opss    �S/opt/cloudlinux/venv/lib64/python3.11/site-packages/alembic/autogenerate/compare.py�_populate_migration_scriptr85sH��#�3�B�7�K�$�7��;�M���+�6�6�6����]�+�+�+�+�+�T)�uselistr5r*c�����j}|�J��j�dd��}t|��}|jj}|rat
|�����}|�d��|�|��|�	d��ndh}�fd�|D��}�j�J�t�d�jj���||��dS)N�include_schemasF�information_schemac�B��h|]}��|di���|��Sr��run_name_filters)�.0�sr+s  �r7�	<setcomp>z'_produce_net_changes.<locals>.<setcomp>Xs@�������o�>�>�q�(�B�O�O��	���r9r)
�
connection�opts�getr�dialect�default_schema_name�set�get_schema_names�discard�add�comparators�dispatch�name)r+r5rDr<�	inspector�default_schema�schemass`      r7r3r3Bs���!�+�J��!�!�!�%�*�.�.�/@�%�H�H�O�"�:�.�.�I��'�;�N����i�0�0�2�2�3�3�����,�-�-�-�����'�'�'����D������&����������G��"�.�.�.�����?�#:�#?�@�@���g�����r9rrR�$Union[Set[None], Set[Optional[str]]]c����	��j}t��}�jj}�jj}|D]m�	t|��	�����}�	|kr |��jjg��}|���	fd�|D�����ntd��j	D�����||fg��}t||||���dS)Nrc3�R�K�|]!}��|dd�i����|fV��"dS)�table�schema_nameNr?)rA�tnamer+rWs  ��r7�	<genexpr>z&_autogen_for_tables.<locals>.<genexpr>xs^����� 
� 
���/�/��w��� <��� 
�
�%� � 
� 
� 
� 
� 
� 
r9c�*�g|]}|j|jf��S�)rrO)rArVs  r7�
<listcomp>z'_autogen_for_tables.<locals>.<listcomp>�s!��O�O�O��%�,��
�	#�O�O�Or9)rPrI�migration_context�version_table_schema�
version_table�get_table_names�
difference�updater�
sorted_tables�_compare_tables)
r+r5rRrP�conn_table_namesr^r_�tables�metadata_table_namesrWs
`        @r7�_autogen_for_tablesrhbsD���� �)�I�7:�u�u��	�)�>��$�5�C�M��

�

���Y�.�.�k�.�B�B�C�C���.�.�.��&�&� �2�@�A���F�	��� 
� 
� 
� 
� 
�� 
� 
� 
�	
�	
�	
�	
�&�O�O��1N�O�O�O����j�'��7�8�9�9������������r9rerIrgrPrc
�	���|jjj�t�fd�|D����}�fd�t	||��D��}|}|�|��D]�\}}|r|�d|��n|}	|||f}
��|
|ddd��r�|j�tj	�
|
����t�d|	��tj
|g|���}t�d���|||d|
��|���s|j�|����t#j��}|�|��D�]\\}}t#j||��}	|	|jv}
t#j|||���}|
sHt-j|d�jj�|����t7j||����||dd	d��r�tj
|g|���}t�d���||||d��|���s|j�|��|j�tj�
|����t�d
|	����^|�|��}t#j��}i}|D]�\}}t#j||��}	|	|jv}
t#j|||���}|
sHt-j|d�jj�|����t7j||��||||f<��t?|d����D]�\}}|pd}|r|�d|��n|}	|||f}
|j|	}��|
|dd|��r�tj
|g|���}tA||||
|�|��5t�d���|||||
��ddd��n#1swxYwY|���s|j�|����dS)
Nc�.��g|]\}}|�kr|nd|f��S�Nr[)rArrXrQs   �r7r\z#_compare_tables.<locals>.<listcomp>�s@���	
�	
�	
������/�/�V�V�T�5�A�	
�	
�	
r9c�^��i|])\}\}}|�jtj||����*Sr[)�table_key_to_table�	sa_schema�_get_table_key)rA�no_dflt_schemarrXr+s    �r7�
<dictcomp>z#_compare_tables.<locals>.<dictcomp>�sM������
,�N�O�V�U�	��:��$�U�F�3�3�
���r9�.rVFzDetected added table %rr�column_reflectTzDetected removed table %rc�&�|dpd|dfS)Nr��r[)�xs r7�<lambda>z!_compare_tables.<locals>.<lambda>�s��1�Q�4�:�2�q��t�:L�r9)�key)!�bindrGrHr�zipra�run_object_filtersr�append�
CreateTableOp�
from_table�log�infor)rMrN�is_emptyrn�MetaDatarorfr#r�listenr]�impl�_compat_autogen_column_reflectr�_reflect_table�DropTableOp�intersection�sorted�_compare_columns)rergrPr5r+�#metadata_table_names_no_dflt_schema�tname_to_tablerBrXrO�metadata_table�modify_table_ops�removal_metadata�exists�t�existing_tables�existing_metadata�conn_column_info�
conn_tablerQs    `              @r7rdrd�s������^�+�?�N�+5�	
�	
�	
�	
�!5�	
�	
�	
�+�+�'�����03�/�1E�0
�0
�	���N�?��(�3�3�4D�E�E�9�9���5�'(�3�!�!�!�U�U�#�#�e��'��E�
�3���-�-��E�7�E�4�
�
�	9�
�O�"�"��!�,�,�^�<�<�
�
�
�
�H�H�.��5�5�5�"�1�%��A�F�F�F��� � ��)�)�� �����

�
�
�$�,�,�.�.�
9���&�&�'7�8�8�8�� �)�+�+��$�/�/�0D�E�E�8�8���5��'��q�1�1���)�0�0���O�E�#3�A�>�>�>���
	5��L�� ��1�6�.�.����
�
�
�
�&�y�!�4�4�4��-�-�a����t�L�L�	8�"�1�%��A�F�F�F��� � ��)�)��!1�1�e�Q��
�
�
�$�,�,�.�.�
9���&�&�'7�8�8�8��O�"�"�3�?�#=�#=�a�#@�#@�A�A�A��H�H�0�$�7�7�7��&�3�3�4H�I�I�O�!�*�,�,����#�)�)���5��'��q�1�1���*�1�1���O�E�#4�Q�?�?�?���		5��L�� ��1�6�.�.�y�9�9�
�
�
�
�&�y�!�4�4�4�'(��!�U��$�$��?�0L�0L�M�M�M�9�9���5�
�I���'(�3�!�!�!�U�U�#�#�e��'��E�
�3��&�-�d�3�
��-�-��E�7�E�:�
�
�	9� #�1�%��A�F�F�F��!����� �����
�
��$�$�W�-�-�#�$����"�
���
�
�
�
�
�
�
�
�
�
�
����
�
�
�
�&$�,�,�.�.�
9���&�&�'7�8�8�8��?9�9s�(Q�Q	�Q	)�asc�desc�nulls_first�
nulls_last�
nullsfirst�	nullslastzMapping[str, Any]�_IndexColumnSortingOps�params�Dict[str, Any]r�r#�Optional[Index]c���g}|�d��}t|d��D]~\}}|�$d|vsJ�|d|}t|��}n|}|j|}|r-||vr)||D] }|tvrt	||��}�!|�|���t
j|dg|�R|d|d��}	d|vr|d|	jd<|	S)N�column_sorting�column_names�expressionsrO�unique)r��_table�duplicates_constraint)	rF�	enumerater�cr�r}rnr"r�)
r�r��exprs�sorting�num�col_namerO�item�operator�ixs
          r7�_make_indexr�'s5��24�E��j�j�)�*�*�G�"�6�.�#9�:�:�
�
�
��X��� �F�*�*�*�*��-�(��-�D���:�:�D�D��D��<��)�D��	B�t�w���#�D�M�
B�
B���5�5�5�1�(�;�D�A�A�D��
���T�����	���v��
��
�
�'-�h�'7�
�
�
�
�B��&�(�(�+1�2I�+J���'�(�
�Ir9r$c���tj�fd�|dD��d|di�}d|vr|d|jd<|S)Nc�*��g|]}�j|��Sr[�r��rA�cnamer�s  �r7r\z+_make_unique_constraint.<locals>.<listcomp>Es ���	B�	B�	B�%�*�,�u�
�	B�	B�	Br9r�rO�duplicates_index)rnr$r�)r�r��uqs ` r7�_make_unique_constraintr�Asd���
�	#�	B�	B�	B�	B�6�.�+A�	B�	B�	B�
�
�F�^�
�
�B��V�#�#�&,�-?�&@���"�#�
�Ir9r!c
����|d�|dr
|d�d����|�di��}tj�fd�|dD���fd�|dD��|�d	��|�d
��|�d��|�d��|d
���}��|��|S)N�referred_table�referred_schemarr�optionsc�*��g|]}�j|��Sr[r�r�s  �r7r\z%_make_foreign_key.<locals>.<listcomp>Xs ���H�H�H����e�	�H�H�Hr9�constrained_columnsc���g|]	}��d|����
S)rrr[)rA�nrXs  �r7r\z%_make_foreign_key.<locals>.<listcomp>Ys$���B�B�B�!�E�E�E�1�1�	�B�B�Br9�referred_columns�onupdate�ondelete�
deferrable�	initiallyrO)r�r�r�r�rO)rFrnr!�append_constraint)r�r�r��constrXs `  @r7�_make_foreign_keyr�Ns�����
�#�$�E�
�� �=�!�"3�4�4�4�e�e�<���j�j��B�'�'�G��*�H�H�H�H�&�1F�*G�H�H�H�B�B�B�B�v�.@�'A�B�B�B����Z�(�(����Z�(�(��;�;�|�,�,��+�+�k�*�*�
�F�^�
�
�
�E�� � ��'�'�'��Lr9�
Optional[str]rX�Union[quoted_name, str]r�r�r)�Iterator[None]c
#����K��r��d���n�}td�|jD����}d�|jD��}	���fd�|jD��}
|�|
��D]|}��|	||ddd��r[|j�tj���|	|����t�	d||���}|�
|
��D]�}|	|}
|j|}��|
|dd|��s�1t	j�|����}t�
d���|��|||
��|���r|j�|����dV�t|
���|��D]�}��|j||dd	d��r`|j�tj���|j|����t�	d
||����dS)Nrrc3�2K�|]}|j�	|jV��dSrk��systemrO�rAr�s  r7rYz#_compare_columns.<locals>.<genexpr>ps?����$�$����$�	��$�$�$�$�$�$r9c�,�i|]}|j�	|j|��Sr[r�r�s  r7rqz$_compare_columns.<locals>.<dictcomp>ss3������1�8��	�����r9c	�^��i|])}��|jd��d����!|j|��*S)�column��
table_namerW)r@rO)rAr�r+rrXs  ���r7rqz$_compare_columns.<locals>.<dictcomp>wsT������
��+�+�
�F�H�U�6�J�J�
�
��	�����r9r�FzDetected added column '%s.%s'rTzDetected removed column '%s.%s')rr�rar|rr}�AddColumnOp�from_column_and_tablenamer�r�r�r'rMrN�has_changesrI�DropColumnOp)rrXr�r�r�r+rPrO�metadata_col_names�metadata_cols_by_name�conn_col_namesr��colname�metadata_col�conn_col�alter_column_ops``   `          r7r�r�es��������)/�9�f�f�f�e�e�$�$�E�D�#�$�$�&�(�$�$�$������)�+����������������N�$�.�.�~�>�>�	C�	C���-�-�!�%�(�%��5�$�
�
�	C�
� �'�'���9�9��E�#8��#?���
�
�
�

�H�H�4�d�E�B�B�B��%�2�2�>�B�B�9�9��,�W�5���<��(���1�1��'�8�U�H�
�
�	�
��+�E�7�6�J�J�J�����X�&�&��������	
�	
�	
��&�&�(�(�	9�� �'�'��8�8�8��	�E�E�E��^�$�$�/�/�0B�C�C�	E�	E���-�-��L�����$��
�
�	E�
� �'�'�� �:�:��E�:�<��#6���
�
�
�

�H�H�6��e�D�D�D��	E�	Er9c�6�eZdZUded<d
d�Zd�Zd	�Zdd�ZdS)�_constraint_sigz4Union[UniqueConstraint, ForeignKeyConstraint, Index]r��contextr%r-r�c�@�tj|j|j��Srk�r�_get_constraint_final_namer�rG��selfr�s  r7�md_name_to_sql_namez#_constraint_sig.md_name_to_sql_name�� ���5��J���
�
�	
r9c�"�|j|jkSrk�r��r��others  r7�__eq__z_constraint_sig.__eq__�����z�U�[�(�(r9c�"�|j|jkSrkr�r�s  r7�__ne__z_constraint_sig.__ne__�r�r9�intc�*�t|j��Srk)�hashr��r�s r7�__hash__z_constraint_sig.__hash__�s���D�J���r9N�r�r%r-r�)r-r�)�__name__�
__module__�__qualname__�__annotations__r�r�r�r�r[r9r7r�r��sh�������?�?�?�?�
�
�
�
�
)�)�)�)�)�)� � � � � � r9r�c�6�eZdZdZdZdd�Zedd	���Zd
S)
�_uq_constraint_sigFTr�r$r-r.c��||_|j|_dttd�|jD������z|_dS)N)�UNIQUE_CONSTRAINTc��g|]	}|j��
Sr[�rO�rA�cols  r7r\z/_uq_constraint_sig.__init__.<locals>.<listcomp>�s��6�6�6��C�H�6�6�6r9)r�rO�tupler��columns�sig)r�r�s  r7�__init__z_uq_constraint_sig.__init__�sJ����
��J��	�)�E��6�6��
�6�6�6�7�7�-
�-
�
����r9�	List[str]c�.�d�|jjD��S)Nc��g|]	}|j��
Sr[rrs  r7r\z3_uq_constraint_sig.column_names.<locals>.<listcomp>�s��7�7�7�S���7�7�7r9)r�rr�s r7r�z_uq_constraint_sig.column_names�s��7�7�D�J�$6�7�7�7�7r9N)r�r$r-r.)r-r
)r�r�r��is_index�	is_uniquer	�propertyr�r[r9r7r�r��sR�������H��I�
�
�
�
��8�8�8��X�8�8�8r9r�c�:�eZdZdZdd�Zdd�Zedd���ZdS)�_ix_constraint_sigTr�r"r�r&r-r.c��||_|j|_d|�|��z|_t	|j��|_dS)N)�INDEX)r�rO�create_index_sigr�boolr�r)r�r�r�s   r7r	z_ix_constraint_sig.__init__�sA����
��J��	��� 5� 5�e� <� <�<����e�l�+�+����r9r�r%r�c�@�tj|j|j��Srkr�r�s  r7r�z&_ix_constraint_sig.md_name_to_sql_name�r�r9�$Union[List[quoted_name], List[None]]c�4�tj|j��Srk)r�_get_index_column_namesr�r�s r7r�z_ix_constraint_sig.column_names�s���2�4�:�>�>�>r9N)r�r"r�r&r-r.r�)r-r)r�r�r�r
r	r�rr�r[r9r7rr�sa�������H�,�,�,�,�
�
�
�
�
�?�?�?��X�?�?�?r9rc��eZdZ	d
dd�Zd	S)�_fk_constraint_sigFr�r!�include_optionsrr-r.c�T�||_|j|_t|��\
|_|_|_|_|_|_}}}}|j|jt|j��|j|jt|j��f|_
|r�|xj
|r.|���dkrdn|���nd|r.|���dkrdn|���nd|r|���dkrdn|rdndfz
c_
dSdS)Nz	no action�deferred�initially_deferrabler�znot deferrable)r�rOr�
source_schema�source_table�source_columns�
target_schema�target_table�target_columnsrr�lower)r�r�rr�r�r�r�s       r7r	z_fk_constraint_sig.__init__�s\����
��J��	�
�U�O�O�	
�����������������
�����$�%�&�&������$�%�&�&�
%
����	��H�H������)�)�[�8�8���h�n�n�>N�>N�>N�������)�)�[�8�8���h�n�n�>N�>N�>N���&�!*���!2�!2�j�!@�!@�'�&��&�\�\�%�
�

�H�H�H�H�	�	r9N)F)r�r!rrr-r.)r�r�r�r	r[r9r7rr�s0������CH�)�)�)�)�)�)�)r9rrV�
modify_ops�Optional[Table]c�*	������%�&�'�(�)�*��j}�du�(|du�)|�&d�|jD��}t|j��}nt��}t��}t	��x}	}
d�*d}���t|d��rb	|������}	d�*���fd�|	D��}	|	D]}|�d��rd}�n#t$rYnt$rYnwxYw	|�
�����}
���fd�|
D��}
n#t$rYnwxYw�)rt��}	n�fd	�|	D��}	d
��fd�|
D��D��}
|rt|	|
||�j���j
j�|	|
||��d�|D��}
�j
j�'�'fd
�|D��}d�|	D��}�'fd�|
D��}�fd�|
�|��D��}d�|D���&d�|D���%d�|�|��D��}�%�&fd�t�&����%��D��}d�|D��}d�|
D��}d�|D��}�fd�|
D��}��(�)��*fd�}��(�)��*�fd�}���fd�}t%t|���|����D]^}||}|js
|j|vr�||vr4||\}}|j|vr|j|vr||��||���S||���_t%t|���|����D]�}||} ||vr||\}}| jr|}n|}n||}|j| jkr||��|| ���Ug}!|j| jkr%|!�d|j�d| j����|j| jkr%|!�d|j�d| j����|!r
||| |!����t%t|���|����D]}"||"}#||#���|D]}$|$|vr|||$���dS) Nc�F�h|]}t|tj���|��Sr[)�
isinstancernr$�rAr�s  r7rCz/_compare_indexes_and_uniques.<locals>.<setcomp> s;��'
�'
�'
���"�i�8�9�9�'
��'
�'
�'
r9F�get_unique_constraintsrTc	�T��g|]$}��|dd��d����"|��%S)rO�unique_constraintr�r?)rAr�r+rrXs  ���r7r\z0_compare_indexes_and_uniques.<locals>.<listcomp>@sT��� � � ��&�7�7��6�
�+�',�V�D�D��� �� � � r9r�c	�T��g|]$}��|dd��d����"|��%S)rO�indexr�r?)rAr�r+rrXs  ���r7r\z0_compare_indexes_and_uniques.<locals>.<listcomp>SsT�������"�3�3��v�J��#(��@�@�������r9c�0��h|]}t|�����Sr[)r�)rA�uq_defr�s  �r7rCz/_compare_indexes_and_uniques.<locals>.<setcomp>cs3�������(��
�;�;���r9c��h|]}|�|��Srkr[)rAr1s  r7rCz/_compare_indexes_and_uniques.<locals>.<setcomp>hs(��
�
�
��� �
� � � r9c3�8�K�|]}t|���V��dSrk)r�)rAr�r�s  �r7rYz/_compare_indexes_and_uniques.<locals>.<genexpr>js-�����M�M�"�+�b�*�5�5�M�M�M�M�M�Mr9c�,�h|]}t|����Sr[�r�r,s  r7rCz/_compare_indexes_and_uniques.<locals>.<setcomp>�s.��'�'�'�#%��2���'�'�'r9c�0��h|]}t|�����Sr[�r�rAr�r�s  �r7rCz/_compare_indexes_and_uniques.<locals>.<setcomp>�s1������)+��2�t�$�$���r9c�,�h|]}t|����Sr[r7r,s  r7rCz/_compare_indexes_and_uniques.<locals>.<setcomp>�s!��M�M�M�"�1�"�5�5�M�M�Mr9c�0��h|]}t|�����Sr[r9r:s  �r7rCz/_compare_indexes_and_uniques.<locals>.<setcomp>�s$���L�L�L��*�2�t�4�4�L�L�Lr9c����i|]_}t|t��stj|j�j���6t
t|������|��`Sr[)	r+rr�_constraint_is_namedr�rGr�strr�)rAr�r+s  �r7rqz0_compare_indexes_and_uniques.<locals>.<dictcomp>�sr������
��a�+�,�,���+�A�G�_�5L�M�M�
��S�!�'�'��8�8�9�9�1���r9c��i|]
}|j|��Sr[rr�s  r7rqz0_compare_indexes_and_uniques.<locals>.<dictcomp>�s��G�G�G�!�A�F�A�G�G�Gr9c��i|]
}|j|��Sr[rr�s  r7rqz0_compare_indexes_and_uniques.<locals>.<dictcomp>�s��@�@�@�!�A�F�A�@�@�@r9c�P�i|]#}tj|j���|j|��$Sr[)r�constraint_name_stringrOr�s  r7rqz0_compare_indexes_and_uniques.<locals>.<dictcomp>�s?�����
��-�a�f�5�5��	�����r9c�2��i|]}|�|�|f��Sr[r[)rArO�conn_indexes_by_name�conn_uniques_by_names  ��r7rqz0_compare_indexes_and_uniques.<locals>.<dictcomp>�s<�������	
�#�D�)�+?��+E�F���r9c��i|]
}|j|��Sr[�rr,s  r7rqz0_compare_indexes_and_uniques.<locals>.<dictcomp>�s��H�H�H�"�2�6�2�H�H�Hr9c��i|]
}|j|��Sr[rHr,s  r7rqz0_compare_indexes_and_uniques.<locals>.<dictcomp>�s)�����������r9c��i|]
}|j|��Sr[rH)rAr�s  r7rqz0_compare_indexes_and_uniques.<locals>.<dictcomp>�s��I�I�I�b�r�v�r�I�I�Ir9c�^��i|])}tj|j�j���!|j|��*Sr[)rr>r�rGr)rAr�r+s  �r7rqz0_compare_indexes_and_uniques.<locals>.<dictcomp>�sJ��� � � ���/��H�o�-�
�
� �
��� � � r9c���|jr���|j|jddd��r{�j�tj�|j����t�	d|jd�
d|jzg����dSdS�sdS�s�rdS��|j|jddd��r{�j�tj�
|j����t�	d|jd�
d|jzg����dSdS)Nr1FzDetected added index '%s' on %s�, z'%s'r/z+Detected added unique constraint '%s' on %s)r
r|r�rOrr}�
CreateIndexOp�
from_indexr�r��joinr��AddConstraintOp�from_constraint)�objr+�is_create_table�
is_drop_tabler'�supports_unique_constraintss �����r7�	obj_addedz/_compare_indexes_and_uniques.<locals>.obj_added�sx����<�	��1�1��	�3�8�W�e�T���
���%�%�c�&7�&B�&B�3�9�&M�&M�N�N�N����5��H��I�I�v��(8�8�9�:�:������	
�
�/�
����
�-�
����1�1��	�3�8�%8�%����

���%�%��'�7�7��	�B�B�������A��H��I�I�v��(8�8�9�:�:������

�

r9c�D��|jr�|jr�sdS��|j|jddd��r_�j�t
j�|j����t�
d|j���dSdS�s�rdS��|j|jddd��r_�j�t
j�|j����t�
d|j���dSdS)Nr1Tz#Detected removed index '%s' on '%s'r/z/Detected removed unique constraint '%s' on '%s')
r
rr|r�rOrr}�DropIndexOprOr�r��DropConstraintOprR)rSr+rTrUr'rVrXs ������r7�obj_removedz1_compare_indexes_and_uniques.<locals>.obj_removed�sS����<�	��}�
�%@�
����1�1��	�3�8�W�d�D���
���%�%�c�o�&@�&@���&K�&K�L�L�L����9�3�8�U������	
�
��
�-�
����1�1��	�3�8�%8�$����

���%�%��(�8�8���C�C�������E��H�������

�

r9c�v��|jrى�|j|jdd|j��r�t�d|j�d�|�����j�tj	�
|j�����j�tj�
|j����dSdS��|j|jdd|j��r�t�d|j�d�|�����j�tj�
|j�����j�tj�
|j����dSdS)Nr1Fz&Detected changed index '%s' on '%s':%srMr/z2Detected changed unique constraint '%s' on '%s':%s)r
r|r�rOr�r�rPrr}rYrOrNrZrRrQ)�old�new�msgr+r'rXs   ���r7�obj_changedz1_compare_indexes_and_uniques.<locals>.obj_changeds�����<�	��1�1��	�3�8�W�e�S�Y���

O����<��H���I�I�c�N�N�	�����%�%�c�o�&@�&@���&K�&K�L�L�L���%�%�c�&7�&B�&B�3�9�&M�&M�N�N�N�N�N�

O�

O��1�1��	�3�8�%8�%�����
����H��H���I�I�c�N�N�	�����%�%��(�8�8���C�C������%�%��'�7�7��	�B�B������
�
r9z unique=z to unique=z expression z to )rP�constraintsrI�indexes�	frozenset�hasattrr-rF�NotImplementedError�	TypeError�get_indexes�_correct_for_uq_duplicates_uixrGr]r��correct_for_autogen_constraints�unionr�r�rar
rrr})+r+r'rrXr�r�rP�metadata_unique_constraints�metadata_indexes�conn_uniques�conn_indexes�+unique_constraints_duplicate_unique_indexesr��metadata_unique_constraints_sig�metadata_indexes_sig�conn_unique_constraints�conn_indexes_sig�metadata_names�
conn_names�doubled_constraints�conn_uniques_by_sig�metadata_uniques_by_sig�metadata_indexes_by_sig�unnamed_metadata_uniquesrWr[r`�removed_name�conn_obj�conn_uq�conn_idx�
existing_name�metadata_objr_�
added_namerS�uq_sigrErFr�rTrUrVs+`````                                @@@@@@r7�_compare_indexes_and_uniquesr�s�������������� �)�I� �D�(�O�"�d�*�M��!�'
�'
�$�0�'
�'
�'
�#�
�~�5�6�6���&)�e�e�#��5�5��"+�+�+�-�L�<�"'��27�/����9�6�7�7�	K�
K�(�?�?��&� @� � ��/3�+� � � � � � �*� � � ��'�K�K�B��v�v�0�1�1�K�FJ�C��K��#'�
�
�
����
�
�
���	
����$	�$�0�0��f�1���L�������&����L�L��#�	�	�	��D�	�����	��5�5�L�L�����*����L�

�
�M�M�M�M��M�M�M�
�
�
��3�
�&���'���#�	
�	
�	
��%�*�J�J���#��	���'�'�)D�'�'�'�#��,�1�D�����/?�����N�M��M�M�M��L�L�L�L�|�L�L�L������0�6�6� �
�
����N�H�G�/F�G�G�G��@�@�/?�@�@�@����(�.�.�/?�@�@����J�������,�-�-�:�:� �
�
�����I�H�0G�H�H�H����<�����J�I�4H�I�I�I�� � � � �1� � � �� ���������>����������@�������<�s�:���9�9�.�I�I�J�J�"�"��BL��C
��� �	"�X�\�5M�%M�%M��
�0�
0�
0� 3�L� A��G�X���$;�;�;��K�'>�>�>���G�$�$�$���H�%�%�%���K��!�!�!�!���N� 3� 3� @� @�� L� L�M�M�9�9�
�%�m�4���/�/�/� 3�M� B��G�X��$�
#�#���"���!�-�0�H���� 5�5�5��K��!�!�!��I�l�#�#�#�#��C��!�\�%;�;�;��
�
�
��)�)�)�<�+A�+A�C�����|�|�/�/�/��
�
�
�.6�l�l�l�L�<L�<L�M�����
9���H�l�C�8�8�8���S��0�0�;�;�J�G�G�H�H���
��Z�(���	�#�����*�8�8���,�,�,��I�.�v�6�7�7�7��8�8s*�C�
C$�	C$�#C$�(D�
D�Dc�`���fd�|D��}d�|D��}d�|D��}�fd�|D��}d�|D��}	d�|D��}
|
D]]}||vr8t|
|��j|vr|�|
|���>||vr|�|	|���^dS)Nc�>��g|]}tj|���|f��Sr[)rr��rA�consrGs  �r7r\z2_correct_for_uq_duplicates_uix.<locals>.<listcomp>os;�������
�	/��g�	>�	>��E���r9c��h|]	\}}|�|��
Srkr[�rArOr�s   r7rCz1_correct_for_uq_duplicates_uix.<locals>.<setcomp>ts(�������t�d�6F��6F�6F�6Fr9c�@�h|]\}}|�t|��j��Srk)r�rr�s   r7rCz1_correct_for_uq_duplicates_uix.<locals>.<setcomp>xs4������D�$��<�	�4� � �$��<�<r9c�H��h|]}|j�	tj|�����Sr[)r�rr�r�s  �r7rCz1_correct_for_uq_duplicates_uix.<locals>.<setcomp>~s>��������;���.�t�W�=�=���r9c�,�i|]}|j�	|j|��Sr[)r�rO�rAr�s  r7rqz2_correct_for_uq_duplicates_uix.<locals>.<dictcomp>�s#��M�M�M����M�T�Y��M�M�Mr9c�8�i|]}|jd�|j|��S)r�)r�rOr�s  r7rqz2_correct_for_uq_duplicates_uix.<locals>.<dictcomp>�s:�������9�'�(���	�4���r9)r�rrK)rrrnrkrlrG�metadata_cons_names�metadata_uq_names�unnamed_metadata_uqs�metadata_ix_names�
conn_ix_names�uqs_dupe_indexes�overlaps    `       r7rhrh]sS���$����/�����
��2�������-���������$�����N�M��M�M�M�M���+�����$�	9�	9���+�+�+�"�#3�G�#<�=�=�A�+�,�,�(�/�/�0@��0I�J�J�J��
�-�
-�
-�� � ��w�!7�8�8�8��	9�	9r9r�r�r'r�r��Column[Any]r�c�l�|j}|j}||_||ur�tj|j|j��rtj|��stj|j|j��rt�d||��dS||_	t�d|rdnd||��dSdS)Nz3Ignoring nullable change on identity column '%s.%s'zDetected %s on column '%s.%s'�NULLzNOT NULL)
�nullable�existing_nullabler�_server_default_is_computed�server_default�_nullability_might_be_unset�_server_default_is_identityr�r��modify_nullable)	r+r�rrXr�r�r��metadata_col_nullable�conn_col_nullables	         r7�_compare_nullabler��s���)�1�� �)��(9�O�%�� 5�5�5��3��+�X�-D�
�
�	��7��E�E�		��7� �/��1H���
	�
�H�H�E���
�
�
�
�
�/D�O�+��H�H�/�/�?���Z���	
�
�
�
�
�'6�5r9rc��|jj|urd|jd<dS|jdurd|jd<dS|jdurd|jd<dSdS)NT�
autoincrementF)rV�_autoincrement_column�kwr�)r+r�rrXr�r�r�s       r7�_setup_autoincrementr��sr����/�<�?�?�.2���?�+�+�+�	�	#�t�	+�	+�.2���?�+�+�+�	�	#�u�	,�	,�.3���?�+�+�+�
-�	,r9c�|�|j}||_|j}|jtjurt
�d||��dS|jtjurt
�d||��dS|j�||��}	|	r'||_	t
�d||||��dSdS)Nz3Couldn't determine database type for column '%s.%s'z:Column '%s.%s' has no type within the model; can't comparez-Detected type change from %r to %r on '%s.%s')
�type�
existing_type�_type_affinity�sqltypes�NullTyper�r�r]�
_compare_type�modify_type)
r+r�rrXr�r�r��	conn_type�
metadata_type�isdiffs
          r7r�r��s����
�I�$-�O�!� �%�M���8�#4�4�4����D���	
�	
�	
�
	���#�x�'8�8�8����K���	
�	
�	
�
	��
�
.�
<�
<��,���F��
�&3��#����;�����	
�	
�	
�	
�	
�
�
r9�metadata_default�
Optional[Any]c��t|tj��rRt|jt��r|j}n0t	|j�|jddi�����}t|t��r|SdS)N�
literal_bindsT�rG�compile_kwargs)r+rn�
DefaultClause�argr?�compilerG)r�r+s  r7�"_render_server_default_for_comparer�s����"�I�$;�<�<�	��&�*�C�0�0�	�/�3���"� �$�,�,�+�3�$3�T�#:�-��� � ���"�C�(�(�����tr9�sqltextr?c�R�tjdd|�����S)z�we want to warn if a computed sql expression has changed.  however
    we don't want false positives and the warning is not that critical.
    so filter out most forms of variability from the SQL text.

    z[ \(\)'\"`\[\]]ru)�re�subr&)r�s r7�_normalize_computed_defaultr�s%���6�$�b�'�2�2�8�8�:�:�:r9c���tttj|j��j�|jddi�����}t|��}t|jtj��rJt|jj�|jddi�����}|�d}nt|��}nd}||krt||��dSdS)Nr�Tr�ru)r?rrn�Computedr�r�r�rGr�r+�_warn_computed_not_supported)	r+r�rrXr�r�r��rendered_metadata_default�rendered_conn_defaults	         r7�_compare_computed_defaultr�!s��!$��Y�
��!<�=�=�E�M�M�#�+�+�T�2�	N�	
�	
�!�!��!<�!�!�!���(�)�9�+=�>�>�#� #��#�+�3�3�'�/� /��6�
4�
�
�!
�!
��!�(�$&�!�!�$?�%�%�%�!�!�!#�� �$9�9�9�$�U�E�2�2�2�2�2�:�9r9c�<�tjd|�d|�d���dS)NzComputed default on rrz cannot be modified)r�warn)rXr�s  r7r�r�Ms'���I�I����u�u�u�M�N�N�N�N�Nr9c�j�|jj}|�|j|j��\}}	}
||
fSrk)r]r��_compare_identity_defaultr�)r+r�rrXr�r�r�r��diff�ignored_attr�is_alters           r7r�r�QsB���,�1�D�#'�#A�#A��#�X�%<�$�$� �D�,����>�r9�Optional[bool]c	��|j}|j}|�|�dStj|��r#tjsdSt	|||||||��Stj|��rt||��dStj||��rU||_t|||||||��\}	}
|
r3||_	|	r*t�d||t|	����n|t||��}|rtt|��jjnd}||_|j�||||��}
|
r#||_	t�d||��dS)NFzIDetected server default on column '%s.%s': identity options attributes %sz)Detected server default on column '%s.%s')r�rr��has_computed_reflectionr�r�r��existing_server_defaultr��modify_server_defaultr�r�r�r�rrr�rr]�_compare_server_default)r+r�rrXr�r�r�r��conn_col_defaultr�r�r�r��is_diffs              r7r�r�bs���$�2���.����$4�$<��u��.�/?�@�@���2�	��5�*�#�#����� ���

��.�/?�@�@��$�U�E�2�2�2��u��.��*���*P�3C��/�2��������
�
���h��		�4D�O�1��
����5����4�L�L�����%G��o�%
�%
�!�
5E�N�D��&�'�'�+�0�0�$�	�3C��/�!�3�K�K���%�!�	
�
���	P�4D�O�1��H�H�@�%��O�O�O��4r9�Optional[Literal[False]]c��|j�J�|jjsdS|j}|j}|�|�dS||_||kr#||_t
�d||��dS)NFzDetected column comment '%s.%s')rG�supports_comments�comment�existing_comment�modify_commentr�r�)	r+r�rrXr�r�r��metadata_comment�conn_col_comments	         r7�_compare_column_commentr��s����"�.�.�.��"�4���t�#�+���'����$4�$<��u�'7�O�$��+�+�+�)9��&����2�E�5�A�A�A��4r9c�B����������|�dS�j}d�|jD��}���fd�|������D��}t|o	d|dv����fd�|D��}	�jj�|	|���fd�|D��}
�fd�|	D��}d	�|D��}d
�|
D��}
d�|
D��}d�|D��}���fd
�}��fd�}t|���|
��D]7}||�||
vr)�j	|vr|�j	j
nd}|�|���8t|
���|��D]7}|
|�||vr)�j	|vr|�j	j
nd}|�|���8dS)Nc�F�h|]}t|tj���|��Sr[)r+rnr!)rA�fks  r7rCz(_compare_foreign_keys.<locals>.<setcomp>�s;�������b�)�8�9�9��
���r9c	�T��g|]$}��|dd��d����"|��%S)rO�foreign_key_constraintr�r?)rAr�r+rrXs  ���r7r\z)_compare_foreign_keys.<locals>.<listcomp>�sT��������+�+��v�J�$� ��8�8�
�
��
���r9rr�rc�0��h|]}t|�����Sr[)r�)rAr�r�s  �r7rCz(_compare_foreign_keys.<locals>.<setcomp>�s3�������	�%��,�,���r9c�2��h|]}t|������S�)r�r�rAr��backend_reflects_fk_optionss  �r7rCz(_compare_foreign_keys.<locals>.<setcomp>s7�������	�2�/J�K�K�K���r9c�2��h|]}t|������Sr�r�r�s  �r7rCz(_compare_foreign_keys.<locals>.<setcomp>s7�������	�2�/J�K�K�K���r9c��i|]
}|j|��Sr[rHr�s  r7rqz)_compare_foreign_keys.<locals>.<dictcomp>s��6�6�6�A�q�u�a�6�6�6r9c��i|]
}|j|��Sr[rHr�s  r7rqz)_compare_foreign_keys.<locals>.<dictcomp>s��>�>�>��1�5�!�>�>�>r9c�,�i|]}|j�	|j|��Srkrr�s  r7rqz)_compare_foreign_keys.<locals>.<dictcomp>s*������q�v�/A����/A�/A�/Ar9c�,�i|]}|j�	|j|��Srkrr�s  r7rqz)_compare_foreign_keys.<locals>.<dictcomp>s#��N�N�N�a�1�6�;M����;M�;M�;Mr9c�����|j|jdd|��r��j�tj��j����t�dd�	|j
��d�	|j��|jr
d|jznd|j
��dSdS)Nr�Fz1Detected added foreign key (%s)(%s) on table %s%srM�%s.ru)r|r�rOrr}�CreateForeignKeyOprRr�r�rPr"r%r r!)rS�
compare_tor+r�r�s  ���r7�_add_fkz&_compare_foreign_keys.<locals>._add_fks�����-�-��I�s�x�!9�5�*�
�
�
	�
� �'�'��&�6�6�u�{�C�C�
�
�
�
�H�H�C��	�	�#�,�-�-��	�	�#�,�-�-�-0�->�F���)�)�)�B�� �
�
�
�
�
�
	�
	r9c�����|j|jdd|��r��j�tj�|j����t�dd�	|j
��d�	|j��|jr
d|jznd|j
��dSdS)Nr�Tz3Detected removed foreign key (%s)(%s) on table %s%srMr�ru)r|r�rOrr}rZrRr�r�rPr"r%r r!)rSr�r+r�s  ��r7�
_remove_fkz)_compare_foreign_keys.<locals>._remove_fk)s�����-�-��I�s�x�!9�4��
�
�	�
� �'�'��$�4�4�S�Y�?�?�
�
�
�
�H�H�E��	�	�#�,�-�-��	�	�#�,�-�-�-0�->�F���)�)�)�B�� �
�
�
�
�
�
	�	r9)rPra�get_foreign_keysrr]r��correct_for_autogen_foreignkeysrIrarOr�)r+r�rrXr�r�rP�metadata_fks�
conn_fks_list�conn_fks�metadata_fks_sig�conn_fks_sig�conn_fks_by_sig�metadata_fks_by_sig�metadata_fks_by_name�conn_fks_by_namer�r��removed_sigr��	added_sigr�r�s`````                @@r7�_compare_foreign_keysr�s������������^�3����)�I��� �,����L��������,�,�U�6�,�B�B����M�#'��7�)�}�Q�'7�7�#�#������"����H��%�*�J�J��,�������������
��������L�
7�6��6�6�6�O�>�>�-=�>�>�>����+�����O�N�<�N�N�N��������� 
�
�
�
�
�
�$�?�+�+�6�6�7J�K�K�*�*����,���1�1�1��:�!5�5�5�%�U�Z�0�6�6��
�

�J�u�j�)�)�)���,�-�-�8�8��I�I�'�'�	�#�I�.���O�+�+��:�!1�1�1�!���,�2�2��
�

�G�E�:�&�&�&��'�'r9c��|j�J�|jjsdS|�|�dS|j�	|j�dS|j�=|j�6|j�tj||j|�����dS|j|jkr<|j�tj||j|j|�����dSdS)N)r�r)rGr�r�rr}�DropTableCommentOp�CreateTableCommentOp)r+r�rrXr�r�s      r7�_compare_table_commentrPs
���"�.�.�.��"�4������^�3�����!�n�&<�&D�����%�*�*<�*H���#�#��"��
�(:�6�
�
�
�	
�	
�	
�	
�	
�

�	�:�#5�	5�	5���#�#��$���&�!+�!3��	
�
�
�	
�	
�	
�	
�	
�
6�	5r9)r+r%r,r(r-r.)r+r%r5r*r-r.)r+r%r5r*rRrSr-r.)rerIrgrIrPrr5r*r+r%r-r.)r�r�r�r#r-r�)r�r�r�r#r-r$)r�r�r�r#r-r!)rr�rXr�r�r#r�r#r�r)r+r%rPrr-r�)r+r%r'r)rr�rXr�r�r(r�r(r-r.)r+r%r�r'rr�rXr�r�r�r�r�r�r�r-r.)r+r%r�r'rr�rXr�r�rr�r�r�r�r-r.)r�r�r+r%r-r�)r�r?r-r?)r+r%r�r'rr�rXr?r�r?r�r�r�r�r-r.)rXr?r�r?r-r.)r+r%r�r'rr�rXr�r�r�r�r�r�r�r-r�)r+r%r�r'rr�rXr�r�rr�r�r�r�r-r�)r+r%r�r)rr�rXr�r�r(r�r(r-r.)a�
__future__r�
contextlib�loggingr��typingrrrrrr	r
rrr
r�
sqlalchemyrrrrnrrr��sqlalchemy.sqlr�sqlalchemy.utilr�alembic.ddl.baserrur�
operationsrrr�sqlalchemy.engine.reflectionr�sqlalchemy.sql.elementsrr�sqlalchemy.sql.schemar r!r"r#r$�alembic.autogenerate.apir%�alembic.ddl.implr&�alembic.operations.opsr'r(r)r*�	getLoggerr�r�r8�
DispatcherrMr3�dispatch_forrhrd�
immutabledictr�r�r�r�r�r�r�r�r��contextmanagerr�r�r�rrr�rhr�r�r�r�r�r�r�r�r�r�rrr[r9r7�<module>rs���"�"�"�"�"�"�"���������	�	�	�	������������������������������������������������������� � � � � � �������������������*�*�*�*�*�*�������(�(�(�(�(�(�%�%�%�%�%�%�&�&�&�&�&�&�%�%�%�%�%�%��������������������2�������6�6�6�6�6�6�3�3�3�3�3�3�2�2�2�2�2�2�,�,�,�,�,�,�:�:�:�:�:�:�+�+�+�+�+�+�+�+�+�+�+�+�6�6�6�6�6�6�7�7�7�7�7�7�,�,�,�,�,�,�4�4�4�4�4�4�6�6�6�6�6�6�5�5�5�5�5�5�1�1�1�1�1�1��g���!�!��,�,�,�,��d�o�d�+�+�+������@
���(�#�#�'�'�'�$�#�'�TK9�K9�K9�K9�\-?�D�,>��~���!�,� �*� �+��)�
��	-�	-��	�	�	�	�����4
�
�
�
�����.��EE�EE�EE���EE�P � � � � � � � �$
8�
8�
8�
8�
8��
8�
8�
8� ?�?�?�?�?��?�?�?�&*�*�*�*�*��*�*�*�Z
���'�"�"�I8�I8�I8�#�"�I8�X
:9�:9�:9�z
���(�#�#�&�&�&�$�#�&�R
���(�#�#�4�4�4�$�#�4�$
���(�#�#�(
�(
�(
�$�#�(
�V����(;�;�;�;�)3�)3�)3�)3�XO�O�O�O����"
���(�#�#�U�U�U�$�#�U�p
���(�#�#����$�#��8
���'�"�"�t'�t'�t'�#�"�t'�n
���'�"�"�#
�#
�#
�#�"�#
�#
�#
r9

Hacked By AnonymousFox1.0, Coded By AnonymousFox