User with a phone

Report a typo

Let's suppose that we have two tables in the database: the table user with columns id, name, surname, and the table phone_number with columns id, user_id, and phone. The column user_id makes a connection between tables.

Below you can see a code that represents it, but the code is in a wrong order. Arrange it and add the indents where necessary.

Use the arrows on the right to move lines and the buttons on the left to add indentation (one click equals four spaces).

Reorder lines using drag or arrows. Adjust indentation with left buttons
                id = Column(Integer, primary_key=True)
              
                user_id = Column(Integer, ForeignKey("user.id"))
              
                from sqlalchemy.orm import declarative_base, relationship
              
                class User(Base):
              
                phone = relationship("PhoneNumber")
              
                id = Column(Integer, primary_key=True)
              
                __tablename__ = "phone_number"
              
                name = Column(String(255), unique=True, nullable=False)
              
                phone = Column(Integer, unique=True, nullable=False)
              
                surname = Column(String(255), unique=True, nullable=False)
              
                Base = declarative_base()
              
                user = relationship("User")
              
                class PhoneNumber(Base):
              
                __tablename__ = "user"
              
___

Create a free account to access the full topic