Added active attribute to the users table

master
androiddrew 7 years ago
parent 3ef86bca1e
commit c7d65e06d2

@ -64,6 +64,7 @@ class User(DBMixin, Base):
password = Column(String(255)) password = Column(String(255))
admin = Column(Boolean, nullable=False, default=False) admin = Column(Boolean, nullable=False, default=False)
confirmed = Column(Boolean, nullable=False, default=False) confirmed = Column(Boolean, nullable=False, default=False)
active = Column(Boolean, nullable=False, default=True)
def __init__(self, email, password, admin=False): def __init__(self, email, password, admin=False):
self.email = email self.email = email

@ -0,0 +1,30 @@
"""Adding user active attribute
Revision ID: 7c2d43ec9c84
Revises: 374c36260db7
Create Date: 2018-06-10 17:57:32.570036
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '7c2d43ec9c84'
down_revision = '374c36260db7'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('users', sa.Column('active', sa.Boolean()))
op.execute('UPDATE users SET active = True')
op.alter_column('users', 'active', nullable=False)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('users', 'active')
# ### end Alembic commands ###
Loading…
Cancel
Save