def METHOD_NAME():
    # ### commands auto generated by Alembic - please adjust! ###
    t_notification_new = sa.Table(
        "notification",
        sa.MetaData(),
        sa.Column("user_id", sa.Integer()),
        sa.Column("block_id", sa.Integer()),
        sa.Column("notification_type", e),
    )
    con = op.get_bind()
    notifications = con.execute(
        sa.select(
            [
                t_notification_new.c.user_id,
                t_notification_new.c.block_id,
                t_notification_new.c.notification_type,
            ]
        )
    ).fetchall()
    for user_id, block_id, notification_type in notifications:
        con.execute(
            sa.delete(t_notification_new).where(
                (t_notification_new.c.user_id == user_id)
                & (t_notification_new.c.block_id == block_id)
            )
        )
    old_notifications = dict()
    for user_id, block_id, notification_type in notifications:
        if (user_id, block_id) not in old_notifications:
            old_notifications[(user_id, block_id)] = {
                "user_id": user_id,
                "doc_id": block_id,
                "email_doc_modify": False,
                "email_comment_add": False,
                "email_comment_modify": False,
            }
        if notification_type in (
            "DocModified",
            "ParAdded",
            "ParModified",
            "ParDeleted",
        ):
            old_notifications[(user_id, block_id)]["email_doc_modify"] = True
        elif notification_type in ("CommentAdded",):
            old_notifications[(user_id, block_id)]["email_comment_add"] = True
        elif notification_type in ("CommentModified", "CommentDeleted"):
            old_notifications[(user_id, block_id)]["email_comment_modify"] = True
    # Drop the new primary key constraint
    op.add_column(
        "notification",
        sa.Column(
            "email_doc_modify", sa.BOOLEAN(), autoincrement=False, nullable=False
        ),
    )
    op.add_column(
        "notification",
        sa.Column(
            "email_comment_add", sa.BOOLEAN(), autoincrement=False, nullable=False
        ),
    )
    op.add_column(
        "notification",
        sa.Column(
            "email_comment_modify", sa.BOOLEAN(), autoincrement=False, nullable=False
        ),
    )
    op.drop_constraint("notification_pkey", "notification", type_="primary")
    op.add_column("notification", sa.Column("doc_id", sa.Integer(), nullable=False))
    op.create_foreign_key(None, "notification", "block", ["doc_id"], ["id"])
    op.drop_column("notification", "notification_type")
    op.drop_constraint("notification_block_id_fkey", "notification", type_="foreignkey")
    op.drop_column("notification", "block_id")
    op.create_primary_key("notification_pkey", "notification", ["user_id", "doc_id"])
    t_notification = sa.Table(
        "notification",
        sa.MetaData(),
        sa.Column("user_id", sa.Integer()),
        sa.Column("doc_id", sa.Integer()),
        sa.Column("email_doc_modify", sa.Boolean()),
        sa.Column("email_comment_add", sa.Boolean()),
        sa.Column("email_comment_modify", sa.Boolean()),
    )
    for old_notif in old_notifications.values():
        con.execute(
            t_notification.insert().values(
                user_id=old_notif["user_id"],
                doc_id=old_notif["doc_id"],
                email_doc_modify=old_notif["email_doc_modify"],
                email_comment_add=old_notif["email_comment_add"],
                email_comment_modify=old_notif["email_comment_modify"],
            )
        )
    # ### end Alembic commands ###