adding current revision information
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
from sqlalchemy import Column, Integer, String, Date, ForeignKey, Text, Boolean
|
||||
from sqlalchemy.orm import relationship
|
||||
from database import Base
|
||||
|
||||
class User(Base):
|
||||
__tablename__ = "users"
|
||||
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
username = Column(String, unique=True, index=True)
|
||||
hashed_password = Column(String)
|
||||
is_active = Column(Boolean, default=True)
|
||||
is_admin = Column(Boolean, default=False)
|
||||
|
||||
signs = relationship("UserSign", back_populates="user")
|
||||
|
||||
class Sign(Base):
|
||||
__tablename__ = "signs"
|
||||
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
name = Column(String, unique=True, index=True)
|
||||
icon = Column(String)
|
||||
|
||||
horoscopes = relationship("Horoscope", back_populates="sign")
|
||||
users = relationship("UserSign", back_populates="sign")
|
||||
|
||||
|
||||
class UserSign(Base):
|
||||
__tablename__ = "user_signs"
|
||||
|
||||
user_id = Column(Integer, ForeignKey("users.id"), primary_key=True)
|
||||
sign_id = Column(Integer, ForeignKey("signs.id"), primary_key=True)
|
||||
|
||||
user = relationship("User", back_populates="signs")
|
||||
sign = relationship("Sign", back_populates="users")
|
||||
|
||||
|
||||
class Horoscope(Base):
|
||||
__tablename__ = "horoscopes"
|
||||
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
sign_id = Column(Integer, ForeignKey("signs.id"))
|
||||
date = Column(Date)
|
||||
timeline = Column(String) # daily, weekly, monthly, yearly
|
||||
content = Column(Text)
|
||||
|
||||
sign = relationship("Sign", back_populates="horoscopes")
|
||||
Reference in New Issue
Block a user