From d09a645300e66a58e438963d71e5cdc5e3f521ca Mon Sep 17 00:00:00 2001 From: Khanh Ngo Date: Sun, 22 Dec 2019 08:40:05 +0700 Subject: [PATCH] Fix migration script and user model --- .../versions/3f76448bb6de_add_user_confirmed_column.py | 5 +++-- powerdnsadmin/models/user.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/migrations/versions/3f76448bb6de_add_user_confirmed_column.py b/migrations/versions/3f76448bb6de_add_user_confirmed_column.py index a560f69..d1b6d29 100644 --- a/migrations/versions/3f76448bb6de_add_user_confirmed_column.py +++ b/migrations/versions/3f76448bb6de_add_user_confirmed_column.py @@ -8,7 +8,6 @@ Create Date: 2019-12-21 17:11:36.564632 from alembic import op import sqlalchemy as sa - # revision identifiers, used by Alembic. revision = '3f76448bb6de' down_revision = 'b0fea72a3f20' @@ -18,7 +17,9 @@ depends_on = None def upgrade(): with op.batch_alter_table('user') as batch_op: - batch_op.add_column(sa.Column('confirmed', sa.Boolean())) + batch_op.add_column( + sa.Column('confirmed', sa.Boolean(), nullable=False, + default=False)) def downgrade(): diff --git a/powerdnsadmin/models/user.py b/powerdnsadmin/models/user.py index f2f705c..70ed111 100644 --- a/powerdnsadmin/models/user.py +++ b/powerdnsadmin/models/user.py @@ -26,7 +26,7 @@ class User(db.Model): lastname = db.Column(db.String(64)) email = db.Column(db.String(128)) otp_secret = db.Column(db.String(16)) - confirmed = db.Column(db.SmallInteger, default=0) + confirmed = db.Column(db.SmallInteger, nullable=False, default=0) role_id = db.Column(db.Integer, db.ForeignKey('role.id')) def __init__(self,