Start here
The safe first move
Keep backref if it works, or convert to explicit back_populates on both sides when the migration also touches the relationship.
Stop before automation when: Complex relationship inheritance. backref() with custom arguments.
Target shape
class User(Base):
orders = relationship("Order", back_populates="user")
class Order(Base):
user = relationship("User", back_populates="orders")