"Fossies" - the Fresh Open Source Software Archive

Member "mailman-3.3.7/src/mailman/database/alembic/versions/2d2d0ef0828f_add_tag_column.py" (10 Nov 2022, 801 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 "2d2d0ef0828f_add_tag_column.py" see the Fossies "Dox" file reference documentation.

    1 """add tag column
    2 
    3 Revision ID: 2d2d0ef0828f
    4 Revises: 15401063d4e3
    5 Create Date: 2019-04-27 08:58:48.496854
    6 
    7 """
    8 
    9 import sqlalchemy as sa
   10 
   11 from alembic import op
   12 from mailman.database.helpers import exists_in_db, is_sqlite
   13 from mailman.database.types import SAUnicode
   14 
   15 
   16 # revision identifiers, used by Alembic.
   17 revision = '2d2d0ef0828f'
   18 down_revision = '15401063d4e3'
   19 
   20 
   21 def upgrade():
   22     if not exists_in_db(op.get_bind(), 'headermatch', 'tag'):
   23         # SQLite may not have removed it when downgrading.
   24         op.add_column(
   25             'headermatch',
   26             sa.Column('tag', type_=SAUnicode, nullable=True))
   27 
   28 
   29 def downgrade():
   30     if not is_sqlite(op.get_bind()):
   31         # diffcov runs with SQLite so this isn't covered.
   32         op.drop_column('headermatch', 'tag')        # pragma: nocover