contentdb/migrations/versions/8ee3cf3fb312_.py
2021-05-03 23:57:22 +01:00

31 lines
856 B
Python

"""empty message
Revision ID: 8ee3cf3fb312
Revises: e82c2141fae3
Create Date: 2021-05-03 22:21:02.167758
"""
from alembic import op
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = '8ee3cf3fb312'
down_revision = 'e82c2141fae3'
branch_labels = None
depends_on = None
def upgrade():
op.alter_column('user', 'email_confirmed_at',
existing_type=postgresql.TIMESTAMP(),
nullable=True)
op.execute("""UPDATE "user" SET email_confirmed_at = NULL WHERE email_confirmed_at < '2016-01-01'::date""")
def downgrade():
op.alter_column('user', 'email_confirmed_at',
existing_type=postgresql.TIMESTAMP(),
nullable=False)
op.execute(
"""UPDATE "user" SET email_confirmed_at = '2004-01-01'::date WHERE email_confirmed_at IS NULL""")