diff --git a/models/planet.py b/models/planet.py new file mode 100644 index 0000000..ca6e31d --- /dev/null +++ b/models/planet.py @@ -0,0 +1,19 @@ +from sqlalchemy import Column, String, Integer, ForeignKey +from sqlalchemy.orm import relationship +from sqlalchemy.sql import func +from app.api.db.base_class import Base +import uuid + +class Planet(Base): + __tablename__ = "planets" + + id = Column(Integer, primary_key=True, index=True) + name = Column(String, unique=True, nullable=False) + description = Column(String, nullable=True) + diameter = Column(Integer, nullable=False) + mass = Column(Integer, nullable=False) + distance_from_sun = Column(Integer, nullable=False) + + # Timestamps + created_at = Column(Integer, default=func.now()) + updated_at = Column(Integer, default=func.now(), onupdate=func.now()) \ No newline at end of file