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

DB: Nová tabulka odeslaných e-mailů

V ní si pamatujeme, které notifikace jsme už odeslali, abychom je
neopakovali.
parent 8f10d278
Branches
No related tags found
1 merge request!113Stav "opraveno"
This commit is part of merge request !113. Comments created here will be created in the context of that merge request.
......@@ -457,3 +457,12 @@ CREATE TABLE score_tables (
);
ALTER TABLE contests ADD CONSTRAINT "contests_scoretable_id" FOREIGN KEY (scoretable_id) REFERENCES score_tables(scoretable_id);
-- Odeslané mailové notifikace
CREATE TABLE sent_email (
user_id int NOT NULL REFERENCES users(user_id) ON DELETE CASCADE,
key varchar(100) NOT NULL,
sent_at timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (user_id, key)
);
......@@ -3,3 +3,10 @@ SET ROLE 'mo_osmo';
ALTER TYPE round_state ADD VALUE 'graded';
ALTER TYPE job_type ADD VALUE 'send_grading_info';
CREATE TABLE sent_email (
user_id int NOT NULL REFERENCES users(user_id) ON DELETE CASCADE,
key varchar(100) NOT NULL,
sent_at timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (user_id, key)
);
......@@ -898,6 +898,16 @@ class ScoreTable(Base):
contest = relationship('Contest', primaryjoin='Contest.scoretable_id == ScoreTable.scoretable_id')
class SentEmail(Base):
__tablename__ = 'sent_email'
user_id = Column(Integer, ForeignKey('users.user_id'), primary_key=True, nullable=False)
key = Column(String(100), primary_key=True, nullable=False)
sent_at = Column(DateTime(True), nullable=False, server_default=text("CURRENT_TIMESTAMP"))
user = relationship('User')
_engine: Optional[Engine] = None
_session: Optional[Session] = None
flask_db: Any = None
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment