File: //opt/cloudlinux/venv/lib64/python3.11/site-packages/alembic/ddl/__pycache__/sqlite.cpython-311.pyc
�
    � h�  �                  �  � d dl mZ d dlZd dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dl	m
Z
 d d	l	mZ d d
l	mZ d dl	m
Z
 d dlmZ d
dlmZ d
dlmZ d
dlmZ d
dlmZ ddlmZ er6d dlmZ d dlmZ d dlmZ d dlmZ d dlm Z  d dlm!Z! d dlm"Z" d dl#m$Z$ ddl%m&Z&  G d� 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   � � e Zd ZdZdZ	 d(d�Zd)d
�Zd)d�Zd*d�Zd+d�Z	d,d�Z
	 d-d.� fd �
Zd/d&�Zd'� Z
� xZS )0�
SQLiteImpl�sqliteF�batch_opr   �return�boolc                �\  � |j         D ]�}|d         dk    r�|d         d         }t          |j        t          j        �  �        r't          |j        j        t          j        �  �        r dS t          |j        t          j	        j
        �  �        r|j        j        r dS ��|d         dvr dS ��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_columnr   T)�create_index�
drop_indexF)�batch�
isinstance�server_defaultr   �
DefaultClause�argr   r   r   �sqla_compat�Computed�	persisted)�selfr!   �op�cols       �G/opt/cloudlinux/venv/lib/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�    �constr   c                �   � |j         �t          d�  �        �|�                     | �  �        rt          j        d�  �         d S d S )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�r0   r6   s     r3   �add_constraintzSQLiteImpl.add_constraintG   sk   � � ��%�%�D�� � 
�
 �
�
��
%�
%� 	��I�D�
� 
� 
� 
� 
�	� 	r5   c                �2   � |j         �t          d�  �        �d S )Nr8   )r9   r:   r<