def upgrade():
    op.drop_column('category', 'cluster_on_title')
    for table in ('user', 'feed', 'category'):
        logger.info('adding cluster control options on %s', table)
        for option in CLUSTER_CONF_OPTIONS:
            op.add_column(table, sa.Column(option, sa.Boolean(), default=None, nullable=True))
        op.add_column(table, sa.Column('cluster_conf', sa.PickleType(), default={}, nullable=True))
    logger.info('setting default options to true for users')
    op.execute(('UPDATE "user" SET %s;' % ', '.join([('%s=true' % opt) for opt in CLUSTER_CONF_OPTIONS])))
    for option in CLUSTER_CONF_OPTIONS:
        op.alter_column('user', option, nullable=False)
def upgrade():
    op.drop_column('category', 'cluster_on_title')
    for table in ('user', 'feed', 'category'):
        logger.info('adding cluster control options on %s', table)
        for option in CLUSTER_CONF_OPTIONS:
            op.add_column(table, sa.Column(option, sa.Boolean(), default=None, nullable=True))
        op.add_column(table, sa.Column('cluster_conf', sa.PickleType(), default={}, nullable=True))
    logger.info('setting default options to true for users')
    op.execute(('UPDATE "user" SET %s;' % ', '.join([('%s=true' % opt) for opt in CLUSTER_CONF_OPTIONS])))
    for option in CLUSTER_CONF_OPTIONS:
        op.alter_column('user', option, nullable=False)