diff --git a/db/db.ddl b/db/db.ddl
index 2cdf48a4574b789a3b77434b169997bceca1b6e9..04e278172a828023b3872e40ebd0bc4e0add6126 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 0000000000000000000000000000000000000000..f42909322e66c4fee7dd25129fcedc4645239288
--- /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 d7df8327b7688bccd70f8381c822684ff56884d0..033d37e708a26065e4bac71aa66857f7469f303d 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')