18 lines
714 B
Python
18 lines
714 B
Python
from datetime import datetime, timezone
|
|
from sqlalchemy import Column, String, JSON, DateTime
|
|
from sqlalchemy.ext.declarative import declarative_base
|
|
|
|
Base = declarative_base()
|
|
|
|
class ChannelDB(Base):
|
|
"""SQLAlchemy model for IPTV channels"""
|
|
__tablename__ = "channels"
|
|
|
|
tvg_id = Column(String, primary_key=True)
|
|
name = Column(String, nullable=False)
|
|
group_title = Column(String)
|
|
tvg_name = Column(String)
|
|
tvg_logo = Column(String)
|
|
urls = Column(JSON) # Stores list of URLs as JSON
|
|
created_at = Column(DateTime, default=lambda: datetime.now(timezone.utc))
|
|
updated_at = Column(DateTime, default=lambda: datetime.now(timezone.utc), onupdate=lambda: datetime.now(timezone.utc)) |