From 644db78c03cee8dd16917812d4d254e99e572716 Mon Sep 17 00:00:00 2001
From: Martin Mares <mj@ucw.cz>
Date: Wed, 29 Sep 2021 22:36:38 +0200
Subject: [PATCH] =?UTF-8?q?DB:=20U=20u=C5=BEivatel=C5=AF=20si=20pamatujeme?=
=?UTF-8?q?,=20zda=20maj=C3=AD=20dost=C3=A1vat=20mailov=C3=A9=20notifikace?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
db/db.ddl | 3 ++-
db/upgrade-20210930.sql | 4 ++++
mo/db.py | 1 +
3 files changed, 7 insertions(+), 1 deletion(-)
create mode 100644 db/upgrade-20210930.sql
diff --git a/db/db.ddl b/db/db.ddl
index 2cdf48a4..04e27817 100644
--- a/db/db.ddl
+++ b/db/db.ddl
@@ -27,7 +27,8 @@ CREATE TABLE users (
last_login_at timestamp with time zone DEFAULT NULL,
reset_at timestamp with time zone DEFAULT NULL, -- poslední reset/aktivace nebo žádost o ně
password_hash varchar(255) DEFAULT NULL, -- heš hesla (je-li nastaveno)
- note text NOT NULL DEFAULT '' -- poznámka viditelná pro orgy
+ note text NOT NULL DEFAULT '', -- poznámka viditelná pro orgy
+ email_notify boolean NOT NULL DEFAULT true -- přeje si dostávat mailové notifikace
);
-- Hierarchie regionů a organizací
diff --git a/db/upgrade-20210930.sql b/db/upgrade-20210930.sql
new file mode 100644
index 00000000..f4290932
--- /dev/null
+++ b/db/upgrade-20210930.sql
@@ -0,0 +1,4 @@
+SET ROLE mo_osmo;
+
+ALTER TABLE users ADD COLUMN
+ email_notify boolean NOT NULL DEFAULT true;
diff --git a/mo/db.py b/mo/db.py
index d7df8327..033d37e7 100644
--- a/mo/db.py
+++ b/mo/db.py
@@ -331,6 +331,7 @@ class User(Base):
reset_at = Column(DateTime(True))
password_hash = Column(String(255), server_default=text("NULL::character varying"))
note = Column(Text, nullable=False, server_default=text("''::text"))
+ email_notify = Column(Boolean, nullable=False, server_default=text("true"))
roles = relationship('UserRole', primaryjoin='UserRole.user_id == User.user_id')
participants = relationship('Participant', primaryjoin='Participant.user_id == User.user_id')
--
GitLab