Hacked By AnonymousFox

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

�

�܋f�k�
��ddlmZddlmZddlZddlmZddlmZddlmZddlm	Z	ddlm
Z
dd	lmZdd
lmZddlm
Z
ddlmZdd
lmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZer�ddlmZddlmZddlm Z ddl!m"Z"ddl!m#Z#ddl!m$Z$dd l!m%Z%dd!l!m&Z&dd"l'm(Z(dd#l)m*Z*dd$l)m+Z+dd%l)m,Z,dd&l)m-Z-dd'l)m.Z.dd(l)m/Z/dd)l)m0Z0dd*l)m1Z1dd+l)m2Z2dd,l)m3Z3dd-l)m4Z4dd.l)m5Z5dd/l6m7Z7dd0l8m9Z9dd1l:m;Z;dd2l<m=Z=Gd3�d4��Z>Gd5�d6e>��Z?ej@d7��ej@d7d8��Gd9�d:e>������ZAej@d;��ej@d;d<��e?�Bd=��Gd>�d?e?��������ZCej@d@��ej@d@dA��e?�BdB��GdC�dDe?��������ZDej@dE��ej@dEdF��e?�BdG��GdH�dIe?��������ZEej@dJ��ej@dJdK��e?�BdL��e?�BdM��e?�BdN��GdO�dPe?������������ZFej@dQ��ej@dQdR��GdS�dTe>������ZGej@dU��ej@dUdV��GdW�dXe>������ZHej@dY��GdZ�d[e>����ZIej@d\��Gd]�d^e>����ZJGd_�d`e>��ZKej@da��Gdb�dceK����ZLej@dd��ej@ddde��Gdf�dgeK������ZMej@dh��ej@dhdi��Gdj�dkeK������ZNej@dl��ej@dldm��Gdn�doeK������ZOej@dp��ej@dpdq��Gdr�dseK������ZPej@dt��ej@dtdu��Gdv�dweK������ZQej@dx��Gdy�dze>����ZRej@d{��ej@d{d|��Gd}�d~e>������ZSGd�d�e>��ZTGd��d�eT��ZUGd��d�eT��ZVGd��d�eT��ZWGd��d�e>��ZXdS)��)�annotations)�abstractmethodN)�Any)�Callable)�cast)�	FrozenSet)�Iterator)�List)�MutableMapping)�Optional)�Sequence)�Set)�Tuple)�Type)�
TYPE_CHECKING)�Union)�NULLTYPE�)�	schemaobj)�BatchOperations)�
Operations�)�util)�sqla_compat)�Literal)�Insert)�Update)�BinaryExpression)�
ColumnElement)�conv)�quoted_name)�
TextClause)�Function)�CheckConstraint)�Column)�Computed)�
Constraint)�ForeignKeyConstraint)�Identity)�Index)�MetaData)�PrimaryKeyConstraint)�
SchemaItem)�Table)�UniqueConstraint)�TableClause)�
TypeEngine)�Rewriter)�MigrationContextc�b�eZdZUdZejd���Ze��Zde	d<d
d�Z
dd�Zd	S)�MigrateOperationz�base class for migration command and organization objects.

    This system is part of the operation extensibility API.

    .. seealso::

        :ref:`operation_objects`

        :ref:`operation_plugins`

        :ref:`customizing_revision`

    c��iS)z�A dictionary that may be used to store arbitrary information
        along with this :class:`.MigrateOperation` object.

        ���selfs �M/opt/cloudlinux/venv/lib64/python3.11/site-packages/alembic/operations/ops.py�infozMigrateOperation.infoIs	���	�zFrozenSet[Rewriter]�
_mutations�returnc��t��N��NotImplementedErrorr8s r:�reversezMigrateOperation.reverseS���!�!r<�Tuple[Any, ...]c��t�r@rAr8s r:�
to_diff_tuplezMigrateOperation.to_diff_tupleVrDr<N)r>r5)r>rE)�__name__�
__module__�__qualname__�__doc__r�memoized_propertyr;�	frozensetr=�__annotations__rCrGr7r<r:r5r5:s����������
�������'0�i�k�k�J�1�1�1�1�"�"�"�"�"�"�"�"�"�"r<r5c��eZdZdZej��Zed���Ze	dd���Z
e	dd
���Ze	ddd���Z
dd�Zdd�ZdS)�AddConstraintOpz&Represent an add constraint operation.c��t���r@rAr8s r:�constraint_typezAddConstraintOp.constraint_type_s��!�#�#�#r<�type_�strr>rc������fd�}|S)Nc�X���j����|j��|Sr@)�add_constraint_ops�dispatch_for�from_constraint)�klass�clsrSs ��r:�goz3AddConstraintOp.register_add_constraint.<locals>.goes,���6�C�"�/�/��6�6�u�7L�M�M�M��Lr<r7)r[rSr\s`` r:�register_add_constraintz'AddConstraintOp.register_add_constraintcs)����	�	�	�	�	�	��	r<�
constraintr'c�R�|j�|j��|��Sr@)rW�dispatch�__visit_name__)r[r^s  r:rYzAddConstraintOp.from_constraintks-��I�s�%�.�.�z�/H�I�I��
�
�	
r<N�migration_context�Optional[MigrationContext]c��dSr@r7)r9rbs  r:�
to_constraintzAddConstraintOp.to_constraintqs	��	
�r<�DropConstraintOpc�Z�t�|�����Sr@)rfrYrer8s r:rCzAddConstraintOp.reversews"���/�/��0B�0B�0D�0D�E�E�Er<�Tuple[str, Constraint]c�.�d|���fS)N�add_constraint�rer8s r:rGzAddConstraintOp.to_diff_tuplezs�� �$�"4�"4�"6�"6�7�7r<)rSrTr>r)r^r'r>rPr@)rbrcr>r')r>rf)r>rh)rHrIrJrKr�
DispatcherrW�propertyrR�classmethodr]rYrrerCrGr7r<r:rPrPZs�������0�0�(���*�*��
�$�$��X�$������[���
�
�
��[�
�
�>B�
�
�
�
��^�
�
F�F�F�F�8�8�8�8�8�8r<rP�drop_constraint�batch_drop_constraintc��eZdZdZ	dddd�dd�Zd d�Zd!d�Zed"d���Zd#d�Z	e	ddd�d$d���Z
e	dd%d���ZdS)&rfz&Represent a drop constraint operation.N��schema�_reverse�constraint_name�,Optional[sqla_compat._ConstraintNameDefined]�
table_namerTrS�
Optional[str]rsrt�Optional[AddConstraintOp]r>�Nonec�L�||_||_||_||_||_dSr@)rurwrRrsrt)r9rurwrSrsrts      r:�__init__zDropConstraintOp.__init__�s-�� /���$���$������ ��
�
�
r<rPc�Z�t�|�����Sr@)rPrYrer8s r:rCzDropConstraintOp.reverse�s"���.�.�t�/A�/A�/C�/C�D�D�Dr<�Tuple[str, SchemaItem]c�p�|jdkrd|���fSd|���fS)N�
foreignkey�	remove_fk�remove_constraint)rRrer8s r:rGzDropConstraintOp.to_diff_tuple�s@����<�/�/���!3�!3�!5�!5�6�6�'��);�);�)=�)=�>�>r<r^r'c	���ddddddd�}tj|��}|tj|j��|j|j||jt�|�����S)N�uniquer��primary�check)�unique_constraint�foreign_key_constraint�primary_key_constraint�check_constraint�column_check_constraint� table_or_column_check_constraint)rsrSrt)r�_table_for_constraint�constraint_name_or_none�namersrarPrY)r[r^�types�constraint_tables    r:rYz DropConstraintOp.from_constraint�s���"*�&2�&/� '�'.�07�

�
��'�<�Z�H�H���s��/�
��@�@��!�#�*��
�1�2�$�4�4�Z�@�@�
�
�
�	
r<c���|j�S|j���}|j|_t	j|��}|j|_|j|_|Std���)NzAconstraint cannot be produced; original constraint is not present)	rtrerur�rr�rwrs�
ValueError)r9r^r�s   r:rezDropConstraintOp.to_constraint�sk���=�$���4�4�6�6�J�"�2�J�O�*�@��L�L��$(�O��!�&*�k��#����5���
r<�rs�
operationsrc�J�|||||���}|�|��S)a
Drop a constraint of the given name, typically via DROP CONSTRAINT.

        :param constraint_name: name of the constraint.
        :param table_name: table name.
        :param type\_: optional, required on MySQL.  can be
         'foreignkey', 'primary', 'unique', or 'check'.
        :param schema: Optional schema name to operate within.  To control
         quoting of the schema outside of the default behavior, use
         the SQLAlchemy construct
         :class:`~sqlalchemy.sql.elements.quoted_name`.

        �rSrs��invoke)r[r�rurwrSrs�ops       r:roz DropConstraintOp.drop_constraint�s0��.�S��*�E�&�
I�
I�
I��� � ��$�$�$r<rc�r�|||jj||jj���}|�|��S)aIssue a "drop constraint" instruction using the
        current batch migration context.

        The batch form of this call omits the ``table_name`` and ``schema``
        arguments from the call.

        .. seealso::

            :meth:`.Operations.drop_constraint`

        r���implrwrsr�)r[r�rurSr�s     r:rpz&DropConstraintOp.batch_drop_constraint�sF��$�S���O�&���?�)�	
�
�
��� � ��$�$�$r<r@)rurvrwrTrSrxrsrxrtryr>rz)r>rP)r>r~)r^r'r>rf)r>r')r�rrurTrwrTrSrxrsrxr>rz)r�rrurTrSrxr>rz)rHrIrJrKr|rCrGrnrYrerorpr7r<r:rfrf~s������1�0� $�	
!�!%�.2�
!�
!�
!�
!�
!�
!�E�E�E�E�?�?�?�?��
�
�
��[�
�&���� � $�%�!%�%�%�%�%�%��[�%�2�
 $�	%�%�%�%��[�%�%�%r<rf�create_primary_key�batch_create_primary_keyr�c�~�eZdZdZdZdd�dd�Zed d���Z	d!d"d�Zedd�d#d���Z	ed$d���Z
dS)%�CreatePrimaryKeyOpz)Represent a create primary key operation.�
primarykeyNr�rurvrwrT�columns�
Sequence[str]rsrx�kwrr>rzc�L�||_||_||_||_||_dSr@�rurwr�rsr��r9rurwr�rsr�s      r:r|zCreatePrimaryKeyOp.__init__�,�� /���$�������������r<r^r'c���tj|��}td|��}|tj|j��|j|j���fd|ji|j��S)Nr,rs)	rr�rr�r�r��keysrs�dialect_kwargs)r[r^r��
pk_constraints    r:rYz"CreatePrimaryKeyOp.from_constraints��&�<�Z�H�H���3�Z�@�@�
��s��/�
�0B�C�C��!��!�&�&�(�(�
�
�$�*�	
�
�*�
�
�	
r<rbrcr,c��tj|��}|j|j|j|jfd|ji|j��S�Nrs)r�
SchemaObjectsr�rurwr�rsr��r9rb�
schema_objs   r:rez CreatePrimaryKeyOp.to_constraintsY���,�->�?�?�
�0�z�0�� ��O��L�
�
��;�	
�
�g�
�
�	
r<r�r�	List[str]c�J�|||||���}|�|��S)a"Issue a "create primary key" instruction using the current
        migration context.

        e.g.::

            from alembic import op

            op.create_primary_key("pk_my_table", "my_table", ["id", "version"])

        This internally generates a :class:`~sqlalchemy.schema.Table` object
        containing the necessary columns, then generates a new
        :class:`~sqlalchemy.schema.PrimaryKeyConstraint`
        object which it then associates with the
        :class:`~sqlalchemy.schema.Table`.
        Any event listeners associated with this action will be fired
        off normally.   The :class:`~sqlalchemy.schema.AddConstraint`
        construct is ultimately used to generate the ALTER statement.

        :param constraint_name: Name of the primary key constraint.  The name
         is necessary so that an ALTER statement can be emitted.  For setups
         that use an automated naming scheme such as that described at
         :ref:`sqla:constraint_naming_conventions`
         ``name`` here can be ``None``, as the event listener will
         apply the name to the constraint object when it is associated
         with the table.
        :param table_name: String name of the target table.
        :param columns: a list of string column names to be applied to the
         primary key constraint.
        :param schema: Optional schema name to operate within.  To control
         quoting of the schema outside of the default behavior, use
         the SQLAlchemy construct
         :class:`~sqlalchemy.sql.elements.quoted_name`.

        r�r�)r[r�rurwr�rsr�s       r:r�z%CreatePrimaryKeyOp.create_primary_key(s1��X�S��*�g�f�
E�
E�
E��� � ��$�$�$r<rc�r�|||jj||jj���}|�|��S)aIssue a "create primary key" instruction using the
        current batch migration context.

        The batch form of this call omits the ``table_name`` and ``schema``
        arguments from the call.

        .. seealso::

            :meth:`.Operations.create_primary_key`

        r�r�)r[r�rur�r�s     r:r�z+CreatePrimaryKeyOp.batch_create_primary_keyWsF��$�S���O�&���?�)�	
�
�
��� � ��$�$�$r<�rurvrwrTr�r�rsrxr�rr>rz)r^r'r>r�r@)rbrcr>r,)r�rrurxrwrTr�r�rsrxr>rz)r�rrurTr�r�r>rz)rHrIrJrKrRr|rnrYrer�r�r7r<r:r�r��s�������4�3�"�O�!%�

�
�
�
�
�
��	
�	
�	
��[�	
�?C�
�
�
�
�
��!%�,%�,%�,%�,%�,%��[�,%�\�%�%�%��[�%�%�%r<r��create_unique_constraint�batch_create_unique_constraintr�c�~�eZdZdZdZdd�dd�Zedd���Z	d d!d�Zedd�d"d���Z	ed#d���Z
dS)$�CreateUniqueConstraintOpz/Represent a create unique constraint operation.r�Nr�rurvrwrTr�r�rsrxr�rr>rzc�L�||_||_||_||_||_dSr@r�r�s      r:r|z!CreateUniqueConstraintOp.__init__|r�r<r^r'c�@�tj|��}td|��}i}|jr
|j|d<|jr
|j|d<|�|j��|tj|j��|jd�|j	D��fd|j
i|��S)Nr/�
deferrable�	initiallyc��g|]	}|j��
Sr7)r�)�.0�cs  r:�
<listcomp>z<CreateUniqueConstraintOp.from_constraint.<locals>.<listcomp>�s��3�3�3��Q�V�3�3�3r<rs)rr�rr�r��updater�r�r�r�rs)r[r^r��
uq_constraintr�s     r:rYz(CreateUniqueConstraintOp.from_constraint�s���
'�<�Z�H�H���/��<�<�
����#�	8�,�7�B�|���"�	6�+�5�B�{�O�
�	�	�-�.�/�/�/��s��/�
�0B�C�C��!�3�3�]�2�3�3�3�
�
�$�*�	
�
�
�
�	
r<rbrcr/c��tj|��}|j|j|j|jfd|ji|j��Sr�)rr�r�rurwr�rsr�r�s   r:rez&CreateUniqueConstraintOp.to_constraint�sY���,�->�?�?�
�+�z�+�� ��O��L�
�
��;�	
�
�g�
�
�	
r<r�rc�F�||||fd|i|��}|�|��S)a�Issue a "create unique constraint" instruction using the
        current migration context.

        e.g.::

            from alembic import op
            op.create_unique_constraint("uq_user_name", "user", ["name"])

        This internally generates a :class:`~sqlalchemy.schema.Table` object
        containing the necessary columns, then generates a new
        :class:`~sqlalchemy.schema.UniqueConstraint`
        object which it then associates with the
        :class:`~sqlalchemy.schema.Table`.
        Any event listeners associated with this action will be fired
        off normally.   The :class:`~sqlalchemy.schema.AddConstraint`
        construct is ultimately used to generate the ALTER statement.

        :param name: Name of the unique constraint.  The name is necessary
         so that an ALTER statement can be emitted.  For setups that
         use an automated naming scheme such as that described at
         :ref:`sqla:constraint_naming_conventions`,
         ``name`` here can be ``None``, as the event listener will
         apply the name to the constraint object when it is associated
         with the table.
        :param table_name: String name of the source table.
        :param columns: a list of string column names in the
         source table.
        :param deferrable: optional bool. If set, emit DEFERRABLE or
         NOT DEFERRABLE when issuing DDL for this constraint.
        :param initially: optional string. If set, emit INITIALLY <value>
         when issuing DDL for this constraint.
        :param schema: Optional schema name to operate within.  To control
         quoting of the schema outside of the default behavior, use
         the SQLAlchemy construct
         :class:`~sqlalchemy.sql.elements.quoted_name`.

        rsr�)r[r�rurwr�rsr�r�s        r:r�z1CreateUniqueConstraintOp.create_unique_constraint�s9��b�S��*�g�
K�
K�f�
K��
K�
K��� � ��$�$�$r<rc�t�|jj|d<|||jj|fi|��}|�|��S)a%Issue a "create unique constraint" instruction using the
        current batch migration context.

        The batch form of this call omits the ``source`` and ``schema``
        arguments from the call.

        .. seealso::

            :meth:`.Operations.create_unique_constraint`

        rs)r�rsrwr�)r[r�rur�r�r�s      r:r�z7CreateUniqueConstraintOp.batch_create_unique_constraint�sF��&"��-��8��
�S��*�/�"<�g�
L�
L��
L�
L��� � ��$�$�$r<r�)r^r'r>r�r@)rbrcr>r/)r�rrurxrwrTr�r�rsrxr�rr>r)
r�rrurTr�r�r�rr>r)rHrIrJrKrRr|rnrYrer�r�r7r<r:r�r�rs�������:�9��O�!%�

�
�
�
�
�
��
�
�
��[�
�.?C�

�

�

�

�

��!%�1%�1%�1%�1%�1%��[�1%�f�%�%�%��[�%�%�%r<r��create_foreign_key�batch_create_foreign_keyr�c	��eZdZdZdZd+d�Zd,d�Zed-d���Z	d.d/d�Z	edddddddd�d0d'���Z
eddddddd(�d1d*���ZdS)2�CreateForeignKeyOpz4Represent a create foreign key constraint operation.r�rurv�source_tablerT�referent_table�
local_colsr��remote_colsr�rr>rzc�Z�||_||_||_||_||_||_dSr@)rur�r�r�r�r�)r9rur�r�r�r�r�s       r:r|zCreateForeignKeyOp.__init__s6�� /���(���,���$���&�������r<� Tuple[str, ForeignKeyConstraint]c�.�d|���fS)N�add_fkrkr8s r:rGz CreateForeignKeyOp.to_diff_tuples���$�,�,�.�.�/�/r<r^r'c
��td|��}i}|jr
|j|d<|jr
|j|d<|jr
|j|d<|jr
|j|d<|jr
|j|d<t
j|��\
}}}}}}	}
}}}
||d<||d<|�|j	��|t
j
|j��||||	fi|��S)	Nr(�onupdate�ondeleter�r��	use_alter�
source_schema�referent_schema)rr�r�r�r�r�r�_fk_specr�r�r�r�)r[r^�
fk_constraintr�r�r��source_columns�
target_schema�target_table�target_columnsr�r�r�r�s              r:rYz"CreateForeignKeyOp.from_constraints,���3�Z�@�@�
����!�	4�*�3�B�z�N��!�	4�*�3�B�z�N��"�	6�+�5�B�{�O��#�	8�,�7�B�|���"�	6�+�5�B�{�O�
� ��/�/�	
�����������,��?�� -����
�	�	�-�.�/�/�/��s��/�
�0B�C�C�����
�
��

�
�	
r<Nrbrcr(c��tj|��}|j|j|j|j|j|jfi|j��Sr@)	rr�r�rur�r�r�r�r�r�s   r:rez CreateForeignKeyOp.to_constraint@sZ���,�->�?�?�
�0�z�0�� ������O���
�
��g�

�
�	
r<)r�r�r�r��matchr�r�r�rrxr�r�r��Optional[bool]r�r�r�r��
dialect_kwc�V�||||||f|||	||
|
|d�|��}|�|��S)a�Issue a "create foreign key" instruction using the
        current migration context.

        e.g.::

            from alembic import op

            op.create_foreign_key(
                "fk_user_address",
                "address",
                "user",
                ["user_id"],
                ["id"],
            )

        This internally generates a :class:`~sqlalchemy.schema.Table` object
        containing the necessary columns, then generates a new
        :class:`~sqlalchemy.schema.ForeignKeyConstraint`
        object which it then associates with the
        :class:`~sqlalchemy.schema.Table`.
        Any event listeners associated with this action will be fired
        off normally.   The :class:`~sqlalchemy.schema.AddConstraint`
        construct is ultimately used to generate the ALTER statement.

        :param constraint_name: Name of the foreign key constraint.  The name
         is necessary so that an ALTER statement can be emitted.  For setups
         that use an automated naming scheme such as that described at
         :ref:`sqla:constraint_naming_conventions`,
         ``name`` here can be ``None``, as the event listener will
         apply the name to the constraint object when it is associated
         with the table.
        :param source_table: String name of the source table.
        :param referent_table: String name of the destination table.
        :param local_cols: a list of string column names in the
         source table.
        :param remote_cols: a list of string column names in the
         remote table.
        :param onupdate: Optional string. If set, emit ON UPDATE <value> when
         issuing DDL for this constraint. Typical values include CASCADE,
         DELETE and RESTRICT.
        :param ondelete: Optional string. If set, emit ON DELETE <value> when
         issuing DDL for this constraint. Typical values include CASCADE,
         DELETE and RESTRICT.
        :param deferrable: optional bool. If set, emit DEFERRABLE or NOT
         DEFERRABLE when issuing DDL for this constraint.
        :param source_schema: Optional schema name of the source table.
        :param referent_schema: Optional schema name of the destination table.

        �r�r�r�r�r�r�r�r�)r[r�rur�r�r�r�r�r�r�r�r�r�r�r�r�s                r:r�z%CreateForeignKeyOp.create_foreign_keyMsf��J�S������
���!�'�+���
�
��
�
��� � ��$�$�$r<)r�r�r�r�r�r�rc�~�|||jj|||f|||	|jj||
|d�|��}
|�|
��S)a+Issue a "create foreign key" instruction using the
        current batch migration context.

        The batch form of this call omits the ``source`` and ``source_schema``
        arguments from the call.

        e.g.::

            with batch_alter_table("address") as batch_op:
                batch_op.create_foreign_key(
                    "fk_user_address",
                    "user",
                    ["user_id"],
                    ["id"],
                )

        .. seealso::

            :meth:`.Operations.create_foreign_key`

        r�r�)r[r�rur�r�r�r�r�r�r�r�r�r�r�s              r:r�z+CreateForeignKeyOp.batch_create_foreign_key�sp��L�S���O�&����
���!�$�/�0�+���
�
��
�
��� � ��$�$�$r<)rurvr�rTr�rTr�r�r�r�r�rr>rz)r>r�)r^r'r>r�r@)rbrcr>r()r�rrurxr�rTr�rTr�r�r�r�r�rxr�rxr�r�r�rxr�rxr�rxr�rxr�rr>rz)r�rrurTr�rTr�r�r�r�r�rxr�rxr�rxr�r�r�rxr�rxr�rr>rz)rHrIrJrKrRr|rGrnrYrer�r�r7r<r:r�r��s������?�>�"�O����� 0�0�0�0��&
�&
�&
��[�&
�R?C�
�
�
�
�
��#'�"&�%)�#'�#�'+�)-�S%�S%�S%�S%�S%��[�S%�j�*.�"&�"&�%)�#'�#�4%�4%�4%�4%�4%��[�4%�4%�4%r<r��create_check_constraint�batch_create_check_constraintr�r�r�c�~�eZdZdZdZdd�dd�Zed d���Z	d!d"d�Zedd�d#d���Z	ed$d���Z
dS)%�CreateCheckConstraintOpz.Represent a create check constraint operation.r�Nr�rurvrwrT�	condition�*Union[str, TextClause, ColumnElement[Any]]rsrxr�rr>rzc�L�||_||_||_||_||_dSr@)rurwr�rsr�)r9rurwr�rsr�s      r:r|z CreateCheckConstraintOp.__init__�s,�� /���$���"����������r<r^r'c���tj|��}td|��}|tj|j��|jtd|j��fd|ji|j��S)Nr$zColumnElement[Any]rs)rr�rr�r��sqltextrsr�)r[r^r��
ck_constraints    r:rYz'CreateCheckConstraintOp.from_constraint�s���'�<�Z�H�H���.�
�;�;�
��s��/�
�0B�C�C��!��%�}�'<�=�=�
�
�$�*�	
�
�*�
�
�	
r<rbrcr$c��tj|��}|j|j|j|jfd|ji|j��Sr�)rr�r�rurwr�rsr�r�s   r:rez%CreateCheckConstraintOp.to_constraintsY���,�->�?�?�
�*�z�*�� ��O��N�
�
��;�	
�
�g�
�
�	
r<r�r�(Union[str, BinaryExpression, TextClause]c�F�||||fd|i|��}|�|��S)aIssue a "create check constraint" instruction using the
        current migration context.

        e.g.::

            from alembic import op
            from sqlalchemy.sql import column, func

            op.create_check_constraint(
                "ck_user_name_len",
                "user",
                func.len(column("name")) > 5,
            )

        CHECK constraints are usually against a SQL expression, so ad-hoc
        table metadata is usually needed.   The function will convert the given
        arguments into a :class:`sqlalchemy.schema.CheckConstraint` bound
        to an anonymous table in order to emit the CREATE statement.

        :param name: Name of the check constraint.  The name is necessary
         so that an ALTER statement can be emitted.  For setups that
         use an automated naming scheme such as that described at
         :ref:`sqla:constraint_naming_conventions`,
         ``name`` here can be ``None``, as the event listener will
         apply the name to the constraint object when it is associated
         with the table.
        :param table_name: String name of the source table.
        :param condition: SQL expression that's the condition of the
         constraint. Can be a string or SQLAlchemy expression language
         structure.
        :param deferrable: optional bool. If set, emit DEFERRABLE or
         NOT DEFERRABLE when issuing DDL for this constraint.
        :param initially: optional string. If set, emit INITIALLY <value>
         when issuing DDL for this constraint.
        :param schema: Optional schema name to operate within.  To control
         quoting of the schema outside of the default behavior, use
         the SQLAlchemy construct
         :class:`~sqlalchemy.sql.elements.quoted_name`.

        rsr�)r[r�rurwr�rsr�r�s        r:r�z/CreateCheckConstraintOp.create_check_constraints9��f�S��*�i�
M�
M��
M�"�
M�
M��� � ��$�$�$r<rc�n�|||jj|fd|jji|��}|�|��S)a#Issue a "create check constraint" instruction using the
        current batch migration context.

        The batch form of this call omits the ``source`` and ``schema``
        arguments from the call.

        .. seealso::

            :meth:`.Operations.create_check_constraint`

        rsr�)r[r�rur�r�r�s      r:r�z5CreateCheckConstraintOp.batch_create_check_constraintGsW��&�S���O�&��
�
��?�)�	
�
�
�
��� � ��$�$�$r<)rurvrwrTr�r�rsrxr�rr>rz)r^r'r>r�r@)rbrcr>r$)r�rrurxrwrTr�r�rsrxr�rr>rz)
r�rrurTr�r�r�rr>rz)rHrIrJrKrRr|rnrYrer�r�r7r<r:r�r��s�������9�8��O�!%�

�
�
�
�
�
��
�
�
��[�
�?C�

�

�

�

�

��!%�3%�3%�3%�3%�3%��[�3%�j�%�%�%��[�%�%�%r<r��create_index�batch_create_indexc��eZdZdZddd�d$d�Zd%d�Zd&d�Zed'd���Z	d(d)d�Z	eddd�d*d ���Z
ed+d#���ZdS),�
CreateIndexOpz#Represent a create index operation.NF�rsr��
index_namerxrwrTr��4Sequence[Union[str, TextClause, ColumnElement[Any]]]rsr��boolr�rr>rzc�Z�||_||_||_||_||_||_dSr@)r�rwr�rsr�r�)r9r�rwr�rsr�r�s       r:r|zCreateIndexOp.__init__is2��%���$����������������r<�DropIndexOpc�Z�t�|�����Sr@)r��
from_index�to_indexr8s r:rCzCreateIndexOp.reversezs���%�%�d�m�m�o�o�6�6�6r<�Tuple[str, Index]c�.�d|���fS)N�	add_index�rr8s r:rGzCreateIndexOp.to_diff_tuple}����T�]�]�_�_�-�-r<�indexr*c��|j�J�||j|jjtj|��f|jj|jd�|j��S�Nr�)�tabler�r�_get_index_expressionsrsr��kwargs�r[rs  r:rzCreateIndexOp.from_index�sd���{�&�&�&��s��J��K���.�u�5�5�
��;�%��<�
�
��l�

�
�	
r<rbrcc��tj|��}|j|j|j|jf|j|jd�|j��}|Sr	)	rr�rr�rwr�rsr�r�)r9rbr��idxs    r:rzCreateIndexOp.to_index�sa���,�->�?�?�
��j���O��O��L�
��;��;�
�
��g�

�
���
r<r�r�/Sequence[Union[str, TextClause, Function[Any]]]c�H�||||f||d�|��}|�|��S)a'Issue a "create index" instruction using the current
        migration context.

        e.g.::

            from alembic import op

            op.create_index("ik_test", "t1", ["foo", "bar"])

        Functional indexes can be produced by using the
        :func:`sqlalchemy.sql.expression.text` construct::

            from alembic import op
            from sqlalchemy import text

            op.create_index("ik_test", "t1", [text("lower(foo)")])

        :param index_name: name of the index.
        :param table_name: name of the owning table.
        :param columns: a list consisting of string column names and/or
         :func:`~sqlalchemy.sql.expression.text` constructs.
        :param schema: Optional schema name to operate within.  To control
         quoting of the schema outside of the default behavior, use
         the SQLAlchemy construct
         :class:`~sqlalchemy.sql.elements.quoted_name`.
        :param unique: If True, create a unique index.

        :param quote:
            Force quoting of this column's name on or off, corresponding
            to ``True`` or ``False``. When left at its default
            of ``None``, the column identifier will be quoted according to
            whether the name is case sensitive (identifiers with at least one
            upper case character are treated as case sensitive), or if it's a
            reserved word. This flag is only needed to force quoting of a
            reserved word which is not known by the SQLAlchemy dialect.

        :param \**kw: Additional keyword arguments not mentioned above are
            dialect specific, and passed in the form
            ``<dialectname>_<argname>``.
            See the documentation regarding an individual dialect at
            :ref:`dialect_toplevel` for detail on documented arguments.

        r�r�)	r[r�r�rwr�rsr�r�r�s	         r:r�zCreateIndexOp.create_index�sJ��n�S��
�G�
�4:�6�
�
�MO�
�
��� � ��$�$�$r<rr�c�n�|||jj|fd|jji|��}|�|��S)z�Issue a "create index" instruction using the
        current batch migration context.

        .. seealso::

            :meth:`.Operations.create_index`

        rsr�)r[r�r�r�r�r�s      r:r�z CreateIndexOp.batch_create_index�sW��"�S���O�&��
�
��?�)�	
�
�
�
��� � ��$�$�$r<)r�rxrwrTr�r�rsrxr�r�r�rr>rz)r>r��r>r)rr*r>r�r@�rbrcr>r*)r�rr�rxrwrTr�rrsrxr�r�r�rr>rz)
r�rr�rTr�r�r�rr>rz)rHrIrJrKr|rCrGrnrrr�r�r7r<r:r�r�ds�������.�-�!%��������"7�7�7�7�.�.�.�.��	
�	
�	
��[�	
�?C�
�
�
�
�
��!%��9%�9%�9%�9%�9%��[�9%�v�%�%�%��[�%�%�%r<r��
drop_index�batch_drop_indexc��eZdZdZ	d!ddd�d"d�Zd#d�Zd$d�Zed%d���Z	d!d&d�Z	e	d!dd�d'd���Z
ed(d ���ZdS))r�z!Represent a drop index operation.Nrrr��Union[quoted_name, str, conv]rwrxrsrt�Optional[CreateIndexOp]r�rr>rzc�L�||_||_||_||_||_dSr@)r�rwrsrtr�)r9r�rwrsrtr�s      r:r|zDropIndexOp.__init__�s+��%���$������ ��
�����r<rc�.�d|���fS)N�remove_indexrr8s r:rGzDropIndexOp.to_diff_tuple�����
�
���0�0r<r�c�Z�t�|�����Sr@)r�rrr8s r:rCzDropIndexOp.reverse	����'�'��
�
���8�8�8r<rr*c��|j�J�||jf|jj|jjt�|��d�|j��S)N)rwrsrt)r
r�rsr�rrr
s  r:rzDropIndexOp.from_indexs`���{�&�&�&��s��J�
��{�'��;�%�"�-�-�e�4�4�	
�
�
�l�
�
�	
r<rbrcc��tj|��}|j|j|j|jr|jjndgfd|ji|j��S)N�xrs)	rr�rr�rwrtr�rsr�r�s   r:rzDropIndexOp.to_indexsk���,�->�?�?�
� �z���O��O�%)�]�=�D�M�!�!���
�
��;�	
�
�g�
�
�	
r<r�r�rrTc�D�||f||d�|��}|�|��S)aQIssue a "drop index" instruction using the current
        migration context.

        e.g.::

            drop_index("accounts")

        :param index_name: name of the index.
        :param table_name: name of the owning table.  Some
         backends such as Microsoft SQL Server require this.
        :param schema: Optional schema name to operate within.  To control
         quoting of the schema outside of the default behavior, use
         the SQLAlchemy construct
         :class:`~sqlalchemy.sql.elements.quoted_name`.
        :param \**kw: Additional keyword arguments not mentioned above are
            dialect specific, and passed in the form
            ``<dialectname>_<argname>``.
            See the documentation regarding an individual dialect at
            :ref:`dialect_toplevel` for detail on documented arguments.

        �rwrsr�)r[r�r�rwrsr�r�s       r:rzDropIndexOp.drop_index&s6��>�S��
H�
�6�
H�
H�R�
H�
H��� � ��$�$�$r<rc�l�||f|jj|jjd�|��}|�|��S)z�Issue a "drop index" instruction using the
        current batch migration context.

        .. seealso::

            :meth:`.Operations.drop_index`

        r$r�)r[r�r�r�r�s     r:rzDropIndexOp.batch_drop_indexHsR���S��
�!��1��?�)�
�
��	
�
��� � ��$�$�$r<r@)r�rrwrxrsrxrtrr�rr>rzr)r>r�)rr*r>r�r)r�rr�rTrwrxrsrxr�rr>rz)r�rr�rTr�rr>rz)rHrIrJrKr|rGrCrnrrrrr7r<r:r�r��s
������,�+�
%)�
�
!%�,0�

�
�
�
�
�
�1�1�1�1�9�9�9�9��
�
�
��[�
�?C�

�

�

�

�

��
%)�	%�!%�
%�%�%�%�%��[�%�B�%�%�%��[�%�%�%r<r��create_tablec�v�eZdZdZdddd�d#d�Zd$d�Zd%d�Zedd�d&d���Z	d'd(d�Z	ed)d"���Z
dS)*�
CreateTableOpz#Represent a create table operation.NF)rs�_namespace_metadata�_constraints_includedrwrTr��Sequence[SchemaItem]rsrxr)�Optional[MetaData]r*r�r�rr>rzc��||_||_||_|�di��|_|�dd��|_|�dd��|_||_||_||_	dS)Nr;�comment�prefixes)
rwr�rs�popr;r.r/r�r)r*)r9rwr�rsr)r*r�s       r:r|zCreateTableOp.__init__bsu��%����������F�F�6�2�&�&��	��v�v�i��.�.������z�4�0�0��
����#6�� �%:��"�"�"r<�DropTableOpc�h�t�|���|j���S)N�r))r1�
from_table�to_tabler)r8s r:rCzCreateTableOp.reversevs/���%�%��M�M�O�O��1I�&�
�
�	
r<�Tuple[str, Table]c�.�d|���fS)N�	add_table�r5r8s r:rGzCreateTableOp.to_diff_tuple{rr<r3r
r.c���|�|j}||jt|j��t|j��zf|j|d|jt|j��t|j	��d�|j
��S)NT)rsr)r*r.r;r/)�metadatar��listr��constraintsrsr.�dictr;�	_prefixesr�r[r
r)s   r:r4zCreateTableOp.from_table~s����&�"'�.���s��J����M�M�D��!2�3�3�3�
��<� 3�#'��M��e�j�!�!��%�/�*�*�
�
��l�
�
�	
r<rbrcc	�
�tj|��}|j|jg|j�R|j|jrt|j��ng|j|j	r|j	�
��ni|jd�|j��S)N)rsr/r.r;r*)
rr�r
rwr�rsr/r<r.r;�copyr*r�r�s   r:r5zCreateTableOp.to_table�s����,�->�?�?�
��z���O�	
�
�\�	
�	
��;�,0�M�A�T�$�-�(�(�(�r��L�%)�Y�6�����!�!�!�B�"&�"<�	
�	
��g�	
�	
�		
r<r�rr-c�@�|||fi|��}|�|��S)aMIssue a "create table" instruction using the current migration
        context.

        This directive receives an argument list similar to that of the
        traditional :class:`sqlalchemy.schema.Table` construct, but without the
        metadata::

            from sqlalchemy import INTEGER, VARCHAR, NVARCHAR, Column
            from alembic import op

            op.create_table(
                "account",
                Column("id", INTEGER, primary_key=True),
                Column("name", VARCHAR(50), nullable=False),
                Column("description", NVARCHAR(200)),
                Column("timestamp", TIMESTAMP, server_default=func.now()),
            )

        Note that :meth:`.create_table` accepts
        :class:`~sqlalchemy.schema.Column`
        constructs directly from the SQLAlchemy library.  In particular,
        default values to be created on the database side are
        specified using the ``server_default`` parameter, and not
        ``default`` which only specifies Python-side defaults::

            from alembic import op
            from sqlalchemy import Column, TIMESTAMP, func

            # specify "DEFAULT NOW" along with the "timestamp" column
            op.create_table(
                "account",
                Column("id", INTEGER, primary_key=True),
                Column("timestamp", TIMESTAMP, server_default=func.now()),
            )

        The function also returns a newly created
        :class:`~sqlalchemy.schema.Table` object, corresponding to the table
        specification given, which is suitable for
        immediate SQL operations, in particular
        :meth:`.Operations.bulk_insert`::

            from sqlalchemy import INTEGER, VARCHAR, NVARCHAR, Column
            from alembic import op

            account_table = op.create_table(
                "account",
                Column("id", INTEGER, primary_key=True),
                Column("name", VARCHAR(50), nullable=False),
                Column("description", NVARCHAR(200)),
                Column("timestamp", TIMESTAMP, server_default=func.now()),
            )

            op.bulk_insert(
                account_table,
                [
                    {"name": "A1", "description": "account 1"},
                    {"name": "A2", "description": "account 2"},
                ],
            )

        :param table_name: Name of the table
        :param \*columns: collection of :class:`~sqlalchemy.schema.Column`
         objects within
         the table, as well as optional :class:`~sqlalchemy.schema.Constraint`
         objects
         and :class:`~.sqlalchemy.schema.Index` objects.
        :param schema: Optional schema name to operate within.  To control
         quoting of the schema outside of the default behavior, use
         the SQLAlchemy construct
         :class:`~sqlalchemy.sql.elements.quoted_name`.
        :param \**kw: Other keyword arguments are passed to the underlying
         :class:`sqlalchemy.schema.Table` object created for the command.

        :return: the :class:`~sqlalchemy.schema.Table` object corresponding
         to the parameters given.

        r�)r[r�rwr�r�r�s      r:r&zCreateTableOp.create_table�s2��j�S��W�
+�
+��
+�
+��� � ��$�$�$r<)rwrTr�r+rsrxr)r,r*r�r�rr>rz)r>r1�r>r6)r
r.r)r,r>r(r@�rbrcr>r.)
r�rrwrTr�r-r�rr>r.)rHrIrJrKr|rCrGrnr4r5r&r7r<r:r(r(^s�������-�-�!%�26�&+�;�;�;�;�;�;�(
�
�
�
�
.�.�.�.��HL�
�
�
�
�
��[�
�2?C�
�
�
�
�
� �U%�U%�U%��[�U%�U%�U%r<r(�
drop_tablec�|�eZdZdZdddd�d"d�Zd#d�Zd$d�Zedd�d%d���Z	d&d'd�Z	edd�d(d!���Z
dS))r1z!Represent a drop table operation.N�rs�table_kwrtrwrTrsrxrI�"Optional[MutableMapping[Any, Any]]rt�Optional[CreateTableOp]r>rzc��||_||_|pi|_|j�dd��|_|j�dd��|_|j�dd��|_||_dS)Nr.r;r/)rwrsrIr0r.r;r/rt)r9rwrsrIrts     r:r|zDropTableOp.__init__ss��%������ ��B��
��}�(�(��D�9�9����M�%�%�f�d�3�3��	��
�)�)�*�d�;�;��
� ��
�
�
r<r6c�.�d|���fS)N�remove_tabler9r8s r:rGzDropTableOp.to_diff_tuplerr<r(c�Z�t�|�����Sr@)r(r4r5r8s r:rCzDropTableOp.reverserr<r3r
r.r)r,c	���||j|j|jt|j��t|j��d�|j�t�	||������S)N)r.r;r/r3rH)
r�rsr.r>r;r<r?rr(r4r@s   r:r4zDropTableOp.from_tables|���s��J��<� �=��U�Z�(�(� ���1�1����,�	�#�-�-��+>�.���
�
�
�	
r<rbrcc	�L�|jr
|jj}ng}tj|��}|j|jg|�R|j|jr|j���ni|j	rt|j	��ng|j|jr|jjndd�|j
��}|S)NF)r.r;r/rsr*)rtr�rr�r
rwr.r;rBr/r<rsr*rI)r9rb�cols_and_constraintsr��ts     r:r5zDropTableOp.to_table,s����=�	&�#'�=�#8� � �#%� ��,�->�?�?�
��J���O�
�
!�
�
��L�%)�Y�6�����!�!�!�B�,0�M�A�T�$�-�(�(�(�r��;��}�#�$�-�"E�"E��
�
��m�
�
���r<r�r�rr�rc�L�||||���}|�|��dS)a8Issue a "drop table" instruction using the current
        migration context.


        e.g.::

            drop_table("accounts")

        :param table_name: Name of the table
        :param schema: Optional schema name to operate within.  To control
         quoting of the schema outside of the default behavior, use
         the SQLAlchemy construct
         :class:`~sqlalchemy.sql.elements.quoted_name`.
        :param \**kw: Other keyword arguments are passed to the underlying
         :class:`sqlalchemy.schema.Table` object created for the command.

        )rsrINr�)r[r�rwrsr�r�s      r:rFzDropTableOp.drop_tableCs4��4�S��F�R�
8�
8�
8�����"�����r<)
rwrTrsrxrIrJrtrKr>rzrD)r>r()r
r.r)r,r>r1r@rE)
r�rrwrTrsrxr�rr>rz)rHrIrJrKr|rGrCrnr4r5rFr7r<r:r1r1s�������+�+�!%�7;�,0�
!�!�!�!�!�!� 1�1�1�1�9�9�9�9��HL�
�
�
�
�
��[�
�$?C������.�!%�������[���r<r1c� �eZdZdZdd�dd
�ZdS)�AlterTableOpz#Represent an alter table operation.Nr�rwrTrsrxr>rzc�"�||_||_dSr@r$)r9rwrss   r:r|zAlterTableOp.__init__ds��%�������r<)rwrTrsrxr>rz)rHrIrJrKr|r7r<r:rVrVas=������-�-�!%�	�������r<rV�rename_tablec�H��eZdZdZdd�d�fd�Zedd�dd���Z�xZS)�
RenameTableOpz#Represent a rename table operation.Nr��old_table_namerT�new_table_namersrxr>rzc�\��t���||���||_dS�Nr�)�superr|r\)r9r[r\rs�	__class__s    �r:r|zRenameTableOp.__init__rs0���	��������7�7�7�,����r<r�rc�H�||||���}|�|��S)alEmit an ALTER TABLE to rename a table.

        :param old_table_name: old name.
        :param new_table_name: new name.
        :param schema: Optional schema name to operate within.  To control
         quoting of the schema outside of the default behavior, use
         the SQLAlchemy construct
         :class:`~sqlalchemy.sql.elements.quoted_name`.

        r�r�)r[r�r[r\rsr�s      r:rXzRenameTableOp.rename_table|s.��&�S����
?�
?�
?��� � ��$�$�$r<)r[rTr\rTrsrxr>rz)
r�rr[rTr\rTrsrxr>rz)rHrIrJrKr|rnrX�
__classcell__�r`s@r:rZrZns��������-�-�!%�-�-�-�-�-�-�-�-��!%�
%�%�%�%�%��[�%�%�%�%�%r<rZ�create_table_comment�batch_create_table_commentc�t�eZdZdZddd�dd�Zeddd
�dd���Zedd�dd���Zd�Zdd�Z	d�Z
dS)�CreateTableCommentOpz)Represent a COMMENT ON `table` operation.N�rs�existing_commentrwrTr.rxrsrir>rzc�>�||_||_||_||_dSr@)rwr.rirs)r9rwr.rsris     r:r|zCreateTableCommentOp.__init__�s%��%������ 0�������r<�rirsr�rc�J�|||||���}|�|��S)arEmit a COMMENT ON operation to set the comment for a table.

        .. versionadded:: 1.0.6

        :param table_name: string name of the target table.
        :param comment: string value of the comment being registered against
         the specified table.
        :param existing_comment: String value of a comment
         already registered on the specified table, used within autogenerate
         so that the operation is reversible, but not required for direct
         use.

        .. seealso::

            :meth:`.Operations.drop_table_comment`

            :paramref:`.Operations.alter_column.comment`

        rkr�)r[r�rwr.rirsr�s       r:rdz)CreateTableCommentOp.create_table_comment�s<��<�S���-��	
�
�
��� � ��$�$�$r<�rirc�r�||jj|||jj���}|�|��S)a�Emit a COMMENT ON operation to set the comment for a table
        using the current batch migration context.

        .. versionadded:: 1.6.0

        :param comment: string value of the comment being registered against
         the specified table.
        :param existing_comment: String value of a comment
         already registered on the specified table, used within autogenerate
         so that the operation is reversible, but not required for direct
         use.

        rkr�)r[r�r.rir�s     r:rez/CreateTableCommentOp.batch_create_table_comment�sF��,�S��O�&��-��?�)�	
�
�
��� � ��$�$�$r<c��|j�!t|j|j|j���St|j|j|j|j���S)�2Reverses the COMMENT ON operation against a table.Nrk)ri�DropTableCommentOprwr.rsrgr8s r:rCzCreateTableCommentOp.reverse�s_��� �(�%���!%���{����
�(����%�!%���{�	���
r<c�x�tj|��}|�|j|j|j���S)N)rsr.)rr�r
rwrsr.r�s   r:r5zCreateTableCommentOp.to_table�s=���,�->�?�?�
�����O�D�K��� �
�
�	
r<c�:�d|���|jfS)N�add_table_comment)r5rir8s r:rGz"CreateTableCommentOp.to_diff_tuples��#�T�]�]�_�_�d�6K�L�Lr<)
rwrTr.rxrsrxrirxr>rz)r�rrwrTr.rxrirxrsrxr>rz)r�rr.rxrirxr>rzr@)rHrIrJrKr|rnrdrerCr5rGr7r<r:rgrg�s�������
4�3�!%�*.�
�������+/� $�#%�#%�#%�#%�#%��[�#%�J�+/�%�%�%�%�%��[�%�:��� 
�
�
�
�M�M�M�M�Mr<rg�drop_table_comment�batch_drop_table_commentc�t�eZdZdZddd�dd�Zeddd�dd���Zedd�dd���Zd�Zdd�Z	d�Z
dS)rqz:Represent an operation to remove the comment from a table.NrhrwrTrsrxrir>rzc�0�||_||_||_dSr@)rwrirs)r9rwrsris    r:r|zDropTableCommentOp.__init__
s��%��� 0�������r<rkr�rc�H�||||���}|�|��S)a�Issue a "drop table comment" operation to
        remove an existing comment set on a table.

        .. versionadded:: 1.0.6

        :param table_name: string name of the target table.
        :param existing_comment: An optional string value of a comment already
         registered on the specified table.

        .. seealso::

            :meth:`.Operations.create_table_comment`

            :paramref:`.Operations.alter_column.comment`

        rkr�)r[r�rwrirsr�s      r:ruz%DropTableCommentOp.drop_table_comments/��4�S��.>�v�
N�
N�
N��� � ��$�$�$r<rmrc�p�||jj||jj���}|�|��S)a6Issue a "drop table comment" operation to
        remove an existing comment set on a table using the current
        batch operations context.

        .. versionadded:: 1.6.0

        :param existing_comment: An optional string value of a comment already
         registered on the specified table.

        rkr�)r[r�rir�s    r:rvz+DropTableCommentOp.batch_drop_table_comment5sC��$�S��O�&�-��?�)�
�
�
��
� � ��$�$�$r<c�D�t|j|j|j���S)rpr�)rgrwrirsr8s r:rCzDropTableCommentOp.reverseNs'��#��O�T�2�4�;�
�
�
�	
r<c�l�tj|��}|�|j|j���Sr^)rr�r
rwrsr�s   r:r5zDropTableCommentOp.to_tableTs0���,�->�?�?�
���������D�D�Dr<c�.�d|���fS)N�remove_table_commentr9r8s r:rGz DropTableCommentOp.to_diff_tupleYs��&��
�
���8�8r<)rwrTrsrxrirxr>rz)
r�rrwrTrirxrsrxr>rz)r�rrirxr>rzr@)rHrIrJrKr|rnrurvrCr5rGr7r<r:rqrqs�������
E�D�!%�*.�	�	�	�	�	�	��+/� $�
%�%�%�%�%��[�%�8�
+/�	%�%�%�%�%��[�%�0
�
�
�E�E�E�E�
9�9�9�9�9r<rq�alter_column�batch_alter_columnc
���eZdZdZddddddddddd�
d/�fd�Zd0d�Zd1d�Zd2d�Zeddddddddddd�
d3d)���Z	edddddddddddd*�d4d.���Z
�xZS)5�
AlterColumnOpz$Represent an alter column operation.NF)
rs�
existing_type�existing_server_default�existing_nullableri�modify_nullable�modify_comment�modify_server_default�modify_name�modify_typerwrT�column_namersrxr��
Optional[Any]r�rr�r�rir�r��$Optional[Union[str, Literal[False]]]r�r�r�r�r>rzc
����t���||���||_||_||_||_||_||_|	|_|
|_	||_
||_|
|_dSr^)
r_r|r�r�r�r�rir�r�r�r�r�r�)r9rwr�rsr�r�r�rir�r�r�r�r�r�r`s              �r:r|zAlterColumnOp.__init__bs}���"	������F��3�3�3�&���*���'>��$�!2��� 0���.���,���%:��"�&���&�������r<c
�<�g}|j|j|j}}}|j�9|�d||||j|j|jd�|j|jf��|j	�9|�d||||j|j|jd�|j|j	f��|j
dur9|�d||||j|j|jd�|j|j
f��|jdur9|�d||||j|j|jd	�|j|jf��|S)
Nr�)r�r�rir�)r�r�riF�modify_default)r�r�rir�)r�r�r�)rsrwr�r��appendr�r�rir�r�r�r�)r9�col_diffrs�tname�cnames     r:rGzAlterColumnOp.to_diff_tuple�s�����#�{�D�O�T�=M�u�����'��O�O�!����-1�-C� �8�,0�,A����&��$��
�
�
�$��+��O�O�%����)-�);� �8�,0�,A����*��(��
�
�
�$�%�U�2�2��O�O�$����-1�-C�)-�);�,0�,A���
�0��.��
�
�
� ��e�+�+��O�O�$����-1�-C�)-�);� �8�	���)��'��
�
�
�$�r<r�c��|jdup|jdup|jdup|jdu}|rdS|jD]}|�d��rdS�dS)NFT�modify_)r�r�r�r�r��
startswith)r9�hc1r�s   r:�has_changeszAlterColumnOp.has_changes�s���� ��,�
0��)��6�
0���t�+�
0��"�%�/�		��	��4��'�	�	�B��}�}�Y�'�'�
��t�t�
��5r<c���|j���}|j|d<|j|d<|j|d<|j|d<|j�
|j|d<|j�
|j|d<|jdur
|j|d<|j	dur
|j	|d	<d
�d�|D��D��}|D]-}d|z|vr$|d
|z}|d|z|d
|z<||d|z<�.|j
|j|jfd|j
i|��S)Nr�r�r�rir�r�Fr�r�c�<�h|]}|�|�d����S)r)�group)r��ms  r:�	<setcomp>z(AlterColumnOp.reverse.<locals>.<setcomp>�s8��
�
�
���
�
�G�G�A�J�J�
�
�
r<c�8�g|]}tjd|����S)z^(?:existing_|modify_)(.+)$)�rer�)r��ks  r:r�z)AlterColumnOp.reverse.<locals>.<listcomp>�s%��N�N�N�a�b�h�=�q�A�A�N�N�Nr<z	modify_%szexisting_%srs)r�rBr�r�r�rir�r�r�r�r`rwr�rs)r9r��all_keysr��swaps     r:rCzAlterColumnOp.reverse�sf��
�W�\�\�^�^��"�0��?��"&�"8����(,�(D��$�%�!%�!6������'� $� 0�B�}����+�$(�$8�B� �!��%�U�2�2�*.�*D�B�&�'���e�+�+�#'�#6�B�� �
�
�N�N�2�N�N�N�
�
�
���	+�	+�A��Q��"�$�$��-�!�+�,��(*�;��?�(;��=�1�$�%�&*��;��?�#���t�~��O�T�-�
�
�6:�k�
�EG�
�
�	
r<)
�nullabler.�server_default�new_column_namerSr�r�r�rirsr�rr�r.r�r�rS�-Optional[Union[TypeEngine, Type[TypeEngine]]]�.Optional[Union[str, bool, Identity, Computed]]c
�V�|||f|
|	|
|||||||d�
|��}|�|��S)a�Issue an "alter column" instruction using the
        current migration context.

        Generally, only that aspect of the column which
        is being changed, i.e. name, type, nullability,
        default, needs to be specified.  Multiple changes
        can also be specified at once and the backend should
        "do the right thing", emitting each change either
        separately or together as the backend allows.

        MySQL has special requirements here, since MySQL
        cannot ALTER a column without a full specification.
        When producing MySQL-compatible migration files,
        it is recommended that the ``existing_type``,
        ``existing_server_default``, and ``existing_nullable``
        parameters be present, if not being altered.

        Type changes which are against the SQLAlchemy
        "schema" types :class:`~sqlalchemy.types.Boolean`
        and  :class:`~sqlalchemy.types.Enum` may also
        add or drop constraints which accompany those
        types on backends that don't support them natively.
        The ``existing_type`` argument is
        used in this case to identify and remove a previous
        constraint that was bound to the type object.

        :param table_name: string name of the target table.
        :param column_name: string name of the target column,
         as it exists before the operation begins.
        :param nullable: Optional; specify ``True`` or ``False``
         to alter the column's nullability.
        :param server_default: Optional; specify a string
         SQL expression, :func:`~sqlalchemy.sql.expression.text`,
         or :class:`~sqlalchemy.schema.DefaultClause` to indicate
         an alteration to the column's default value.
         Set to ``None`` to have the default removed.
        :param comment: optional string text of a new comment to add to the
         column.

         .. versionadded:: 1.0.6

        :param new_column_name: Optional; specify a string name here to
         indicate the new name within a column rename operation.
        :param type\_: Optional; a :class:`~sqlalchemy.types.TypeEngine`
         type object to specify a change to the column's type.
         For SQLAlchemy types that also indicate a constraint (i.e.
         :class:`~sqlalchemy.types.Boolean`, :class:`~sqlalchemy.types.Enum`),
         the constraint is also generated.
        :param autoincrement: set the ``AUTO_INCREMENT`` flag of the column;
         currently understood by the MySQL dialect.
        :param existing_type: Optional; a
         :class:`~sqlalchemy.types.TypeEngine`
         type object to specify the previous type.   This
         is required for all MySQL column alter operations that
         don't otherwise specify a new type, as well as for
         when nullability is being changed on a SQL Server
         column.  It is also used if the type is a so-called
         SQLlchemy "schema" type which may define a constraint (i.e.
         :class:`~sqlalchemy.types.Boolean`,
         :class:`~sqlalchemy.types.Enum`),
         so that the constraint can be dropped.
        :param existing_server_default: Optional; The existing
         default value of the column.   Required on MySQL if
         an existing default is not being changed; else MySQL
         removes the default.
        :param existing_nullable: Optional; the existing nullability
         of the column.  Required on MySQL if the existing nullability
         is not being changed; else MySQL sets this to NULL.
        :param existing_autoincrement: Optional; the existing autoincrement
         of the column.  Used for MySQL's system of altering a column
         that specifies ``AUTO_INCREMENT``.
        :param existing_comment: string text of the existing comment on the
         column to be maintained.  Required on MySQL if the existing comment
         on the column is not being changed.

         .. versionadded:: 1.0.6

        :param schema: Optional schema name to operate within.  To control
         quoting of the schema outside of the default behavior, use
         the SQLAlchemy construct
         :class:`~sqlalchemy.sql.elements.quoted_name`.
        :param postgresql_using: String argument which will indicate a
         SQL expression to render within the Postgresql-specific USING clause
         within ALTER COLUMN.    This string is taken directly as raw SQL which
         must explicitly include any necessary quoting or escaping of tokens
         within the expression.

        )
rsr�r�r�rir�r�r�r�r�r�)r[r�rwr�r�r.r�r�rSr�r�r�rirsr��alts                r:rzAlterColumnOp.alter_columnsf��\�c���
��'�$;�/�-�'��"0�$�"�
�
��
�
�� � � ��%�%�%r<)r�r.r�r�rSr�r�r�ri�
insert_before�insert_afterrr�r�c��||jj|f|jj||	|
||||||||
d�|��}|�|��S)avIssue an "alter column" instruction using the current
        batch migration context.

        Parameters are the same as that of :meth:`.Operations.alter_column`,
        as well as the following option(s):

        :param insert_before: String name of an existing column which this
         column should be placed before, when creating the new table.

         .. versionadded:: 1.4.0

        :param insert_after: String name of an existing column which this
         column should be placed after, when creating the new table.  If
         both :paramref:`.BatchOperations.alter_column.insert_before`
         and :paramref:`.BatchOperations.alter_column.insert_after` are
         omitted, the column is inserted after the last existing column
         in the table.

         .. versionadded:: 1.4.0

        .. seealso::

            :meth:`.Operations.alter_column`


        )rsr�r�r�rir�r�r�r�r�r�r�r�)r[r�r�r�r.r�r�rSr�r�r�rir�r�r�r�s                r:r�z AlterColumnOp.batch_alter_column�sv��^�c��O�&��
��?�)�'�$;�/�-�'��"0�$�"�'�%�
�
��
�
��$� � ��%�%�%r<)rwrTr�rTrsrxr�r�r�rr�r�rirxr�r�r�r�r�rr�rxr�r�r�rr>rz�r>r�r>r�)r>r�)r�rrwrTr�rTr�r�r.r�r�rr�rxrSr�r�r�r�r�r�r�rirxrsrxr�rr>rz)r�rr�rTr�r�r.r�r�rr�rxrSr�r�r�r�r�r�r�rirxr�rxr�rxr�rr>rz)rHrIrJrKr|rGr�rCrnrr�rbrcs@r:r�r�]s]�������/�.�!%�'+�',�,0�*.�*.�?D�%*�%)�%)���������<N�N�N�N�`
�
�
�
�
�
�
�
�B�$(�8=�#�)-�?C�GK�
�,0�*.� $�#}&�}&�}&�}&�}&��[�}&�~�$(�8=�#�)-�?C�GK�
�,0�*.�'+�&*�#@&�@&�@&�@&�@&��[�@&�@&�@&�@&�@&r<r��
add_column�batch_add_columnc���eZdZdZdd�d!�fd�Zd"d�Zd#d�Zd$d�Zed%d���Z	ed&d���Z
edd�d'd���Zeddd�d(d ���Z�xZ
S))�AddColumnOpz"Represent an add column operation.Nr�rwrT�column�Column[Any]rsrxr�rr>rzc�j��t���||���||_||_dSr^)r_r|r�r�)r9rwr�rsr�r`s     �r:r|zAddColumnOp.__init__�s4���	������F��3�3�3��������r<�DropColumnOpc�X�t�|j|j|j��Sr@)r��from_column_and_tablenamersrwr�r8s r:rCzAddColumnOp.reverse�s'���5�5��K���$�+�
�
�	
r<�+Tuple[str, Optional[str], str, Column[Any]]c�,�d|j|j|jfS)Nr�)rsrwr�r8s r:rGzAddColumnOp.to_diff_tuple�s���d�k�4�?�D�K�H�Hr<r%c��|jSr@)r�r8s r:�	to_columnzAddColumnOp.to_column�s
���{�r<�colc�F�||jj||jj���Sr^)r
r�rs)r[r�s  r:�from_columnzAddColumnOp.from_column�s"���s�3�9�>�3�s�y�/?�@�@�@�@r<r�c��||||���Sr^r7�r[rsr�r�s    r:r�z%AddColumnOp.from_column_and_tablename�s���s�5�#�f�-�-�-�-r<r�rc�H�||||���}|�|��S)a�
Issue an "add column" instruction using the current
        migration context.

        e.g.::

            from alembic import op
            from sqlalchemy import Column, String

            op.add_column("organization", Column("name", String()))

        The :meth:`.Operations.add_column` method typically corresponds
        to the SQL command "ALTER TABLE... ADD COLUMN".    Within the scope
        of this command, the column's name, datatype, nullability,
        and optional server-generated defaults may be indicated.

        .. note::

            With the exception of NOT NULL constraints or single-column FOREIGN
            KEY constraints, other kinds of constraints such as PRIMARY KEY,
            UNIQUE or CHECK constraints **cannot** be generated using this
            method; for these constraints, refer to operations such as
            :meth:`.Operations.create_primary_key` and
            :meth:`.Operations.create_check_constraint`. In particular, the
            following :class:`~sqlalchemy.schema.Column` parameters are
            **ignored**:

            * :paramref:`~sqlalchemy.schema.Column.primary_key` - SQL databases
              typically do not support an ALTER operation that can add
              individual columns one at a time to an existing primary key
              constraint, therefore it's less ambiguous to use the
              :meth:`.Operations.create_primary_key` method, which assumes no
              existing primary key constraint is present.
            * :paramref:`~sqlalchemy.schema.Column.unique` - use the
              :meth:`.Operations.create_unique_constraint` method
            * :paramref:`~sqlalchemy.schema.Column.index` - use the
              :meth:`.Operations.create_index` method


        The provided :class:`~sqlalchemy.schema.Column` object may include a
        :class:`~sqlalchemy.schema.ForeignKey` constraint directive,
        referencing a remote table name. For this specific type of constraint,
        Alembic will automatically emit a second ALTER statement in order to
        add the single-column FOREIGN KEY constraint separately::

            from alembic import op
            from sqlalchemy import Column, INTEGER, ForeignKey

            op.add_column(
                "organization",
                Column("account_id", INTEGER, ForeignKey("accounts.id")),
            )

        The column argument passed to :meth:`.Operations.add_column` is a
        :class:`~sqlalchemy.schema.Column` construct, used in the same way it's
        used in SQLAlchemy. In particular, values or functions to be indicated
        as producing the column's default value on the database side are
        specified using the ``server_default`` parameter, and not ``default``
        which only specifies Python-side defaults::

            from alembic import op
            from sqlalchemy import Column, TIMESTAMP, func

            # specify "DEFAULT NOW" along with the column add
            op.add_column(
                "account",
                Column("timestamp", TIMESTAMP, server_default=func.now()),
            )

        :param table_name: String name of the parent table.
        :param column: a :class:`sqlalchemy.schema.Column` object
         representing the new column.
        :param schema: Optional schema name to operate within.  To control
         quoting of the schema outside of the default behavior, use
         the SQLAlchemy construct
         :class:`~sqlalchemy.sql.elements.quoted_name`.

        r�r�)r[r�rwr�rsr�s      r:r�zAddColumnOp.add_column�s/��n�S��V�F�
3�
3�
3��� � ��$�$�$r<)r�r�rr�r�c��i}|r||d<|r||d<||jj|fd|jji|��}|�|��S)z�Issue an "add column" instruction using the current
        batch migration context.

        .. seealso::

            :meth:`.Operations.add_column`

        r�r�rsr�)r[r�r�r�r�r�r�s       r:r�zAddColumnOp.batch_add_columnIs}��$���	0�"/�B����	.�!-�B�~��
�S��O�&��
�
��?�)�
��	
�
��� � ��$�$�$r<)
rwrTr�r�rsrxr�rr>rz)r>r��r>r�)r>r%)r�r%r>r�)rsrxr�rTr�r�r>r�)
r�rrwrTr�r�rsrxr>rz)
r�rr�r�r�rxr�rxr>rz)rHrIrJrKr|rCrGr�rnr�r�r�r�rbrcs@r:r�r��s@�������-�,�!%�
�
�
�
�
�
�
�
�
�
�
�
�
I�I�I�I�
�����A�A�A��[�A��.�.�.��[�.��!%�
W%�W%�W%�W%�W%��[�W%�r�(,�&*�
%�%�%�%�%��[�%�%�%�%�%r<r��drop_column�batch_drop_columnc���eZdZdZddd�d"�fd�Zd#d�Zd$d�Zed%d���Z	d&d'd�Z	edd�d(d���Z
ed)d!���Z�xZS)*r�z"Represent a drop column operation.NrrrwrTr�rsrxrt�Optional[AddColumnOp]r�rr>rzc�x��t���||���||_||_||_dSr^)r_r|r�r�rt)r9rwr�rsrtr�r`s      �r:r|zDropColumnOp.__init__os<���	������F��3�3�3�&������ ��
�
�
r<r�c�F�d|j|j|���fS)N�
remove_column)rsrwr�r8s r:rGzDropColumnOp.to_diff_tuple}s(��
��K��O��N�N���	
�	
r<r�c��|j�td���t�|j|j|jj��S)Nz;operation is not reversible; original column is not present)rtr�r�r�rsrwr�r8s r:rCzDropColumnOp.reverse�sK���=� ��1���
�
�4�4��K���$�-�*>�
�
�	
r<r�r�r�c
�^�|||j|t�|||�����S)Nrr)r�r�r�r�s    r:r�z&DropColumnOp.from_column_and_tablename�s=���s���H�� �:�:�6�5�#�N�N�	
�
�
�	
r<rbrcr%c��|j�|jjStj|��}|�|jt
��Sr@)rtr�rr�r�rr�s   r:r�zDropColumnOp.to_column�sA���=�$��=�'�'��,�->�?�?�
�� � ��!1�8�<�<�<r<r�r�rc�D�|||fd|i|��}|�|��S)ayIssue a "drop column" instruction using the current
        migration context.

        e.g.::

            drop_column("organization", "account_id")

        :param table_name: name of table
        :param column_name: name of column
        :param schema: Optional schema name to operate within.  To control
         quoting of the schema outside of the default behavior, use
         the SQLAlchemy construct
         :class:`~sqlalchemy.sql.elements.quoted_name`.
        :param mssql_drop_check: Optional boolean.  When ``True``, on
         Microsoft SQL Server only, first
         drop the CHECK constraint on the column using a
         SQL-script-compatible
         block that selects into a @variable from sys.check_constraints,
         then exec's a separate DROP CONSTRAINT for that constraint.
        :param mssql_drop_default: Optional boolean.  When ``True``, on
         Microsoft SQL Server only, first
         drop the DEFAULT constraint on the column using a
         SQL-script-compatible
         block that selects into a @variable from sys.default_constraints,
         then exec's a separate DROP CONSTRAINT for that default.
        :param mssql_drop_foreign_key: Optional boolean.  When ``True``, on
         Microsoft SQL Server only, first
         drop a single FOREIGN KEY constraint on the column using a
         SQL-script-compatible
         block that selects into a @variable from
         sys.foreign_keys/sys.foreign_key_columns,
         then exec's a separate DROP CONSTRAINT for that default.  Only
         works if the column has exactly one FK constraint which refers to
         it, at the moment.

        rsr�)r[r�rwr�rsr�r�s       r:r�zDropColumnOp.drop_column�s7��^�S��[�
>�
>��
>�2�
>�
>��� � ��$�$�$r<rc�l�||jj|fd|jji|��}|�|��S)z�Issue a "drop column" instruction using the current
        batch migration context.

        .. seealso::

            :meth:`.Operations.drop_column`

        rsr�)r[r�r�r�r�s     r:r�zDropColumnOp.batch_drop_column�sT���S��O�&��
�
��?�)�
��	
�
��� � ��$�$�$r<)rwrTr�rTrsrxrtr�r�rr>rzr�)r>r�)rsrxr�rTr�r�r>r�r@)rbrcr>r%)r�rrwrTr�rTrsrxr�rr>rz)r�rr�rTr�rr>rz)
rHrIrJrKr|rGrCrnr�r�r�r�rbrcs@r:r�r�js�������-�,�!%�*.�
!�!�!�!�!�!�!�!�
�
�
�
�	
�	
�	
�	
��
�
�
��[�
�?C�=�=�=�=�=��!%�
/%�/%�/%�/%�/%��[�/%�b�%�%�%��[�%�%�%�%�%r<r��bulk_insertc�>�eZdZdZdd�dd�Zedd�dd���ZdS)�BulkInsertOpz"Represent a bulk insert operation.T��multiinsertr
�Union[Table, TableClause]�rows�
List[dict]r�r�r>rzc�0�||_||_||_dSr@)r
r�r�)r9r
r�r�s    r:r|zBulkInsertOp.__init__�s ����
���	�&����r<r�rc�L�||||���}|�|��dS)axIssue a "bulk insert" operation using the current
        migration context.

        This provides a means of representing an INSERT of multiple rows
        which works equally well in the context of executing on a live
        connection as well as that of generating a SQL script.   In the
        case of a SQL script, the values are rendered inline into the
        statement.

        e.g.::

            from alembic import op
            from datetime import date
            from sqlalchemy.sql import table, column
            from sqlalchemy import String, Integer, Date

            # Create an ad-hoc table to use for the insert statement.
            accounts_table = table(
                "account",
                column("id", Integer),
                column("name", String),
                column("create_date", Date),
            )

            op.bulk_insert(
                accounts_table,
                [
                    {
                        "id": 1,
                        "name": "John Smith",
                        "create_date": date(2010, 10, 5),
                    },
                    {
                        "id": 2,
                        "name": "Ed Williams",
                        "create_date": date(2007, 5, 27),
                    },
                    {
                        "id": 3,
                        "name": "Wendy Jones",
                        "create_date": date(2008, 8, 15),
                    },
                ],
            )

        When using --sql mode, some datatypes may not render inline
        automatically, such as dates and other special types.   When this
        issue is present, :meth:`.Operations.inline_literal` may be used::

            op.bulk_insert(
                accounts_table,
                [
                    {
                        "id": 1,
                        "name": "John Smith",
                        "create_date": op.inline_literal("2010-10-05"),
                    },
                    {
                        "id": 2,
                        "name": "Ed Williams",
                        "create_date": op.inline_literal("2007-05-27"),
                    },
                    {
                        "id": 3,
                        "name": "Wendy Jones",
                        "create_date": op.inline_literal("2008-08-15"),
                    },
                ],
                multiinsert=False,
            )

        When using :meth:`.Operations.inline_literal` in conjunction with
        :meth:`.Operations.bulk_insert`, in order for the statement to work
        in "online" (e.g. non --sql) mode, the
        :paramref:`~.Operations.bulk_insert.multiinsert`
        flag should be set to ``False``, which will have the effect of
        individual INSERT statements being emitted to the database, each
        with a distinct VALUES clause, so that the "inline" values can
        still be rendered, rather than attempting to pass the values
        as bound parameters.

        :param table: a table object which represents the target of the INSERT.

        :param rows: a list of dictionaries indicating rows.

        :param multiinsert: when at its default of True and --sql mode is not
           enabled, the INSERT statement will be executed using
           "executemany()" style, where all elements in the list of
           dictionaries are passed as bound parameters in a single
           list.   Setting this to False results in individual INSERT
           statements being emitted per parameter set, and is needed
           in those cases where non-literal values are present in the
           parameter sets.

        r�Nr�)r[r�r
r�r�r�s      r:r�zBulkInsertOp.bulk_insert�s5��R�S���+�
6�
6�
6�����"�����r<N)r
r�r�r�r�r�r>rz)
r�rr
r�r�r�r�r�r>rz)rHrIrJrKr|rnr�r7r<r:r�r��st������,�,�!�	'�	'�	'�	'�	'�	'��!�
i�i�i�i�i��[�i�i�ir<r��execute�
batch_executec�\�eZdZdZdd�dd
�Zedd�dd���Zedd�dd���ZdS)�ExecuteSQLOpz#Represent an execute SQL operation.N��execution_optionsr��&Union[Update, str, Insert, TextClause]r��Optional[dict[str, Any]]r>rzc�"�||_||_dSr@)r�r�)r9r�r�s   r:r|zExecuteSQLOp.__init__p	s�����!2����r<r�r�Union[str, TextClause, Update]c�F�|||���}|�|��S)a�
Execute the given SQL using the current migration context.

        The given SQL can be a plain string, e.g.::

            op.execute("INSERT INTO table (foo) VALUES ('some value')")

        Or it can be any kind of Core SQL Expression construct, such as
        below where we use an update construct::

            from sqlalchemy.sql import table, column
            from sqlalchemy import String
            from alembic import op

            account = table("account", column("name", String))
            op.execute(
                account.update()
                .where(account.c.name == op.inline_literal("account 1"))
                .values({"name": op.inline_literal("account 2")})
            )

        Above, we made use of the SQLAlchemy
        :func:`sqlalchemy.sql.expression.table` and
        :func:`sqlalchemy.sql.expression.column` constructs to make a brief,
        ad-hoc table construct just for our UPDATE statement.  A full
        :class:`~sqlalchemy.schema.Table` construct of course works perfectly
        fine as well, though note it's a recommended practice to at least
        ensure the definition of a table is self-contained within the migration
        script, rather than imported from a module that may break compatibility
        with older migrations.

        In a SQL script context, the statement is emitted directly to the
        output stream.   There is *no* return result, however, as this
        function is oriented towards generating a change script
        that can run in "offline" mode.     Additionally, parameterized
        statements are discouraged here, as they *will not work* in offline
        mode.  Above, we use :meth:`.inline_literal` where parameters are
        to be used.

        For full interaction with a connected database where parameters can
        also be used normally, use the "bind" available from the context::

            from alembic import op

            connection = op.get_bind()

            connection.execute(
                account.update()
                .where(account.c.name == "account 1")
                .values({"name": "account 2"})
            )

        Additionally, when passing the statement as a plain string, it is first
        coerceed into a :func:`sqlalchemy.sql.expression.text` construct
        before being passed along.  In the less likely case that the
        literal SQL string contains a colon, it must be escaped with a
        backslash, as::

           op.execute(r"INSERT INTO table (foo) VALUES ('\:colon_value')")


        :param sqltext: Any legal SQLAlchemy expression, including:

        * a string
        * a :func:`sqlalchemy.sql.expression.text` construct.
        * a :func:`sqlalchemy.sql.expression.insert` construct.
        * a :func:`sqlalchemy.sql.expression.update`,
          :func:`sqlalchemy.sql.expression.insert`,
          or :func:`sqlalchemy.sql.expression.delete`  construct.
        * Any "executable" described in SQLAlchemy Core documentation,
          noting that no result set is returned.

        .. note::  when passing a plain string, the statement is coerced into
           a :func:`sqlalchemy.sql.expression.text` construct. This construct
           considers symbols with colons, e.g. ``:foo`` to be bound parameters.
           To avoid this, ensure that colon symbols are escaped, e.g.
           ``\:foo``.

        :param execution_options: Optional dictionary of
         execution options, will be passed to
         :meth:`sqlalchemy.engine.Connection.execution_options`.
        r�r�)r[r�r�r�r�s     r:r�zExecuteSQLOp.executey	s.��r�S��,=�
>�
>�
>��� � ��$�$�$r<c�2�|�|||���S)z�Execute the given SQL using the current migration context.

        .. seealso::

            :meth:`.Operations.execute`

        r�)r�)r[r�r�r�s    r:r�zExecuteSQLOp.batch_execute�	s'���{�{���3D��
�
�	
r<)r�r�r�r�r>rz)r�rr�r�r�r�r>rz)rHrIrJrKr|rnr�r�r7r<r:r�r�k	s�������.�-�7;�	3�3�3�3�3�3��7;�Y%�Y%�Y%�Y%�Y%��[�Y%�v�7;�
�
�
�
�
��[�
�
�
r<r�c�D�eZdZdZddd�Zdd	�Zdd�Zedd���ZdS)�OpContainerz-Represent a sequence of operations operation.r7�ops�Sequence[MigrateOperation]r>rzc�.�t|��|_dSr@)r<r�)r9r�s  r:r|zOpContainer.__init__�	s����9�9����r<r�c��|jSr@�r�r8s r:�is_emptyzOpContainer.is_empty�	s���8�|�r<rc�P�tt�|����Sr@)r<r��
_ops_as_diffsr8s r:�as_diffszOpContainer.as_diffs�	s���K�-�-�d�3�3�4�4�4r<�
migrations�Iterator[Tuple[Any, ...]]c#�K�|jD]R}t|d��r*|�td|����Ed{V���<|���V��SdS)Nr�r�)r��hasattrr�rrG)r[r�r�s   r:r�zOpContainer._ops_as_diffs�	s������.�	)�	)�B��r�5�!�!�
)��,�,�T�-��-D�-D�E�E�E�E�E�E�E�E�E�E��&�&�(�(�(�(�(�(�		)�	)r<N)r7)r�r�r>rzr�r�)r�r�r>r�)	rHrIrJrKr|r�r�rnr�r7r<r:r�r��	s{������7�7����������5�5�5�5��)�)�)��[�)�)�)r<r�c�2��eZdZdZdd�d�fd�Zdd
�Z�xZS)�ModifyTableOpszCContains a sequence of operations that all apply to a single Table.Nr�rwrTr�r�rsrxr>rzc�f��t���|��||_||_dSr@)r_r|rwrs)r9rwr�rsr`s    �r:r|zModifyTableOps.__init__
s/���	���������$�������r<c	��t|jttd�|jD������|j���S)Nc�6�g|]}|�����Sr7�rC�r�r�s  r:r�z*ModifyTableOps.reverse.<locals>.<listcomp>
� ��?�?�?��r�z�z�|�|�?�?�?r<)r�rs)r�rwr<�reversedr�rsr8s r:rCzModifyTableOps.reverse
sG����O��X�?�?�d�h�?�?�?�@�@�A�A��;�
�
�
�	
r<)rwrTr�r�rsrxr>rz)r>r��rHrIrJrKr|rCrbrcs@r:r�r�
sf�������M�M�!%�	�	�	�	�	�	�	�	�
�
�
�
�
�
�
�
r<r�c�:��eZdZdZ		dd�fd
�
Zdd
�Zdd�Z�xZS)�
UpgradeOpsz�contains a sequence of operations that would apply to the
    'upgrade' stream of a script.

    .. seealso::

        :ref:`customizing_revision`

    r7�upgradesr�r��
upgrade_tokenrTr>rzc�Z��t���|���||_dS�Nr�)r_r|r)r9r�rr`s   �r:r|zUpgradeOps.__init__ 
s.���
	�����S��!�!�!�*����r<�
downgrade_ops�DowngradeOpsc�p�ttd�|jD������|jdd�<|S)Nc�6�g|]}|�����Sr7r�r�s  r:r�z+UpgradeOps.reverse_into.<locals>.<listcomp>*
s ��6�6�6�r�b�j�j�l�l�6�6�6r<)r<r�r�)r9rs  r:�reverse_intozUpgradeOps.reverse_into(
sA��#��6�6�T�X�6�6�6�7�7� 
� 
�
��!�!�!���r<c�H�|�tg�����Sr)rrr8s r:rCzUpgradeOps.reverse.
s!��� � ��"�!5�!5�!5�6�6�6r<)r7r)r�r�rrTr>rz)rrr>r)r>r)rHrIrJrKr|rrCrbrcs@r:rr
s|���������+-�'�+�+�+�+�+�+�+�����7�7�7�7�7�7�7�7r<rc�0��eZdZdZ		dd
�fd
�
Zd�Z�xZS)rz�contains a sequence of operations that would apply to the
    'downgrade' stream of a script.

    .. seealso::

        :ref:`customizing_revision`

    r7�
downgradesr�r��downgrade_tokenrTr>rzc�Z��t���|���||_dSr)r_r|r)r9r�rr`s   �r:r|zDowngradeOps.__init__<
s.���
	�����S��!�!�!�.����r<c�t�tttd�|jD���������S)Nc�6�g|]}|�����Sr7r�r�s  r:r�z(DowngradeOps.reverse.<locals>.<listcomp>F
r�r<r�)rr<r�r�r8s r:rCzDowngradeOps.reverseD
s=����X�?�?�d�h�?�?�?�@�@�A�A�
�
�
�	
r<)r7r)r�r�rrTr>rzrrcs@r:rr2
sc���������+-�+�/�/�/�/�/�/�/�
�
�
�
�
�
�
r<rc���eZdZUdZded<de��dddddd�d d�Zed���Zej	d���Zed���Z
e
j	d���Z
ed!d���Zed"d���ZdS)#�MigrationScriptaprepresents a migration script.

    E.g. when autogenerate encounters this object, this corresponds to the
    production of an actual script file.

    A normal :class:`.MigrationScript` object would contain a single
    :class:`.UpgradeOps` and a single :class:`.DowngradeOps` directive.
    These are accessible via the ``.upgrade_ops`` and ``.downgrade_ops``
    attributes.

    In the case of an autogenerate operation that runs multiple times,
    such as the multiple database example in the "multidb" template,
    the ``.upgrade_ops`` and ``.downgrade_ops`` attributes are disabled,
    and instead these objects should be accessed via the ``.upgrade_ops_list``
    and ``.downgrade_ops_list`` list-based attributes.  These latter
    attributes are always available at the very least as single-element lists.

    .. seealso::

        :ref:`customizing_revision`

    r��
_needs_renderN)�message�imports�head�splice�branch_label�version_path�
depends_on�rev_idrx�upgrade_opsrrrrr�Set[str]rrrrr�#Optional[Union[str, Sequence[str]]]r>rzc��||_||_||_||_||_||_|	|_|
|_||_||_	dSr@)
rrrrrrrrrr)r9rrrrrrrrrrs           r:r|zMigrationScript.__init__d
sT�������������	����(���(���$���&���*����r<c�|�t|j��dkrtd���|jsdS|jdS)zzAn instance of :class:`.UpgradeOps`.

        .. seealso::

            :attr:`.MigrationScript.upgrade_ops_list`
        rzrThis MigrationScript instance has a multiple-entry list for UpgradeOps; please use the upgrade_ops_list attribute.Nr)�len�_upgrade_opsr�r8s r:rzMigrationScript.upgrade_ops}
sQ���t� �!�!�A�%�%��.���
�
�"�	(��4��$�Q�'�'r<c�z�tj|��|_|jD]}t|t��sJ��dSr@)r�to_listr$�
isinstancer)r9r�elems   r:rzMigrationScript.upgrade_ops�
sI�� �L��5�5����%�	0�	0�D��d�J�/�/�/�/�/�/�	0�	0r<c�|�t|j��dkrtd���|jsdS|jdS)z~An instance of :class:`.DowngradeOps`.

        .. seealso::

            :attr:`.MigrationScript.downgrade_ops_list`
        rzvThis MigrationScript instance has a multiple-entry list for DowngradeOps; please use the downgrade_ops_list attribute.Nr)r#�_downgrade_opsr�r8s r:rzMigrationScript.downgrade_ops�
sQ���t�"�#�#�a�'�'��0���
�
�$�	*��4��&�q�)�)r<c�z�tj|��|_|jD]}t|t��sJ��dSr@)rr&r*r'r)r9rr(s   r:rzMigrationScript.downgrade_ops�
sI��"�l�=�9�9����'�	2�	2�D��d�L�1�1�1�1�1�1�	2�	2r<�List[UpgradeOps]c��|jS)z�A list of :class:`.UpgradeOps` instances.

        This is used in place of the :attr:`.MigrationScript.upgrade_ops`
        attribute when dealing with a revision operation that does
        multiple autogenerate passes.

        )r$r8s r:�upgrade_ops_listz MigrationScript.upgrade_ops_list�
s
��� � r<�List[DowngradeOps]c��|jS)z�A list of :class:`.DowngradeOps` instances.

        This is used in place of the :attr:`.MigrationScript.downgrade_ops`
        attribute when dealing with a revision operation that does
        multiple autogenerate passes.

        )r*r8s r:�downgrade_ops_listz"MigrationScript.downgrade_ops_list�
s
���"�"r<)rrxrrrrrrxrrrrxrr�rrxrrxrr r>rz)r>r,)r>r/)
rHrIrJrKrN�setr|rmr�setterrr.r1r7r<r:rrJ
s���������."�!�!�!�"&��C�E�E�"�!%�&*�&*�:>�+�+�+�+�+�+�2�(�(��X�(�$��0�0���0�
�*�*��X�*�$��2�2���2�
�!�!�!��X�!��#�#�#��X�#�#�#r<r)Y�
__future__r�abcrr��typingrrrrr	r
rrr
rrrrr�sqlalchemy.typesr�r�baserrrrr�sqlalchemy.sql.dmlrr�sqlalchemy.sql.elementsrrr r!r"�sqlalchemy.sql.functionsr#�sqlalchemy.sql.schemar$r%r&r'r(r)r*r+r,r-r.r/�sqlalchemy.sql.selectabler0�sqlalchemy.sql.type_apir1�autogenerate.rewriterr2�runtime.migrationr3r5rP�register_operationrfr]r�r�r�r�r�r�r(r1rVrZrgrqr�r�r�r�r�r�r�rrrr7r<r:�<module>rCs/��"�"�"�"�"�"�������	�	�	�	�������������������������������������!�!�!�!�!�!������������������������������� � � � � � �������%�%�%�%�%�%�������!�!�!�!�!�!��������������������5�������)�)�)�)�)�)�)�)�)�)�)�)�8�8�8�8�8�8�5�5�5�5�5�5�,�,�,�,�,�,�3�3�3�3�3�3�2�2�2�2�2�2�1�1�1�1�1�1�5�5�5�5�5�5�,�,�,�,�,�,�.�.�.�.�.�.�0�0�0�0�0�0�:�:�:�:�:�:�.�.�.�.�.�.�+�+�+�+�+�+�.�.�.�.�.�.�:�:�:�:�:�:�0�0�0�0�0�0�+�+�+�+�+�+�6�6�6�6�6�6�5�5�5�5�5�5�2�2�2�2�2�2�0�0�0�0�0�0�4�4�4�4�4�4�"�"�"�"�"�"�"�"�@!8�!8�!8�!8�!8�&�!8�!8�!8�H���0�1�1�#��#�$5�7N�O�O�s%�s%�s%�s%�s%�'�s%�s%�P�O�2�1�s%�l���3�4�4�#��#��4����(�(�)A�B�B�t%�t%�t%�t%�t%��t%�t%�C�B���5�4�
t%�n���9�:�:�#��#�� @����(�(�)<�=�=�@%�@%�@%�@%�@%��@%�@%�>�=���;�:�
@%�F���3�4�4�#��#��4����(�(�)A�B�B�Y%�Y%�Y%�Y%�Y%��Y%�Y%�C�B���5�4�
Y%�x���8�9�9�#��#��>����(�(�);�<�<��(�(�)K�L�L��(�(�)B�C�C�%�%�%�%�%�o�%�%�D�C�M�L�=�<���:�9�%�D���~�.�.�#��#�N�4H�I�I�I%�I%�I%�I%�I%�$�I%�I%�J�I�/�.�I%�X���|�,�,�#��#�L�2D�E�E�g%�g%�g%�g%�g%�"�g%�g%�F�E�-�,�g%�T���~�.�.�^%�^%�^%�^%�^%�$�^%�^%�/�.�^%�B���|�,�,�]�]�]�]�]�"�]�]�-�,�]�@
�
�
�
�
�#�
�
�
����~�.�.�!%�!%�!%�!%�!%�L�!%�!%�/�.�!%�H���5�6�6�#��#��8���lM�lM�lM�lM�lM�<�lM�lM���7�6�lM�^���3�4�4�#��#��4���P9�P9�P9�P9�P9��P9�P9���5�4�P9�f���~�.�.�#��#�N�4H�I�I�b&�b&�b&�b&�b&�L�b&�b&�J�I�/�.�b&�J���|�,�,�#��#�L�2D�E�E�a%�a%�a%�a%�a%�,�a%�a%�F�E�-�,�a%�H���}�-�-�#��#�M�3F�G�G�@%�@%�@%�@%�@%�<�@%�@%�H�G�.�-�@%�F���}�-�-�x�x�x�x�x�#�x�x�.�-�x�v���y�)�)�#��#�I��?�?�y
�y
�y
�y
�y
�#�y
�y
�@�?�*�)�y
�x)�)�)�)�)�"�)�)�)�.
�
�
�
�
�[�
�
�
�,7�7�7�7�7��7�7�7�8
�
�
�
�
�;�
�
�
�0y#�y#�y#�y#�y#�&�y#�y#�y#�y#�y#r<

Hacked By AnonymousFox1.0, Coded By AnonymousFox