Make sure email_access_validated_at is not null after being populated

This commit is contained in:
Pea Tyczynska
2020-01-30 16:02:34 +00:00
parent d34eafa1de
commit 20124d599c

View File

@@ -22,8 +22,6 @@ def upgrade():
users users
SET SET
email_access_validated_at = created_at email_access_validated_at = created_at
WHERE
auth_type = 'sms_auth'
""") """)
op.execute(""" op.execute("""
UPDATE UPDATE
@@ -32,6 +30,8 @@ def upgrade():
email_access_validated_at = logged_in_at email_access_validated_at = logged_in_at
WHERE WHERE
auth_type = 'email_auth' auth_type = 'email_auth'
AND
email_access_validated_at IS NOT NULL
""") """)
op.alter_column('users', 'email_access_validated_at', nullable=False) op.alter_column('users', 'email_access_validated_at', nullable=False)
# ### end Alembic commands ### # ### end Alembic commands ###