ÿØÿàJFIFÿþ ÿÛC       ÿÛC ÿÀÿÄÿÄ"#QrÿÄÿÄ&1!A"2qQaáÿÚ ?Øy,æ/3JæÝ¹È߲؋5êXw²±ÉyˆR”¾I0ó2—PI¾IÌÚiMö¯–þrìN&"KgX:Šíµ•nTJnLK„…@!‰-ý ùúmë;ºgµŒ&ó±hw’¯Õ@”Ü— 9ñ-ë.²1<yà‚¹ïQÐU„ہ?.’¦èûbß±©Ö«Âw*VŒ) `$‰bØÔŸ’ëXÖ-ËTÜíGÚ3ð«g Ÿ§¯—Jx„–’U/ÂÅv_s(Hÿ@TñJÑãõçn­‚!ÈgfbÓc­:él[ðQe 9ÀPLbÃãCµm[5¿ç'ªjglå‡Ûí_§Úõl-;"PkÞÞÁQâ¼_Ñ^¢SŸx?"¸¦ùY騐ÒOÈ q’`~~ÚtËU¹CڒêV  I1Áß_ÿÙ M!Vc@sddlmZddlmZddlmZddlmZddlmZmZddl Z d e fd YZ d e fd YZ ej d ej d dde fdYZej dej ddde fdYZej dej ddde fdYZej dej ddde fdYZej dej ddde fd YZej d!ej d!d"d#e fd$YZej d%ej d%d&d'e fd(YZej d)d*e fd+YZej d,d-e fd.YZd/e fd0YZej d1d2efd3YZej d4ej d4d5d6efd7YZej d8ej d8d9d:efd;YZej d<ej d<d=d>efd?YZej d@dAe fdBYZej dCdDe fdEYZdFe fdGYZdHefdIYZdJefdKYZ dLefdMYZ!dNe fdOYZ"dS(Pi(tutil(t sqla_compati(t schemaobji(tNULLTYPE(t OperationstBatchOperationsNtMigrateOperationcBs eZdZejdZRS(sbase class for migration command and organization objects. This system is part of the operation extensibility API. .. versionadded:: 0.8.0 .. seealso:: :ref:`operation_objects` :ref:`operation_plugins` :ref:`customizing_revision` cCsiS(sA dictionary that may be used to store arbitrary information along with this :class:`.MigrateOperation` object. ((tself((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pytinfos(t__name__t __module__t__doc__Rtmemoized_propertyR(((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyR stAddConstraintOpcBs>eZdZedZedZdZdZRS(s&Represent an add constraint operation.cCs tdS(N(tNotImplementedError(R((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pytconstraint_type&scCsIitjd6tjd6tjd6tjd6tjd6}||j|S(Ntunique_constrainttforeign_key_constrainttprimary_key_constrainttcheck_constrainttcolumn_check_constraint(tCreateUniqueConstraintOptfrom_constrainttCreateForeignKeyOptCreatePrimaryKeyOptCreateCheckConstraintOpt__visit_name__(tclst constrainttfuncs((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyR*s     cCstj|jS(N(tDropConstraintOpRt to_constraint(R((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pytreverse5scCsd|jfS(Ntadd_constraint(R(R((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyt to_diff_tuple8s( R R R tpropertyRt classmethodRR R"(((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyR #s  tdrop_constrainttbatch_drop_constraintRcBseZdZd d d dZdZdZedZdZ ee j d dgd d d Z ed d Z RS(s&Represent a drop constraint operation.cCs1||_||_||_||_||_dS(N(tconstraint_namet table_nameRtschemat_orig_constraint(RR'R(ttype_R)R*((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyt__init__As     cCs.|jdkrtdntj|jS(Ns?operation is not reversible; original constraint is not present(R*tNonet ValueErrorR R(R((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyR Ks cCs3|jdkrd|jfSd|jfSdS(Nt foreignkeyt remove_fktremove_constraint(RR(R((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyR"Rsc Csgidd6dd6dd6dd6dd 6}tj|}||j|jd |jd ||jd |S( NtuniqueRR/RtprimaryRtcheckRRR)R+R*(Rt_table_for_constrainttnameR)R(RRttypestconstraint_table((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyRXs    cCs&|jdk r|jStddS(NsAconstraint cannot be produced; original constraint is not present(R*R-R.(R((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyRksttypeR+R6R'cCs(|||d|d|}|j|S(sDrop 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`. .. versionadded:: 0.7.0 'schema' can now accept a :class:`~sqlalchemy.sql.elements.quoted_name` construct. .. versionchanged:: 0.8.0 The following positional argument names have been changed: * name -> constraint_name R+R)(tinvoke(Rt operationsR'R(R+R)top((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyR%sscCs4|||jjd|d|jj}|j|S(sIssue 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` .. versionchanged:: 0.8.0 The following positional argument names have been changed: * name -> constraint_name R+R)(timplR(R)R:(RR;R'R+R<((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyR&sN(R9R+(R6R'(R R R R-R,R R"R$RRRt_with_legacy_namesR%R&(((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyR<s     tcreate_primary_keytbatch_create_primary_keyRcBsteZdZdZd d dZedZd dZee j d d gd d Z ed Z RS(s)Represent a create primary key operation.t primarykeycKs:||_||_||_||_||_||_dS(N(R'R(tcolumnsR)R*tkw(RR'R(RBR)R*RC((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyR,s      cCs7tj|}||j|j|jd|jd|S(NR)R*(RR5R6RBR)(RRR8((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyRs  cCsJ|jdk r|jStj|}|j|j|j|jd|jS(NR)( R*R-Rt SchemaObjectsRR'R(RBR)(Rtmigration_contextt schema_obj((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyRs  R6R'tcolsRBcCs"|||||}|j|S(sIssue 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 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`. .. versionadded:: 0.7.0 'schema' can now accept a :class:`~sqlalchemy.sql.elements.quoted_name` construct. .. versionchanged:: 0.8.0 The following positional argument names have been changed: * name -> constraint_name * cols -> columns (R:(RR;R'R(RBR)R<((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyR?s5cCs1|||jj|d|jj}|j|S(sIssue 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)R:(RR;R'RBR<((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyR@ s N(R6R'(RGRB( R R R RR-R,R$RRRR>R?R@(((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyRs  1tcreate_unique_constrainttbatch_create_unique_constraintRcBseZdZdZd d dZedZd dZee j dddgd d Z ee j dgd Z RS(s/Represent a create unique constraint operation.R2cKs:||_||_||_||_||_||_dS(N(R'R(RBR)R*RC(RR'R(RBR)R*RC((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyR,'s      c Cstj|}i}|jr.|j|d 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`. .. versionadded:: 0.7.0 'schema' can now accept a :class:`~sqlalchemy.sql.elements.quoted_name` construct. .. versionchanged:: 0.8.0 The following positional argument names have been changed: * name -> constraint_name * source -> table_name * local_cols -> columns R)(R:(RR;R'R(RBR)RCR<((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyRHMs9  cKs8|jj|d<|||jj||}|j|S(sIssue 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` .. versionchanged:: 0.8.0 The following positional argument names have been changed: * name -> constraint_name R)(R=R)R(R:(RR;R'RBRCR<((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyRIs  N(R6R'(RMR((RNRB(R6R'( R R R RR-R,R$RRRR>RHRI(((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyRs  7tcreate_foreign_keytbatch_create_foreign_keyRc BseZdZdZddZdZedZddZ ee j dddgdddddddd Z ee j ddgddddddd Z RS(s4Represent a create foreign key constraint operation.R/cKsC||_||_||_||_||_||_||_dS(N(R't source_tabletreferent_tableRNt remote_colsR*RC(RR'RQRRRNRSR*RC((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyR,s      cCsd|jfS(Ntadd_fk(R(R((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyR"sc Csi}|jr|j|d when issuing DDL for this constraint. Typical values include CASCADE, DELETE and RESTRICT. :param ondelete: Optional string. If set, emit ON DELETE 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. .. versionchanged:: 0.8.0 The following positional argument names have been changed: * name -> constraint_name * source -> source_table * referent -> referent_table RURVRJRXRYRKtmatch(R:(RR;R'RQRRRNRSRURVRJRKR`RXRYt dialect_kwR<((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyROs@    c Ks^|||jj|||d|d|d| d|jjd|d| d| | } |j| S(sIssue 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` .. versionchanged:: 0.8.0 The following positional argument names have been changed: * name -> constraint_name * referent -> referent_table RURVRJRXRYRKR`(R=R(R)R:(RR;R'RRRNRSRYRURVRJRKR`RaR<((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyRP6s$      N(R6R'(RMRQ(R_RR(R6R'(R_RR(R R R RR-R,R"R$RRRR>RORP(((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyRs* !   C tcreate_check_constrainttbatch_create_check_constraintRcBseZdZdZd d dZedZd dZee j d d gd d Z ee j dgd Z RS(s.Represent a create check constraint operation.R4cKs:||_||_||_||_||_||_dS(N(R'R(t conditionR)R*RC(RR'R(RdR)R*RC((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyR,ps      cCs7tj|}||j|j|jd|jd|S(NR)R*(RR5R6tsqltextR)(RRR8((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyRzs  cCsP|jdk r|jStj|}|j|j|j|jd|j|j S(NR)( R*R-RRDRR'R(RdR)RC(RRERF((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyRs  R6R'RMR(cKs(||||d||}|j|S(s2Issue 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 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`. .. versionadded:: 0.7.0 'schema' can now accept a :class:`~sqlalchemy.sql.elements.quoted_name` construct. .. versionchanged:: 0.8.0 The following positional argument names have been changed: * name -> constraint_name * source -> table_name R)(R:(RR;R'R(RdR)RCR<((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyRbs:cKs4|||jj|d|jj|}|j|S(sIssue 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` .. versionchanged:: 0.8.0 The following positional argument names have been changed: * name -> constraint_name R)(R=R(R)R:(RR;R'RdRCR<((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyRcs N(R6R'(RMR((R6R'( R R R RR-R,R$RRRR>RbRc(((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyRhs  5t create_indextbatch_create_indext CreateIndexOpcBseZdZd ed dZdZdZedZ d dZ ee j d gd edZ ed ZRS( s#Represent a create index operation.cKsC||_||_||_||_||_||_||_dS(N(t index_nameR(RBR)R2RCt _orig_index(RRiR(RBR)R2RjRC((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyR,s      cCstj|jS(N(t DropIndexOpt from_indextto_index(R((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyR scCsd|jfS(Nt add_index(Rm(R((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyR"sc CsC||j|jjtj|d|jjd|jd||jS(NR)R2Rj(R6ttableRt_get_index_expressionsR)R2tkwargs(Rtindex((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyRls   c CsS|jr|jStj|}|j|j|j|jd|jd|j|j S(NR)R2( RjRRDRrRiR(RBR)R2RC(RRERF((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyRms  R6Ric Ks.||||d|d||}|j|S(sC 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)')]) .. versionadded:: 0.6.7 support for making use of the :func:`~sqlalchemy.sql.expression.text` construct in conjunction with :meth:`.Operations.create_index` in order to produce functional expressions within CREATE INDEX. :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`. .. versionadded:: 0.7.0 'schema' can now accept a :class:`~sqlalchemy.sql.elements.quoted_name` construct. :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 ``_``. See the documentation regarding an individual dialect at :ref:`dialect_toplevel` for detail on documented arguments. .. versionchanged:: 0.8.0 The following positional argument names have been changed: * name -> index_name R)R2(R:( RR;RiR(RBR)R2RCR<((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyRfs> cKs4|||jj|d|jj|}|j|S(sIssue a "create index" instruction using the current batch migration context. .. seealso:: :meth:`.Operations.create_index` R)(R=R(R)R:(RR;RiRBRCR<((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyRgSs N(R6Ri(R R R R-tFalseR,R R"R$RlRmRR>RfRg(((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyRhs   ?t drop_indextbatch_drop_indexRkcBseZdZd d d dZdZdZedZd dZ ee j d dgd d d Z ee j dgd Z RS(s!Represent a drop index operation.cCs(||_||_||_||_dS(N(RiR(R)Rj(RRiR(R)Rj((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyR,js   cCsd|jfS(Nt remove_index(Rm(R((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyR"qscCs.|jdkrtdntj|jS(Ns:operation is not reversible; original index is not present(RjR-R.RhRl(R((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyR ts cCs(||j|jjd|jjd|S(NR)Rj(R6RoR)(RRr((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyRl{s   cCsJ|jdk r|jStj|}|j|j|jdgd|jS(NtxR)(RjR-RRDRrRiR(R)(RRERF((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyRms R6Rit tablenameR(cCs%||d|d|}|j|S(s&Issue 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`. .. versionadded:: 0.7.0 'schema' can now accept a :class:`~sqlalchemy.sql.elements.quoted_name` construct. .. versionchanged:: 0.8.0 The following positional argument names have been changed: * name -> index_name R(R)(R:(RR;RiR(R)R<((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyRtscKs1||d|jjd|jj}|j|S(s)Issue a "drop index" instruction using the current batch migration context. .. seealso:: :meth:`.Operations.drop_index` .. versionchanged:: 0.8.0 The following positional argument names have been changed: * name -> index_name R(R)(R=R(R)R:(RR;RiRCR<((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyRusN(R6Ri(RxR((R6Ri(R R R R-R,R"R R$RlRmRR>RtRu(((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyRkes    t create_tablet CreateTableOpcBskeZdZd d dZdZdZedZd dZ ee j d gdZ RS( s#Represent a create table operation.cKs1||_||_||_||_||_dS(N(R(RBR)RCt _orig_table(RR(RBR)R{RC((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyR,s     cCstj|jS(N(t DropTableOpt from_tabletto_table(R((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyR scCsd|jfS(Nt add_table(R~(R((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyR"scCs;||jt|jt|jd|jd||jS(NR)R{(R6tlistRLt constraintsR)Rq(RRo((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyR}s  cCsJ|jdk r|jStj|}|j|jd|j|j|jS(NR)( R{R-RRDRoR(R)RBRC(RRERF((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyR~s R6R(cOs||||}|j|S(s 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"}, ] ) .. versionadded:: 0.7.0 :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`. .. versionadded:: 0.7.0 'schema' can now accept a :class:`~sqlalchemy.sql.elements.quoted_name` construct. :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. .. versionadded:: 0.7.0 - the :class:`~sqlalchemy.schema.Table` object is returned. .. versionchanged:: 0.8.0 The following positional argument names have been changed: * name -> table_name (R:(RR;R(RBRCR<((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyRys\N(R6R(( R R R R-R,R R"R$R}R~RR>Ry(((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyRzs   t drop_tableR|cBsqeZdZd d d dZdZdZedZd dZ ee j d gd dZ RS( s!Represent a drop table operation.cCs.||_||_|pi|_||_dS(N(R(R)ttable_kwR{(RR(R)RR{((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyR,Qs  cCsd|jfS(Nt remove_table(R~(R((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyR"XscCs.|jdkrtdntj|jS(Ns:operation is not reversible; original table is not present(R{R-R.RzR}(R((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyR [s cCs||jd|jd|S(NR)R{(R6R)(RRo((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyR}bscCsD|jdk r|jStj|}|j|jd|j|jS(NR)(R{R-RRDRoR(R)R(RRERF((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyR~fs R6R(cKs)||d|d|}|j|dS(sDIssue 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`. .. versionadded:: 0.7.0 'schema' can now accept a :class:`~sqlalchemy.sql.elements.quoted_name` construct. :param \**kw: Other keyword arguments are passed to the underlying :class:`sqlalchemy.schema.Table` object created for the command. .. versionchanged:: 0.8.0 The following positional argument names have been changed: * name -> table_name R)RN(R:(RR;R(R)RCR<((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyRosN(R6R(( R R R R-R,R"R R$R}R~RR>R(((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyR|Ms   t AlterTableOpcBseZdZddZRS(s#Represent an alter table operation.cCs||_||_dS(N(R(R)(RR(R)((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyR,s N(R R R R-R,(((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyRst rename_tablet RenameTableOpcBs,eZdZddZeddZRS(s#Represent a rename table operation.cCs)tt|j|d|||_dS(NR)(tsuperRR,tnew_table_name(Rtold_table_nameRR)((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyR,scCs"|||d|}|j|S(sEmit 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`. .. versionadded:: 0.7.0 'schema' can now accept a :class:`~sqlalchemy.sql.elements.quoted_name` construct. R)(R:(RR;RRR)R<((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyRsN(R R R R-R,R$R(((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyRs t alter_columntbatch_alter_columnt AlterColumnOpc BseZdZd d ed d ed d dZdZdZdZe e j d gd ed d d ed d dZ e d ed d d ed dZ RS( s$Represent an alter column operation.c Ksqtt|j|d|||_||_||_||_||_||_| |_ | |_ | |_ dS(NR)( RRR,t column_namet existing_typetexisting_server_defaulttexisting_nullabletmodify_nullabletmodify_server_defaultt modify_namet modify_typeRC( RR(RR)RRRRRRRRC((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyR,s         cCsg}|j|j|j}}}|jdk rq|jd|||i|jd6|jd6|j|jfn|j dk r|jd|||i|jd6|jd6|j|j fn|j t k r |jd|||i|jd6|jd6|j|j fn|S(NRRRRRtmodify_default( R)R(RRR-tappendRRRRRRs(Rtcol_diffR)ttnametcname((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyR"s6         cCsf|jdk p*|jtk p*|jdk }|r7tSx(|jD]}|jdrAtSqAWtSdS(Ntmodify_(RR-RRsRtTrueRCt startswith(Rthc1RC((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyt has_changesscCs@|jj}|j|d<|j|d<|j|d<|jdk rU|j|dss^(?:existing_|modify_)(.+)$s modify_%ss existing_%sR)(RCtcopyRRRRR-RRRstsettreR`t __class__R(RR)(RRCtktall_keystswap((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyR s*    ) R6tnew_column_namec KsO|||d| d|d| d| d|d|d|d|| } |j| S( sXIssue 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_server_default`` argument is used in this case as well to remove a previous constraint. :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 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 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`. .. versionadded:: 0.7.0 'schema' can now accept a :class:`~sqlalchemy.sql.elements.quoted_name` construct. R)RRRRRRR(R:(RR;R(Rtnullabletserver_defaultRR+RRRR)RCtalt((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyR!sY c Ks[||jj|d|jjd|d|d| d|d|d|d|| } |j| S( sIssue an "alter column" instruction using the current batch migration context. .. seealso:: :meth:`.Operations.add_column` R)RRRRRRR(R=R(R)R:( RR;RRRRR+RRRRCR((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyRs  N(R6R(R R R R-RsR,R"RR R$RR>RR(((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyRs<  ' \t add_columntbatch_add_columnt AddColumnOpcBsteZdZd dZdZdZdZedZ edZ ed dZ edZ RS( s"Represent an add column operation.cCs)tt|j|d|||_dS(NR)(RRR,tcolumn(RR(RR)((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyR,scCstj|j|j|jS(N(t DropColumnOptfrom_column_and_tablenameR)R(R(R((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyR scCsd|j|j|jfS(NR(R)R(R(R((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyR"scCs|jS(N(R(R((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyt to_columnscCs||jj|d|jjS(NR)(RoR6R)(Rtcol((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyt from_columnscCs|||d|S(NR)((RR)RR((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyRscCs"|||d|}|j|S(sIssue 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 provided :class:`~sqlalchemy.schema.Column` object can also specify a :class:`~sqlalchemy.schema.ForeignKey`, referencing a remote table name. Alembic will automatically generate a stub "referenced" table and emit a second ALTER statement in order to add the constraint separately:: from alembic import op from sqlalchemy import Column, INTEGER, ForeignKey op.add_column('organization', Column('account_id', INTEGER, ForeignKey('accounts.id')) ) Note that this statement uses the :class:`~sqlalchemy.schema.Column` construct as is 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 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`. .. versionadded:: 0.7.0 'schema' can now accept a :class:`~sqlalchemy.sql.elements.quoted_name` construct. R)(R:(RR;R(RR)R<((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyRs7cCs.||jj|d|jj}|j|S(sIssue an "add column" instruction using the current batch migration context. .. seealso:: :meth:`.Operations.add_column` R)(R=R(R)R:(RR;RR<((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyRs N( R R R R-R,R R"RR$RRRR(((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyRs    9t drop_columntbatch_drop_columnRcBskeZdZdddZdZdZedZddZ eddZ edZ RS( s"Represent a drop column operation.cKs;tt|j|d|||_||_||_dS(NR)(RRR,RRCt _orig_column(RR(RR)RRC((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyR,s  cCsd|j|j|jfS(Nt remove_column(R)R(R(R((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyR"scCs:|jdkrtdntj|j|j|jS(Ns;operation is not reversible; original column is not present(RR-R.RRR)R((R((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyR #s  cCs|||jd|d|S(NR)R(R6(RR)RR((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyR,scCs8|jdk r|jStj|}|j|jtS(N(RR-RRDRRR(RRERF((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyR0scKs%|||d||}|j|S(sIssue 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`. .. versionadded:: 0.7.0 'schema' can now accept a :class:`~sqlalchemy.sql.elements.quoted_name` construct. :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. .. versionadded:: 0.6.2 R)(R:(RR;R(RR)RCR<((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyR6s.cCs.||jj|d|jj}|j|S(sIssue a "drop column" instruction using the current batch migration context. .. seealso:: :meth:`.Operations.drop_column` R)(R=R(R)R:(RR;RR<((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyRgs N( R R R R-R,R"R R$RRRR(((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyRs    /t bulk_insertt BulkInsertOpcBs,eZdZedZeedZRS(s"Represent a bulk insert operation.cCs||_||_||_dS(N(Rotrowst multiinsert(RRoRR((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyR,{s  cCs&|||d|}|j|dS(s Issue 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. .. versionadded:: 0.6.4 :meth:`.Operations.inline_literal` can now be used with :meth:`.Operations.bulk_insert`, and the :paramref:`~.Operations.bulk_insert.multiinsert` flag has been added to assist in this usage when running in "online" mode. :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. .. versionadded:: 0.6.4 RN(R:(RR;RoRRR<((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyRsU(R R R RR,R$R(((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyRws texecutet ExecuteSQLOpcBs,eZdZddZeddZRS(s#Represent an execute SQL operation.cCs||_||_dS(N(Retexecution_options(RReR((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyR,s cCs||d|}|j|S(s Execute the given SQL using the current migration context. 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. For full interaction with a connected database, use the "bind" available from the context:: from alembic import op connection = op.get_bind() Also note that any parameterized statement here *will not work* in offline mode - INSERT, UPDATE and DELETE statements which refer to literal values would need to render inline expressions. For simple use cases, the :meth:`.inline_literal` function can be used for **rudimentary** quoting of string values. For "bulk" inserts, consider using :meth:`.bulk_insert`. For example, to emit an UPDATE statement which is equally compatible with both online and offline mode:: 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')}) ) Note above we also used 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. :param sql: 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. * Pretty much anything that's "executable" as described in :ref:`sqlexpression_toplevel`. :param execution_options: Optional dictionary of execution options, will be passed to :meth:`sqlalchemy.engine.Connection.execution_options`. R(R:(RR;ReRR<((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyRs@N(R R R R-R,R$R(((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyRs t OpContainercBs;eZdZddZdZdZedZRS(s-Represent a sequence of operations operation.cCs ||_dS(N(tops(RR((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyR,'scCs|j S(N(R(R((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pytis_empty*scCsttj|S(N(RRt _ops_as_diffs(R((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pytas_diffs-sccsTxM|jD]B}t|drAx*|j|D] }|Vq/Wq |jVq WdS(NR(RthasattrRR"(Rt migrationsR<tsub_op((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyR0s  ((R R R R,RRR$R(((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyR%s    tModifyTableOpscBs#eZdZddZdZRS(sCContains a sequence of operations that all apply to a single Table.cCs,tt|j|||_||_dS(N(RRR,R(R)(RR(RR)((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyR,=s cCsDt|jdttg|jD]}|j^qd|jS(NRR)(RR(RtreversedRR R)(RR<((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyR Bs  (N(R R R R-R,R (((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyR:s t UpgradeOpscBs/eZdZdddZdZdZRS(scontains a sequence of operations that would apply to the 'upgrade' stream of a script. .. seealso:: :ref:`customizing_revision` tupgradescCs&tt|jd|||_dS(NR(RRR,t upgrade_token(RRR((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyR,VscCs6ttg|jD]}|j^q|j(|S(N(RRRR (Rt downgrade_opsR<((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyt reverse_intoZs,cCs|jtdgS(NR(Rt DowngradeOps(R((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyR `s((R R R R,RR (((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyRLs RcBs&eZdZdddZdZRS(scontains a sequence of operations that would apply to the 'downgrade' stream of a script. .. seealso:: :ref:`customizing_revision` t downgradescCs&tt|jd|||_dS(NR(RRR,tdowngrade_token(RRR((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyR,nscCs5tdttg|jD]}|j^qS(NR(RRRRR (RR<((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyR rs((R R R R,R (((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyRdstMigrationScriptcBseZdZdeddddddZedZejdZedZ e jdZ edZ edZ RS( srepresents 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. .. versionchanged:: 0.8.1 the ``.upgrade_ops`` and ``.downgrade_ops`` attributes should be accessed via the ``.upgrade_ops_list`` and ``.downgrade_ops_list`` attributes if multiple autogenerate passes proceed on the same :class:`.MigrationScript` object. .. seealso:: :ref:`customizing_revision` c Cs^||_||_||_||_||_||_| |_| |_||_||_ dS(N( trev_idtmessagetimportstheadtsplicet branch_labelt version_patht depends_ont upgrade_opsR( RRRRRRRRRRR((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyR,s         cCs@t|jdkr$tdn|js1dS|jdSdS(szAn instance of :class:`.UpgradeOps`. .. seealso:: :attr:`.MigrationScript.upgrade_ops_list` isrThis MigrationScript instance has a multiple-entry list for UpgradeOps; please use the upgrade_ops_list attribute.iN(tlent _upgrade_opsR.R-(R((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyRs   cCs*tj||_x|jD]}qWdS(N(Rtto_listR(RRtelem((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyRscCs@t|jdkr$tdn|js1dS|jdSdS(s~An instance of :class:`.DowngradeOps`. .. seealso:: :attr:`.MigrationScript.downgrade_ops_list` isvThis MigrationScript instance has a multiple-entry list for DowngradeOps; please use the downgrade_ops_list attribute.iN(Rt_downgrade_opsR.R-(R((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyRs   cCs*tj||_x|jD]}qWdS(N(RRR(RRR((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyRscCs|jS(sA 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. .. versionadded:: 0.8.1 (R(R((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pytupgrade_ops_lists cCs|jS(s 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. .. versionadded:: 0.8.1 (R(R((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pytdowngrade_ops_lists N( R R R R-RR,R#RtsetterRRR(((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pyRzs   (#tRRRtsqlalchemy.typesRtbaseRRRtobjectRR tregister_operationRRRRRRhRkRzR|RRRRRRRRRRRR(((sG/opt/alt/python27/lib/python2.7/site-packages/alembic/operations/ops.pytsr  n  p      z ~ aB  d caK