Files
a-dog-a-pet/app/models/pet.py
2024-10-27 17:29:59 -03:00

15 lines
740 B
Python

import datetime
from sqlalchemy.orm import relationship, mapped_column
from app.extensions import db
class Pet(db.Model):
id = mapped_column(db.Integer, primary_key=True)
name = mapped_column(db.String(255), nullable=False)
kind_id = mapped_column(db.Integer, db.ForeignKey('pet_kind.id'), nullable=False)
age = mapped_column(db.Integer, default=0, nullable=False)
weight = mapped_column(db.Float, default=0, nullable=False)
location = mapped_column(db.String(255), nullable=False)
sex = mapped_column(db.String(1), nullable=False)
height = mapped_column(db.Float, default=0, nullable=False)
registration_date = mapped_column(db.DateTime, default=datetime.datetime.utcnow, nullable=False)
kind = relationship("PetKind")