mirror of
https://github.com/BluemediaGER/discord-cleanup-bot.git
synced 2024-11-14 13:05:28 +01:00
31 lines
623 B
Python
31 lines
623 B
Python
from sqlalchemy import Column, Integer, DateTime, ForeignKey
|
|
|
|
from sqlalchemy.orm import relationship, backref
|
|
|
|
from sqlalchemy.ext.declarative import declarative_base
|
|
|
|
|
|
Base = declarative_base()
|
|
|
|
|
|
class Channel(Base):
|
|
|
|
__tablename__ = "channel"
|
|
|
|
channel_id = Column(Integer, primary_key=True)
|
|
|
|
retention_hours = Column(Integer)
|
|
|
|
last_pruned = Column(DateTime)
|
|
|
|
guild_id = Column(Integer, ForeignKey("guild.guild_id"))
|
|
|
|
|
|
class Guild(Base):
|
|
|
|
__tablename__ = "guild"
|
|
|
|
guild_id = Column(Integer, primary_key=True)
|
|
|
|
channels = relationship("Channel", backref=backref("guild"), cascade="delete")
|