%PDF- %PDF-
Direktori : /proc/227033/root/opt/alt/python27/lib/python2.7/site-packages/alembic/ |
Current File : //proc/227033/root/opt/alt/python27/lib/python2.7/site-packages/alembic/command.pyc |
� �M!Vc @ s d d l Z d d l m Z d d l m Z d d l m Z d d l m Z d � Z d d � Z d e e d e d d d d d � Z d d d d � Z e d d � Z e d d � Z d � Z d e d � Z e e d � Z e d � Z e e d � Z e d d � Z d � Z d S( i����Ni ( t ScriptDirectory( t EnvironmentContext( t util( t autogeneratec C s� | j d � xi t j | j � � D]R } t t j j | j � | d � � � } t | � } Wd QX| j d | | � q# W| j d � | j d � d S( s List available templatess Available templates: t READMENs %s - %ss1 Templates are used via the 'init' command, e.g.:s, alembic init --template generic ./scripts( t print_stdoutt ost listdirt get_template_directoryt opent patht joint next( t configt tempnamet readmet synopsis( ( s@ /opt/alt/python27/lib/python2.7/site-packages/alembic/command.pyt list_templates s t genericc C s� t j | t j � r+ t j d | � � n t j j | j � | � } t j | t j � sq t j d | � � n t j d t j j | � t j | � t j j | d � } t j d t j j | � t j | � t | � } x� t j | � D]� } t j j | | � } | d k rlt j j | j � } t j | t j � rSt j d | � q�| j | | d | �q� t j j | � r� t j j | | � } | j | | � q� q� Wt j d | � d S( s# Initialize a new scripts directory.s Directory %s already existss No such template %rs Creating directory %st versionss alembic.ini.makos File %s already exists, skippingt script_locationsN Please edit configuration/connection/logging settings in %r before proceeding.N( R t accesst F_OKR t CommandErrorR R R t statust abspatht makedirsR R t config_file_namet msgt _generate_templatet isfilet _copy_file( R t directoryt templatet template_dirR t scriptt file_t file_patht config_filet output_file( ( s@ /opt/alt/python27/lib/python2.7/site-packages/alembic/command.pyt init s: t headc sf t j | � } t d | d | d | d | d | d | d | d | d | � } t j | | | � � t j | j d � � } | r� t } | r� t j d � � n � f d � } n0 | r� � f d � } n | r� t j d � � n | r%t | | d | d | d � j d � �� | j � Wd QXn g � j � D] } | ^ q2} t | � d k r^| d S| Sd S( s Create a new revision file.t messageR t sqlR) t splicet branch_labelt version_patht rev_idt depends_ont revision_environments7 Using --sql with --autogenerate does not make any sensec s � j | | � g S( N( t run_autogenerate( t revt context( t revision_context( s@ /opt/alt/python27/lib/python2.7/site-packages/alembic/command.pyt retrieve_migrations` s c s � j | | � g S( N( t run_no_autogenerate( R3 R4 ( R5 ( s@ /opt/alt/python27/lib/python2.7/site-packages/alembic/command.pyR6 d s si Using --sql with the revision command when revision_environment is not configured does not make any senset fnt as_sqlt template_argsR5 Ni i ( R t from_configt dictt autogent RevisionContextR t asboolt get_main_optiont TrueR R R: t run_envt generate_scriptst len( R R* R R+ R) R, R- R. R/ R0 t script_directoryt command_argst environmentR6 R# t scripts( ( R5 s@ /opt/alt/python27/lib/python2.7/site-packages/alembic/command.pyt revisionD sF c C sM t j | � } i | d 6} | j | p1 t j � | d t d | d | | �S( s� Merge two revisions together. Creates a new migration file. .. versionadded:: 0.7.0 .. seealso:: :ref:`branches` R t refreshR) t branch_labels( R R; t generate_revisionR R/ RA ( R t revisionsR* R- R/ R# R: ( ( s@ /opt/alt/python27/lib/python2.7/site-packages/alembic/command.pyt merge� s c s� t j | � � d } d � k rT | s9 t j d � � n � j d d � \ } � n � � f d � } t | � d | d | d | d � d | �� � j � Wd QXd S( s Upgrade to a later version.t :s Range revision not allowedi c s � j � | � S( N( t _upgrade_revs( R3 R4 ( RI R# ( s@ /opt/alt/python27/lib/python2.7/site-packages/alembic/command.pyt upgrade� s R8 R9 t starting_revt destination_revt tagN( R R; t NoneR R t splitR RB ( R RI R+ RT RR RQ ( ( RI R# s@ /opt/alt/python27/lib/python2.7/site-packages/alembic/command.pyRQ � s c s� t j | � � d } d � k rT | s9 t j d � � n � j d d � \ } � n | rl t j d � � n � � f d � } t | � d | d | d | d � d | �� � j � Wd QXd S( s Revert to a previous version.RO s Range revision not allowedi s/ downgrade with --sql requires <fromrev>:<torev>c s � j � | � S( N( t _downgrade_revs( R3 R4 ( RI R# ( s@ /opt/alt/python27/lib/python2.7/site-packages/alembic/command.pyt downgrade� s R8 R9 RR RS RT N( R R; RU R R RV R RB ( R RI R+ RT RR RX ( ( RI R# s@ /opt/alt/python27/lib/python2.7/site-packages/alembic/command.pyRX � s&