From 1c322479cee6c933194e03a9c87cd3a3ceb88fa7 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 b20d8652..6a65dc71 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 0cf4efc9..bc4ccdd3 100644 --- a/mo/db.py +++ b/mo/db.py @@ -330,6 +330,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