diff --git a/db/db.ddl b/db/db.ddl index b20d86522fb9feecd227c592cc519bcf22335de7..6a65dc71cd267aaf6ff5590c3d3e649e5916f608 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 0cf4efc9ce22904f9cc0e437aeb182105657f779..bc4ccdd3650492ea40376bb3e2cf0e9521d7f5c3 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')