"""How long each answer took. Revision ID: e9f0a1b2c3d4 Revises: d8e9f0a1b2c3 """ import sqlalchemy as sa from alembic import op from sqlalchemy import inspect revision = "e9f0a1b2c3d4" down_revision = "d8e9f0a1b2c3" branch_labels = None depends_on = None def upgrade(): # Nothing recorded this, so "time per question" could not be reported at all. # Null means an answer from before it was measured — distinct from zero, # which would claim it was instant. columns = {c["name"] for c in inspect(op.get_bind()).get_columns("attempt_answers")} if "seconds_spent" not in columns: op.add_column("attempt_answers", sa.Column("seconds_spent", sa.Integer, nullable=True)) def downgrade(): op.drop_column("attempt_answers", "seconds_spent")