mirror of
https://github.com/simple-login/app.git
synced 2024-11-13 23:51:13 +01:00
31 lines
976 B
Python
31 lines
976 B
Python
|
"""Add unsubscribe behaviour
|
||
|
|
||
|
Revision ID: b0101a66bb77
|
||
|
Revises: bd7d032087b2
|
||
|
Create Date: 2022-07-06 19:52:04.324761
|
||
|
|
||
|
"""
|
||
|
import sqlalchemy_utils
|
||
|
from alembic import op
|
||
|
import sqlalchemy as sa
|
||
|
from sqlalchemy.dialects import postgresql
|
||
|
|
||
|
# revision identifiers, used by Alembic.
|
||
|
revision = 'b0101a66bb77'
|
||
|
down_revision = 'bd7d032087b2'
|
||
|
branch_labels = None
|
||
|
depends_on = None
|
||
|
|
||
|
def upgrade():
|
||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||
|
op.add_column('users', sa.Column('unsub_behaviour', sa.Integer(), default=2, server_default='2', nullable=False))
|
||
|
op.execute("UPDATE users SET unsub_behaviour=0 WHERE one_click_unsubscribe_block_sender=false")
|
||
|
op.execute("UPDATE users SET unsub_behaviour=1 WHERE one_click_unsubscribe_block_sender=true")
|
||
|
|
||
|
# ### end Alembic commands ###
|
||
|
|
||
|
|
||
|
def downgrade():
|
||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||
|
op.drop_column('users', 'unsub_behaviour')
|
||
|
# ### end Alembic commands ###
|