Skip to content
Snippets Groups Projects
Commit 1fd41280 authored by Martin Mareš's avatar Martin Mareš
Browse files

DB: Soubor s diplomy si pamatuje, zda je schválen

parent b76d10e1
No related branches found
No related tags found
1 merge request!137Sazba diplomů
......@@ -532,6 +532,7 @@ CREATE TABLE cert_files (
cert_set_id int NOT NULL REFERENCES cert_sets(contest_id) ON DELETE CASCADE,
type cert_type NOT NULL,
pdf_file text NOT NULL, -- relativně vůči mo.util.data_dir('cert')
approved bool NOT NULL DEFAULT false,
UNIQUE (cert_set_id, type)
);
......
......@@ -30,6 +30,7 @@ CREATE TABLE cert_files (
cert_set_id int NOT NULL REFERENCES cert_sets(contest_id) ON DELETE CASCADE,
type cert_type NOT NULL,
pdf_file text NOT NULL, -- relativně vůči mo.util.data_dir('cert')
approved bool NOT NULL DEFAULT false,
UNIQUE (cert_set_id, type)
);
......
......@@ -1152,6 +1152,7 @@ class CertFile(Base):
cert_set_id = Column(Integer, ForeignKey('cert_sets.contest_id', ondelete='CASCADE'), primary_key=True)
type = Column(Enum(CertType, name='cert_type'), nullable=False, primary_key=True)
pdf_file = Column(Text, nullable=False)
approved = Column(Boolean, server_default=text("false"), nullable=False)
class Certificate(Base):
......@@ -1164,6 +1165,10 @@ class Certificate(Base):
page_number = Column(Integer, nullable=False)
cert_set = relationship('CertSet')
cert_file = relationship('CertFile',
primaryjoin='and_(CertFile.cert_set_id == Certificate.cert_set_id, CertFile.type == Certificate.type)',
foreign_keys='[Certificate.cert_set_id, Certificate.type]',
viewonly=True)
user = relationship('User')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment