# Path: database.py
# def init_db():


from sqlalchemy import Index, Column, ForeignKey, Integer, String, Text, Float, TIMESTAMP, Boolean, LargeBinary
from sqlalchemy.orm import relationship, deferred
from database import Base, db_session

class Compiler(Base):
    __tablename__ = 'compilers'
    id = Column(Integer, primary_key=True)
    student = Column(String, nullable=False)
    repo_url = Column(String, nullable=False)
    latest_version_id = Column(Integer, ForeignKey('versions.id'))
    last_check_time = Column(TIMESTAMP)

class Version(Base):
    __tablename__ = 'versions'
    id = Column(Integer, primary_key=True)

# Path: database.py
# def init_db():


# Path: models.py
from sqlalchemy import Index, Column, ForeignKey, Integer, String, Text, Float, TIMESTAMP, Boolean, LargeBinary
from sqlalchemy.orm import relationship, deferred
from database import Base, db_session


class Compiler(Base):
    __tablename__ = 'compilers'
    id = Column(Integer, primary_key=True)
    student = Column(String, nullable=False)
    repo_url = Column(String, nullable=False)
    latest_version_id = Column(Integer, ForeignKey('versions.id'))
    last_check_time = Column(TIMESTAMP)

class Version(Base):
    __tablename__ = 'versions'
    id = Column(Integer, primary_key=True)

    compiler_id = Column(Integer, ForeignKey('compilers.id'), nullable=False, index=True)