Change default unsub behaviour to disable alias by default (#1174)
* Change default unsub behaviour to disable alias by default * Alter default valut for unsub_behaviouur * Added comments to the migration Co-authored-by: Adrià Casajús <adria.casajus@proton.ch>
This commit is contained in:
parent
06c1c7f2f7
commit
3fa9db9bb7
|
@ -517,8 +517,8 @@ class User(Base, ModelMixin, UserMixin, PasswordOracle):
|
|||
# Keep original unsub behaviour
|
||||
unsub_behaviour = sa.Column(
|
||||
IntEnumType(UnsubscribeBehaviourEnum),
|
||||
default=UnsubscribeBehaviourEnum.PreserveOriginal,
|
||||
server_default=str(UnsubscribeBehaviourEnum.PreserveOriginal.value),
|
||||
default=UnsubscribeBehaviourEnum.DisableAlias,
|
||||
server_default=str(UnsubscribeBehaviourEnum.DisableAlias.value),
|
||||
nullable=False,
|
||||
)
|
||||
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
"""default_unsub_behaviour
|
||||
|
||||
Revision ID: 89081a00fc7d
|
||||
Revises: b0101a66bb77
|
||||
Create Date: 2022-07-20 11:32:32.424358
|
||||
|
||||
"""
|
||||
import sqlalchemy_utils
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '89081a00fc7d'
|
||||
down_revision = 'b0101a66bb77'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# See UnsubscribeBehaviourEnum for the meaning of the values (0 is disable alias)
|
||||
op.execute("ALTER TABLE users ALTER unsub_behaviour SET DEFAULT 0")
|
||||
|
||||
|
||||
def downgrade():
|
||||
# See UnsubscribeBehaviourEnum for the meaning of the values (2 is preserve original)
|
||||
op.execute("ALTER TABLE users ALTER unsub_behaviour SET DEFAULT 2")
|
Loading…
Reference in New Issue