AlkantarClanX12

Your IP : 3.133.109.251


Current Path : /opt/cloudlinux/venv/lib/python3.11/site-packages/alembic/ddl/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib/python3.11/site-packages/alembic/ddl/__pycache__/sqlite.cpython-311.pyc

�

�܋f����ddlmZddlZddlmZddlmZddlmZddlmZddlmZddl	m
Z
dd	l	mZdd
l	mZddl	m
Z
ddlmZd
dlmZd
dlmZd
dlmZd
dlmZddlmZer6ddlmZddlmZddlmZddlmZddlm Z ddlm!Z!ddlm"Z"ddl#m$Z$ddl%m&Z&Gd�de��Z'eed��d'd&���Z(dS)(�)�annotationsN)�Any)�Dict)�Optional)�
TYPE_CHECKING)�Union)�cast)�JSON)�schema)�sql)�compiles�)�alter_table)�format_table_name)�RenameTable)�DefaultImpl�)�util)�	Inspector)�DDLCompiler)�Cast)�
ClauseElement)�Column)�
Constraint)�Table)�
TypeEngine)�BatchOperationsImplc�l��eZdZdZdZ	d(d�Zd)d
�Zd)d�Zd*d�Zd+d�Z	d,d�Z
	d-d.�fd �
Zd/d&�Zd'�Z
�xZS)0�
SQLiteImpl�sqliteF�batch_opr�return�boolc�\�|jD]�}|ddkr�|dd}t|jtj��r't|jjtj��rdSt|jtj	j
��r|jjrdS��|ddvrdS��dS)z�Return True if the given :class:`.BatchOperationsImpl`
        would need the table to be recreated and copied in order to
        proceed.

        Normally, only returns True on SQLite when operations other
        than add_column are present.

        r�
add_columnrT)�create_index�
drop_indexF)�batch�
isinstance�server_defaultr�
DefaultClause�argrrr�sqla_compat�Computed�	persisted)�selfr!�op�cols    �I/opt/cloudlinux/venv/lib64/python3.11/site-packages/alembic/ddl/sqlite.py�requires_recreate_in_batchz%SQLiteImpl.requires_recreate_in_batch+s����.�	�	�B��!�u��$�$���e�A�h����&��(<��� � ��!3�!7��9J�K�K� � �4�4��s�1�4�3C�3L�M�M� ��*�4� � �4�4���A��<�<�<��t�t�=��5��constrc��|j�td���|�|��rtjd��dSdS)N��No support for ALTER of constraints in SQLite dialect. Please refer to the batch mode feature which allows for SQLite migrations using a copy-and-move strategy.z�Skipping unsupported ALTER for creation of implicit constraint. Please refer to the batch mode feature which allows for SQLite migrations using a copy-and-move strategy.)�_create_rule�NotImplementedErrorr�warn�r0r6s  r3�add_constraintzSQLiteImpl.add_constraintGsk����%�%�D���
�
�
�
��
%�
%�	��I�D�
�
�
�
�
�	�	r5c�2�|j�td���dS)Nr8)r9r:r<s  r3�drop_constraintzSQLiteImpl.drop_constraintXs+����%�%�D���
�&�%r5�inspector_column�Column[Any]�metadata_column�rendered_metadata_default�
Optional[str]�rendered_inspector_defaultc���|�,tjdd|��}tjdd|��}|�,tjdd|��}tjdd|��}||kS)Nz
^\((.+)\)$z\1z^\"?'(.+)'\"?$)�re�sub)r0r@rBrCrEs     r3�compare_server_defaultz!SQLiteImpl.compare_server_default`s���%�0�(*���u�&?�)�)�%�)+��!�5�*C�)�)�%�&�1�)+���u�&@�*�*�&�*,��!�5�*D�*�*�&�*�-F�F�Fr5�exprc��|sdStjd|��rdStjd|��rdStjd|��rdSdS)aDetermine if a server default is a SQL expression or a constant.

        There are too many assertions that expect server defaults to round-trip
        identically without parenthesis added so we will add parens only in
        very specific cases.

        Fz	^[0-9\.]$z^'.+'$z^\(.+\)$T)rG�match)r0rJs  r3�-_guess_if_default_is_unparenthesized_sql_exprz8SQLiteImpl._guess_if_default_is_unparenthesized_sql_expr|sa���		��5�
�X�l�D�
)�
)�	��5�
�X�i��
&�
&�	��5�
�X�k�4�
(�
(�	��5��4r5�	inspectorr�tabler�column_info�Dict[str, Any]�Nonec�z�|�|�dd����rd|d�d�|d<dSdS)N�default�(�))rM�get)r0rNrOrPs    r3�autogen_column_reflectz!SQLiteImpl.autogen_column_reflect�s`���=�=��O�O�I�t�,�,�
�
�	H�	H�0;�9�/E�/E�/E�%G�K�	�"�"�"�	H�	Hr5r�is_server_default�strc�z��t��j|fd|i|��}|r|�|��rd|�d�}|S)NrYrUrV)�super�render_ddl_sql_exprrM)r0rJrY�kw�str_expr�	__class__s     �r3r]zSQLiteImpl.render_ddl_sql_expr�sm���
/�5�7�7�.��
�
�$5�
�9;�
�
��

�	,��B�B�8�L�L�	,�	,�"*���+�H��r5�existing�existing_transfer�"Dict[str, Union[TypeEngine, Cast]]�new_typerc��|jj|jur0t|t��st	|d|��|d<dSdSdS)NrJ)�type�_type_affinityr)r
r	)r0rarbrds    r3�cast_for_batch_migratez!SQLiteImpl.cast_for_batch_migrate�si��
�M�(��*�
+�
+��x��.�.�
+�)-�!�&�)�8�)�)��f�%�%�%�	
+�
+�
+�
+r5c�2�|�||��dS)N)�_skip_functional_indexes)r0�conn_unique_constraints�conn_indexes�metadata_unique_constraints�metadata_indexess     r3�correct_for_autogen_constraintsz*SQLiteImpl.correct_for_autogen_constraints�s!��	
�%�%�&6��E�E�E�E�Er5)r!rr"r#)r6r)
r@rArBrArCrDrErDr"r#)rJrDr"r#)rNrrOrrPrQr"rR)F)rJrrYr#r"rZ)rarArbrcrdrr"rR)�__name__�
__module__�__qualname__�__dialect__�transactional_ddlr4r=r?rIrMrXr]rhro�
__classcell__)r`s@r3rr#s��������K��������8����"����G�G�G�G�8����*H�H�H�H�>C�������� 
�
�
�
�F�F�F�F�F�F�Fr5rr �elementr�compilerrr"rZc�j�t||j|j���dt||jd����S)Nz RENAME TO )r�
table_namerr�new_table_name)rvrwr^s   r3�visit_rename_tabler{�s=��
	�H�g�0�'�.�A�A�A�A��(�G�$:�D�A�A�A��r5)rvrrwrr"rZ))�
__future__rrG�typingrrrrr�
sqlalchemyr	r
rr�sqlalchemy.ext.compilerr
�baserrr�implr�r�sqlalchemy.engine.reflectionr�sqlalchemy.sql.compilerr�sqlalchemy.sql.elementsrr�sqlalchemy.sql.schemarrr�sqlalchemy.sql.type_apir�operations.batchrrr{�r5r3�<module>r�sJ��"�"�"�"�"�"�	�	�	�	������������������� � � � � � �������������������������������,�,�,�,�,�,�������#�#�#�#�#�#��������������������
7�6�6�6�6�6�6�3�3�3�3�3�3�,�,�,�,�,�,�5�5�5�5�5�5�,�,�,�,�,�,�0�0�0�0�0�0�+�+�+�+�+�+�2�2�2�2�2�2�6�6�6�6�6�6�bF�bF�bF�bF�bF��bF�bF�bF�J
��+�x� � ����!� ���r5