"Fossies" - the Fresh Open Source Software Archive

Member "mailman-3.3.7/src/mailman/database/alembic/versions/83339e4039da_add_usenet_watermark.py" (10 Nov 2022, 799 Bytes) of package /linux/misc/mailman-3.3.7.tar.bz2:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. For more information about "83339e4039da_add_usenet_watermark.py" see the Fossies "Dox" file reference documentation.

    1 """add_usenet_watermark
    2 
    3 Revision ID: 83339e4039da
    4 Revises: 2d2d0ef0828f
    5 Create Date: 2019-07-17 20:41:39.601334
    6 
    7 """
    8 
    9 import sqlalchemy as sa
   10 
   11 from alembic import op
   12 from mailman.database.helpers import exists_in_db
   13 
   14 
   15 # revision identifiers, used by Alembic.
   16 revision = '83339e4039da'
   17 down_revision = '2d2d0ef0828f'
   18 
   19 
   20 def upgrade():
   21     if not exists_in_db(op.get_bind(),
   22                         'mailinglist',
   23                         'usenet_watermark'
   24                         ):
   25         # SQLite may not have removed it when downgrading.
   26         op.add_column('mailinglist', sa.Column(
   27             'usenet_watermark',
   28             sa.Integer,
   29             nullable=True))
   30 
   31 
   32 def downgrade():
   33     with op.batch_alter_table('mailinglist') as batch_op:
   34         batch_op.drop_column('usenet_watermark')