From 58337d7dd67409ea862cf4623bc99bd5520e9a54 Mon Sep 17 00:00:00 2001 From: Pierre Jaury Date: Thu, 18 Aug 2016 20:42:55 +0200 Subject: [PATCH] Set a proper default for spam thresholds --- admin/freeposte/admin/models.py | 2 +- admin/migrations/versions/a4accda8a8c7_.py | 25 ++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 admin/migrations/versions/a4accda8a8c7_.py diff --git a/admin/freeposte/admin/models.py b/admin/freeposte/admin/models.py index 9c6d17f6..07c3e5b6 100644 --- a/admin/freeposte/admin/models.py +++ b/admin/freeposte/admin/models.py @@ -143,7 +143,7 @@ class User(Email): # Settings displayed_name = db.Column(db.String(160), nullable=False, default="") spam_enabled = db.Column(db.Boolean(), nullable=False, default=True) - spam_threshold = db.Column(db.Numeric(), nullable=False, default=5.0) + spam_threshold = db.Column(db.Numeric(), nullable=False, default=10.0) # Flask-login attributes is_authenticated = True diff --git a/admin/migrations/versions/a4accda8a8c7_.py b/admin/migrations/versions/a4accda8a8c7_.py new file mode 100644 index 00000000..42d963d1 --- /dev/null +++ b/admin/migrations/versions/a4accda8a8c7_.py @@ -0,0 +1,25 @@ +""" Update the spam threshold default value + +Revision ID: a4accda8a8c7 +Revises: c5696b48442d +Create Date: 2016-08-18 20:34:19.624603 + +""" + +# revision identifiers, used by Alembic. +revision = 'a4accda8a8c7' +down_revision = 'c5696b48442d' + +from alembic import op +import sqlalchemy as sa + + +def upgrade(): + with op.batch_alter_table('user') as batch: + batch.drop_column('spam_threshold') + batch.add_column(sa.Column('spam_threshold', sa.Numeric(), + default=10.0)) + + +def downgrade(): + pass