Files
notifications-api/migrations/versions/0034_pwd_changed_at_not_null.py
Cliff Hill 1157f5639d black, isort, flake8
Signed-off-by: Cliff Hill <Clifford.hill@gsa.gov>
2023-12-08 21:43:52 -05:00

31 lines
799 B
Python

"""empty message
Revision ID: 0034_pwd_changed_at_not_null
Revises: 0033_api_key_type
Create Date: 2016-06-28 10:37:25.389020
"""
# revision identifiers, used by Alembic.
revision = "0034_pwd_changed_at_not_null"
down_revision = "0033_api_key_type"
import sqlalchemy as sa
from alembic import op
def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.get_bind()
op.execute(
"update users set password_changed_at = created_at where password_changed_at is null"
)
op.alter_column("users", "password_changed_at", nullable=False)
### end Alembic commands ###
def downgrade():
### commands auto generated by Alembic - please adjust! ###
op.alter_column("users", "password_changed_at", nullable=True)
### end Alembic commands ###