From f8825458b0f6dbdca38a63a482aefa73a11af4f5 Mon Sep 17 00:00:00 2001
From: Martin Mares <mj@ucw.cz>
Date: Fri, 11 Oct 2024 20:08:19 +0200
Subject: [PATCH] DB: Add allow_zip_att

---
 db/db.ddl               | 1 +
 db/upgrade-20241011.sql | 5 +++++
 owl/db.py               | 1 +
 3 files changed, 7 insertions(+)
 create mode 100644 db/upgrade-20241011.sql

diff --git a/db/db.ddl b/db/db.ddl
index a026b7c..dd6c6f2 100644
--- a/db/db.ddl
+++ b/db/db.ddl
@@ -37,6 +37,7 @@ CREATE TABLE owl_courses (
 	anon_grading	boolean		NOT NULL DEFAULT FALSE,
 	auto_deadline	varchar(255)	DEFAULT NULL,	-- textual deadline specification
 	pass_threshold	numeric(6, 2)	DEFAULT NULL,	-- points needed to pass the course
+	allow_zip_att	boolean		NOT NULL DEFAULT TRUE,
 	UNIQUE(semid, ident)
 );
 
diff --git a/db/upgrade-20241011.sql b/db/upgrade-20241011.sql
new file mode 100644
index 0000000..e30b41d
--- /dev/null
+++ b/db/upgrade-20241011.sql
@@ -0,0 +1,5 @@
+SET ROLE owl;
+
+ALTER TABLE owl_courses ADD COLUMN
+	allow_zip_att	boolean		NOT NULL DEFAULT TRUE
+;
diff --git a/owl/db.py b/owl/db.py
index bb0a1f3..0ee718e 100644
--- a/owl/db.py
+++ b/owl/db.py
@@ -96,6 +96,7 @@ class Course(Base):
     anon_grading = Column(Boolean, nullable=False, server_default=text("false"))
     auto_deadline = Column(String(255))
     pass_threshold = Column(Numeric(6, 2), server_default=text("NULL::numeric"))
+    allow_zip_att = Column(Boolean, nullable=False, server_default=text("true"))
 
     semester = relationship('Semester')
 
-- 
GitLab