"""add persistent volunteer-janitor data fields

Revision ID: b2373d7b1b84
Revises: 0cd3a7ebef3f
Create Date: 2023-04-22 10:48:16.476497+00:00

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'b2373d7b1b84'
down_revision = '0cd3a7ebef3f'
branch_labels = None
depends_on = None


def upgrade():
	# manually adjusted to introduce our intended defaults
	op.add_column('comments', sa.Column('volunteer_janitor_badness', sa.Float()))
	op.execute("UPDATE comments SET volunteer_janitor_badness = 0.5")
	op.alter_column('comments', 'volunteer_janitor_badness', nullable=False)

	op.add_column('users', sa.Column('volunteer_janitor_correctness', sa.Float()))
	op.execute("UPDATE users SET volunteer_janitor_correctness = 0")
	op.alter_column('users', 'volunteer_janitor_correctness', nullable=False)


def downgrade():
	# ### commands auto generated by Alembic - please adjust! ###
	with op.batch_alter_table('users', schema=None) as batch_op:
		batch_op.drop_column('volunteer_janitor_correctness')

	with op.batch_alter_table('comments', schema=None) as batch_op:
		batch_op.drop_column('volunteer_janitor_badness')

	# ### end Alembic commands ###
