File: //opt/alt/python27/lib/python2.7/site-packages/alembic/operations/base.pyc
�
�M!Vc           @   s�   d  d l  m Z d d l m Z d d l m Z d d l m Z d d l m Z d d l m Z d  d	 l	 Z	 d  d	 l
 Z
 d
 d f Z y d  d l m
 Z
 Wn
 e Z
 n Xd
 e j f d
 �  �  YZ d e f d �  �  YZ d	 S(   i����(   t   contextmanageri   (   t   util(   t   sqla_compati   (   t   batch(   t	   schemaobj(   t   exec_Nt
   Operationst   BatchOperations(   t   convc        
   B   s�   e  Z d  Z e j �  Z d d � Z e d d � � Z	 e d �  � Z
 e e d �  � � Z e d d d d
 e j
 �  d e j
 �  d d � � Z d �  Z d �  Z d	 �  Z d d
 � Z d �  Z RS(   s�  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.
    c         C   sC   | |  _  | d k r$ | j |  _ n	 | |  _ t j | � |  _ d S(   s�   Construct a new :class:`.Operations`
        :param migration_context: a :class:`.MigrationContext`
         instance.
        N(   t   migration_contextt   Nonet   implR   t
   SchemaObjectst
   schema_obj(   t   selfR	   R   (    (    sH   /opt/alt/python27/lib/python2.7/site-packages/alembic/operations/base.pyt   __init__4   s
    		c            s   �  � � f d �  } | S(   s�  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            s�  � d  k r'