"Fossies" - the Fresh Open Source Software Archive

Member "mailman-3.3.7/src/mailman/database/alembic/versions/9735f5e5dbdb_add_archive_rendering_mode.py" (10 Nov 2022, 1696 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 "9735f5e5dbdb_add_archive_rendering_mode.py" see the Fossies "Dox" file reference documentation and the last Fossies "Diffs" side-by-side code changes report: 3.3.5_vs_3.3.6.

    1 # Copyright (C) 2020-2022 by the Free Software Foundation, Inc.
    2 #
    3 # This file is part of GNU Mailman.
    4 #
    5 # GNU Mailman is free software: you can redistribute it and/or modify it under
    6 # the terms of the GNU General Public License as published by the Free
    7 # Software Foundation, either version 3 of the License, or (at your option)
    8 # any later version.
    9 #
   10 # GNU Mailman is distributed in the hope that it will be useful, but WITHOUT
   11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   12 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
   13 # more details.
   14 #
   15 # You should have received a copy of the GNU General Public License along with
   16 # GNU Mailman.  If not, see <https://www.gnu.org/licenses/>.
   17 """add_archive_rendering_mode
   18 
   19 Revision ID: 9735f5e5dbdb
   20 Revises: d151c0b8d6f7
   21 Create Date: 2020-05-14 15:59:26.277647
   22 
   23 """
   24 import sqlalchemy as sa
   25 
   26 from alembic import op
   27 
   28 
   29 # revision identifiers, used by Alembic.
   30 revision = '9735f5e5dbdb'
   31 down_revision = 'd151c0b8d6f7'
   32 
   33 
   34 def upgrade():
   35     # ### commands auto generated by Alembic - please adjust! ###
   36     with op.batch_alter_table('mailinglist', schema=None) as batch_op:
   37         batch_op.add_column(
   38             sa.Column('archive_rendering_mode', sa.Integer(), nullable=True))
   39     # Default it to 'text' for all the MailingList since this is a new field.
   40     op.execute("UPDATE mailinglist SET archive_rendering_mode = 1")
   41     # ### end Alembic commands ###
   42 
   43 
   44 def downgrade():
   45     # ### commands auto generated by Alembic - please adjust! ###
   46     with op.batch_alter_table('mailinglist', schema=None) as batch_op:
   47         batch_op.drop_column('archive_rendering_mode')
   48     # ### end Alembic commands ###