"""user_terms_validation

Revision: 0131
Revision ID: 3feaab6b3df
Revises: 384360aef2d6
Create Date: 2018-05-22 18:52:22.623289

"""

# revision identifiers, used by Alembic.
revision = '3feaab6b3df'
down_revision = '384360aef2d6'
branch_labels = None
depends_on = None

from alembic import op
import sqlalchemy as sa


def upgrade():
    op.add_column('users', sa.Column('last_terms_validation', sa.DateTime(), nullable=True))
    op.add_column('users', sa.Column('email_newsletter', sa.Boolean(), nullable=True))
    op.add_column('users', sa.Column('email_notifications', sa.Boolean(), nullable=True))
    op.execute("UPDATE users SET email_newsletter = false, email_notifications = enable_emails")


def downgrade():
    op.drop_column('users', 'last_terms_validation')
    op.drop_column('users', 'email_newsletter')
    op.drop_column('users', 'email_notifications')
