Make confirmed column required
parent
bf681f4568
commit
f2390ad26c
|
@ -13,7 +13,7 @@ class Account(db.Model):
|
|||
email = db.Column(db.String, index=True, unique=True)
|
||||
role_id = db.Column(db.Integer, db.ForeignKey("roles.id"))
|
||||
role = db.relationship("Role", foreign_keys=[role_id])
|
||||
confirmed = db.Column(db.Boolean, default=False)
|
||||
confirmed = db.Column(db.Boolean, default=False, nullable=False)
|
||||
confirmed_at = db.Column(db.DateTime, nullable=True)
|
||||
created_at = db.Column(db.DateTime,
|
||||
nullable=False,
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: ae43d7caad52
|
||||
Revises: fd5cfe0f1c51
|
||||
Create Date: 2018-10-10 21:01:06.071591
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'ae43d7caad52'
|
||||
down_revision = 'fd5cfe0f1c51'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
accounts = sa.table('accounts', sa.column('id', sa.Integer),
|
||||
sa.column('confirmed', sa.BOOLEAN()))
|
||||
op.execute(accounts.update().
|
||||
values({'confirmed': True}))
|
||||
|
||||
op.alter_column('accounts', 'confirmed',
|
||||
existing_type=sa.BOOLEAN(),
|
||||
nullable=False)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.alter_column('accounts', 'confirmed',
|
||||
existing_type=sa.BOOLEAN(),
|
||||
nullable=True)
|
||||
# ### end Alembic commands ###
|
Loading…
Reference in New Issue