<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def add_column(conn, table, column_name, default_value=None, schema=None):
 """ Adds given column to `activity` table jsonb data columns. In the following example we reflect the changes made to our schema to activity table. :: import sqlalchemy as sa from alembic import op from postgresql_audit import add_column def upgrade():
 op.add_column('article', sa.Column('created_at', sa.DateTime())) add_column(op, 'article', 'created_at') :param conn: An object that is able to execute SQL (either SQLAlchemy Connection, Engine or Alembic Operations object) :param table: The table to remove the column from :param column_name: Name of the column to add :param default_value: The default value of the column :param schema: Optional name of schema to use. """

    activity_table = get_activity_table(schema=schema)
    data = {column_name: default_value}
    query = (
        activity_table
        .update()
        .values(
            old_data=sa.case(
                [
                    (
                        sa.cast(activity_table.c.old_data, sa.Text) != '{}',
                        activity_table.c.old_data + data
                    ),
                ],
                else_=sa.cast({}, JSONB)
            ),
            changed_data=sa.case(
                [
                    (
                        sa.and_(
                            sa.cast(
                                activity_table.c.changed_data,
                                sa.Text
                            ) != '{}',
                            activity_table.c.verb != 'update'
                        ),
                        activity_table.c.changed_data + data
                    )
                ],
                else_=activity_table.c.changed_data
            ),
        )
        .where(activity_table.c.table_name == table)
    )
    return conn.execute(query)