File: //opt/alt/python37/lib/python3.7/site-packages/alembic/operations/__pycache__/base.cpython-37.pyc
B
�M!Vr@ � @ s� d dl mZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ d d l Z d d l
Z
d
Zyd dlm
Z
W n d Z
Y nX G dd
� d
ej�ZG dd� de�Zd S )� )�contextmanager� )�util)�sqla_compat� )�batch)� schemaobj)�exec_N)�
Operations�BatchOperations)�convc @ s� e Zd ZdZe�� Zddd�Zeddd��Z edd� �Z
eed d
� ��Zedddde�
� de�
� dfd
d��Zdd� Zdd� Zdd� Zddd�Zdd� ZdS )r
a� Define high level migration operations.
Each operation corresponds to some schema migration operation,
executed against a particular :class:`.MigrationContext`
which in turn represents connectivity to a database,
or a file output stream.
While :class:`.Operations` is normally configured as
part of the :meth:`.EnvironmentContext.run_migrations`
method called from an ``env.py`` script, a standalone
:class:`.Operations` instance can be
made for use cases external to regular Alembic
migrations by passing in a :class:`.MigrationContext`::
from alembic.migration import MigrationContext
from alembic.operations import Operations
conn = myengine.connect()
ctx = MigrationContext.configure(conn)
op = Operations(ctx)
op.alter_column("t", "c", nullable=True)
Note that as of 0.8, most of the methods on this class are produced
dynamically using the :meth:`.Operations.register_operation`
method.
Nc C s. || _ |dkr|j| _n|| _t�|�| _dS )z�Construct a new :class:`.Operations`
:param migration_context: a :class:`.MigrationContext`
instance.
N)�migration_context�implr Z
SchemaObjectsZ
schema_obj)�selfr
r � r �H/opt/alt/python37/lib/python3.7/site-packages/alembic/operations/base.py�__init__4 s
zOperations.__init__c s � ��fdd�}|S )a� Register a new operation for this class.
This method is normally used to add new operations
to the :class:`.Operations` class, and possibly the
:class:`.BatchOperations` class as well. All Alembic migration
operations are implemented via this system, however the system
is also available as a public API to facilitate adding custom
operations.
.. versionadded:: 0.8.0
.. seealso::
:ref:`operation_plugins`
c
s8 �d krt | ��}|j}nt | ��}|j}t�|�}|d }|dd� ddgksTt�dg|dd�<